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