19e463803745565b4c6a6d81359f5efbad94564a
[apex.git] / lib / ansible / playbooks / deploy_overcloud.yml
1 ---
2 - hosts: all
3   tasks:
4     - name: Copy all files to undercloud
5       copy:
6         src: "{{ apex_temp_dir }}/{{ item }}"
7         dest: "/home/stack/{{ item }}"
8         owner: stack
9         group: stack
10         mode: 0644
11       with_items:
12         - network-environment.yaml
13         - instackenv.json
14         - opnfv-environment.yaml
15         - overcloud-full.qcow2
16         - deploy_command
17         - virtual-environment.yaml
18         - baremetal-environment.yaml
19     - copy:
20         src: "{{ apex_temp_dir }}/storage-environment.yaml"
21         dest: /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
22         owner: root
23         group: root
24         mode: 0664
25     - systemd:
26         name: openstack-swift-proxy
27         state: restarted
28         enabled: yes
29       become: yes
30     - name: Upload glance images
31       shell: "{{ stackrc }} && openstack overcloud image upload"
32       become: yes
33       become_user: stack
34     - name: Import inventory (baremetal)
35       shell: "{{ stackrc }} && openstack overcloud node import instackenv.json"
36       when: not virtual
37     - name: Introspect inventory (baremetal)
38       shell: "{{ stackrc }} && openstack overcloud node introspect --all-manageable --provide"
39       when:
40         - not virtual
41         - not aarch64
42     - name: Import inventory (virtual)
43       shell: "{{ stackrc }} && openstack overcloud node import --provide instackenv.json"
44       when: virtual
45     - name: Set flavors
46       shell: '{{ stackrc }} && openstack flavor set --property "cpu_arch"="{{ ansible_architecture }}" {{ item }}'
47       with_items:
48         - baremetal
49         - control
50         - compute
51     - name: Configure DNS server for ctlplane network
52       shell: "{{ stackrc }} && openstack subnet set ctlplane-subnet {{ dns_server_args }}"
53     - block:
54         - name: Execute Overcloud Deployment
55           shell: "{{ stackrc }} && bash deploy_command"
56       rescue:
57         - name: Show overcloud failures
58           shell: "{{ stackrc }} && openstack stack failures list overcloud --long"
59     - name: Show Keystone output
60       shell: "{{ overcloudrc }} && {{ item }}"
61       when: debug
62       with_items:
63         - openstack endpoint list
64         - openstack service list
65     - name: Get overcloud nodes and IPs
66       shell: "{{ stackrc }} && openstack server list -f json"
67       register: nova_list
68     - name: Write nova list output to file
69       local_action: copy content="{{ nova_list.stdout }}" dest="{{ apex_temp_dir }}/nova_output"
70     - name: Fetch overcloudrc
71       fetch:
72         src: /home/stack/overcloudrc
73         dest: "{{ apex_temp_dir }}/"
74         flat: yes