Merge "Dial in docker and ssh environment"
[releng.git] / prototypes / openstack-ansible / playbooks / configure-xcimaster.yml
1 ---
2 - hosts: xcimaster
3   remote_user: root
4   vars_files:
5     - ../var/ubuntu.yml
6   tasks:
7     - name: generate SSH keys
8       shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
9       args:
10         creates: /root/.ssh/id_rsa
11     - name: fetch public key
12       fetch: src="/root/.ssh/id_rsa.pub" dest="/"
13     - name: remove openstack-ansible directories
14       file:
15         path={{ item }}
16         state=absent
17         recurse=no
18       with_items:
19         - "{{OSA_PATH}}"
20         - "{{OSA_ETC_PATH}}"
21     - name: clone openstack-ansible
22       git:
23         repo: "{{OSA_URL}}"
24         dest: "{{OSA_PATH}}"
25         version: "{{OPENSTACK_OSA_VERSION}}"
26     - name: copy opnfv-setup-openstack.yml to /opt/openstack-ansible/playbooks
27       copy:
28         src: ../file/opnfv-setup-openstack.yml
29         dest: "{{OSA_PATH}}/playbooks/opnfv-setup-openstack.yml"
30     - name: copy /opt/openstack-ansible/etc/openstack_deploy to /etc/openstack_deploy
31       shell: "/bin/cp -rf {{OSA_PATH}}/etc/openstack_deploy {{OSA_ETC_PATH}}"
32     - name: bootstrap
33       command: "/bin/bash ./scripts/bootstrap-ansible.sh"
34       args:
35         chdir: "{{OSA_PATH}}"
36     - name: generate password token
37       command: "python pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml"
38       args:
39         chdir: /opt/openstack-ansible/scripts/
40     - name: copy openstack_user_config.yml to /etc/openstack_deploy
41       copy:
42         src: ../file/openstack_user_config.yml
43         dest: "{{OSA_ETC_PATH}}/openstack_user_config.yml"
44     - name: copy cinder.yml to /etc/openstack_deploy/env.d
45       copy:
46         src: ../file/cinder.yml
47         dest: "{{OSA_ETC_PATH}}/env.d/cinder.yml"
48     - name: copy user_variables.yml to /etc/openstack_deploy/
49       copy:
50         src: ../file/user_variables.yml
51         dest: "{{OSA_ETC_PATH}}/user_variables.yml"
52     - name: configure network
53       template:
54         src: ../template/bifrost/controller.interface.j2
55         dest: /etc/network/interfaces
56       notify:
57         - restart network service
58   handlers:
59     - name: restart network service
60       shell: "/sbin/ifconfig ens3 0 &&/sbin/ifdown -a && /sbin/ifup -a"
61
62 - hosts: localhost
63   remote_user: root
64   tasks:
65     - name: Generate authorized_keys
66       shell: "/bin/cat /xcimaster/root/.ssh/id_rsa.pub >> ../file/authorized_keys"