58b70c9173974332ba46c6d3e6c1f6161d0ac3f7
[csit.git] / resources / tools / testbed-setup / ansible / roles / virl / tasks / 03-virl-post-install.yaml
1 ---
2   - name: Add jenkins-in user
3     user: name=jenkins-in shell=/bin/bash comment="Jenkins user"
4   - name: Add jenkins-in user to sudoers
5     copy: src=files/sudoers_jenkins-in dest=/etc/sudoers.d/jenkins-in owner=root group=root mode=660
6   - name: Set Jenkins user authorized key
7     authorized_key: user=jenkins-in key="{{ lookup('file', '/home/testuser/.ssh/id_rsa.pub') }}"
8   - name: copy salt states for dnsmasq and nfs
9     synchronize: src=files/salt/ dest=/
10   - name: install NFS salt
11     shell: salt-call --local state.sls ckoester.nfs-server
12   - name: NFS symlink
13     shell: ln -s /nfs/scratch /scratch
14     args:
15       creates: /scratch
16   - name: Upate Nova CPU mode
17     ini_file: dest=/etc/nova/nova.conf section=libvirt option=cpu_mode value=host-passthrough
18   - name: Restart nova-compute service
19     service: name=nova-compute state=restarted
20   - name: Change listen interface in NTP settings
21     lineinfile: dest=/etc/ntp.conf state=present regexp='^interface listen 172.16.*' line='interface listen {{ ansible_default_ipv4["address"] }}'
22   - name: Restart NTP service
23     service: name=ntp state=restarted
24   - name: Permit SSH user environment
25     lineinfile: dest=/etc/ssh/sshd_config state=present regexp='PermitUserEnvironment.*' line='PermitUserEnvironment yes'
26   - name: Restart SSH daemon
27     service: name=ssh state=restarted
28   - name: clone csit git repository
29     git: repo=https://gerrit.fd.io/r/csit
30          dest=/home/jenkins-in/git/csit
31     become: jenkins-in
32   - name: Link testcase-infra directory
33     command: ln -sf /home/jenkins-in/git/csit/resources/tools/virl /home/jenkins-in/testcase-infra
34     args:
35       creates: /home/jenkins-in/testcase-infra
36     become: jenkins-in
37   - name: Create bin directory
38     file: path=/home/jenkins-in/bin state=directory mode=0755
39     become: jenkins-in
40   - name: Link start-testcase executable
41     command: ln -sf /home/jenkins-in/testcase-infra/bin/start-testcase /home/jenkins-in/bin/start-testcase
42     args:
43       creates: /home/jenkins-in/bin/start-testcase
44     become: jenkins-in
45   - name: Link stop-testcase executable
46     command: ln -sf /home/jenkins-in/testcase-infra/bin/stop-testcase /home/jenkins-in/bin/stop-testcase
47     args:
48       creates: /home/jenkins-in/bin/stop-testcase
49     become: jenkins-in
50   - name: Link start-testcase-DMM executable
51     command: ln -sf /home/jenkins-in/testcase-infra/bin/start-testcase-DMM /home/jenkins-in/bin/start-testcase-DMM
52     args:
53       creates: /home/jenkins-in/bin/start-testcase-DMM
54     become: jenkins-in
55   - name: Link kill-idle-testcases executable
56     command: ln -sf /home/jenkins-in/testcase-infra/bin/kill-idle-testcases /home/jenkins-in/bin/kill-idle-testcases
57     args:
58       creates: /home/jenkins-in/bin/kill-idle-testcases
59     become: jenkins-in
60   - name: Copy SSH private key
61     copy: src=files/virl/id_rsa_virl dest=/home/jenkins-in/.ssh/id_rsa_virl mode=600
62     become: jenkins-in
63   - name: Copy SSH public key
64     copy: src=files/virl/id_rsa_virl.pub dest=/home/jenkins-in/.ssh/id_rsa_virl.pub mode=644
65     become: jenkins-in
66   - name: Copy SSH environment
67     copy: src=files/virl/ssh_environment dest=/home/jenkins-in/.ssh/environment mode=644
68     become: jenkins-in
69   - name: Add ~/bin to path
70     lineinfile: dest=/home/jenkins-in/.bashrc state=present line='PATH=${HOME}/bin:$PATH'
71     become: jenkins-in
72   - name: Update own IP address in start script
73     shell: sed -i /home/jenkins-in/testcase-infra/bin/start-testcase -e 's/10.30.51.28/{{ ansible_default_ipv4["address"] }}/'
74     become: jenkins-in
75   - name: Add authorized key
76     lineinfile: dest=/home/jenkins-in/.ssh/authorized_keys line='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD4gderzsZyoxHULjuvPHoJuKnkaGrykqtuoqs/k1/jUdxitPoY5eX2cVYqww7MiUif7zLsiXbt5mHtyxAYCluDxAuIcy1xgSZY3MpmmSqDie4A/FdVfCUqCcpf3TZKsRP0an1MNrKIe0JFZV+uU889IDRQRdboGMs3+4cn5b9fOutpv71qwFVrTm9PZbqfQonrrN8Jp4Mz3XaZDpK22xwDAWhYOZ0eV6CJWquUgbYAHE6/HHMvd0zeJKaWZCXO/1tOGOj6cjgoViHqbnCtmYCjmv/ir0IglzbUdWdOqQY5YkhnPonveV48lVKrmBipqgbDezAUQD8wOQ7HttpYpKgt jenkins-in@tb4-virl'
77     become: jenkins-in
78 # All of the below will fail if VIRL user/project already exist
79   - name: Create VIRL project
80     shell: virl_uwm_client project-edit --name tb4-virl --enabled True  -i 400 -r 1024000 -c 500
81     ignore_errors: true
82     become: virl
83 #  - name: Delete VIRL project user
84 #    shell: virl_uwm_client user-delete --name tb4-virl
85 #    ignore_errors: true
86 #  - name: Recreate VIRL project user
87 #    shell: virl_uwm_client user-create --name tb4-virl --role admin --project tb4-virl --set-password Cisco1234
88 #    ignore_errors: true
89   - name: Create VPP flavor
90     shell: virl_uwm_client flavor-create --name vPP --ram 4096 --vcpus 2 --disk 0
91     ignore_errors: true
92     become: virl