Next step is to install ssh key in order to be able to run other scripts.
To do that run script named 'installkey.sh'. It will execute ansible playbook
'installsshkey.yml' and you will have to enter password for specified user.
+
+Now you can run script 'do_config.sh' which will execute ansible with playbook
+for 'master' machine.
--- /dev/null
+#!/bin/sh
+cd master
+./do_master.sh
+
+cd ..
[all:vars]
ansible_user=vagrant
+proxy=http://106.116.37.23:3128
--- /dev/null
+#!/bin/sh
+ansible-playbook master.yml --inventory-file=../hosts
--- /dev/null
+---
+# This playbook configures master machine
+
+- hosts: master
+ become: yes
+ become_method: sudo
+ vars:
+ username: pita # Prerelease Image Testing Automation
+
+ roles:
+ - user
+ - system
+ - testlab
--- /dev/null
+---
+# This role configures system and installs
+
+- name: Update packages info
+ apt:
+ update_cache: yes
+ force: yes
+
+- name: Upgrade packages
+ apt:
+ upgrade: full
+ force: yes
+
+- name: Install tools
+ apt: "name={{ item }} state=present force=yes"
+ with_items:
+ - wget
+ - task-spooler
+ - python-bs4
+ - git
+
+- name: Set http_proxy environment variable
+ lineinfile:
+ dest: /etc/environment
+ state: present
+ regexp: '^http_proxy'
+ line: 'http_proxy="{{ proxy }}"'
+
+- name: Set HTTP_PROXY environment variable
+ lineinfile:
+ dest: /etc/environment
+ state: present
+ regexp: '^HTTP_PROXY'
+ line: 'HTTP_PROXY="{{ proxy }}"'
--- /dev/null
+---
+# This role does the job related to testlab-major
+
+- name: Prepare testlab-major directory
+ file:
+ path: /opt/testlab-major
+ state: directory
+ owner: "{{ username }}"
+ group: "{{ username }}"
+
+- name: Clone testlab-major repo
+ become: yes
+ become_user: "{{ username }}"
+ git:
+ repo: git://git.tizen.org/tools/testlab/major
+ dest: /opt/testlab-major
--- /dev/null
+---
+# This playbook creates and sets up user
+
+- name: "Add group {{ username }}"
+ group:
+ name: "{{ username }}"
+
+# Add user
+- name: "Add user {{ username }}"
+ user:
+ name: "{{ username }}"
+ groups: "{{ username }},sudo"
+ home: /home/{{ username }}
+
+- name: Remove ssh key from user
+ become: yes
+ become_user: "{{ username }}"
+ file:
+ path: "{{ item }}"
+ state: absent
+ with_items:
+ - "~/.ssh/id_rsa"
+ - "~/.ssh/id_rsa.pub"
+
+- name: Generate ssh key for user
+ become: yes
+ become_user: "{{ username }}"
+ command: "ssh-keygen -f ~/.ssh/id_rsa -N ''"
+
+- name: Fetch generated ssh key
+ become: yes
+ become_user: "{{ username }}"
+ fetch:
+ src: ~/.ssh/id_rsa.pub
+ dest: ~/tmp/id_rsa.pub
+ flat: yes