Adds ability to deploy from upstream openstack
[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         - overcloud-full.qcow2
15         - deploy_command
16         - virtual-environment.yaml
17         - baremetal-environment.yaml
18         - "{{ apex_env_file }}"
19     - name: Copy network data to undercloud
20       copy:
21         src: "{{ apex_temp_dir }}/network_data.yaml"
22         dest: "/home/stack/network_data.yaml"
23         owner: stack
24         group: stack
25         mode: 0644
26       when: os_version != 'ocata'
27     - copy:
28         src: "{{ apex_temp_dir }}/storage-environment.yaml"
29         dest: /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
30         owner: root
31         group: root
32         mode: 0664
33     - systemd:
34         name: openstack-swift-proxy
35         state: restarted
36         enabled: yes
37       become: yes
38     - name: Upload glance images
39       shell: "{{ stackrc }} && openstack overcloud image upload"
40       become: yes
41       become_user: stack
42     - name: Import inventory (baremetal)
43       shell: "{{ stackrc }} && openstack overcloud node import instackenv.json"
44       when: not virtual
45     - name: Introspect inventory (baremetal)
46       shell: "{{ stackrc }} && openstack overcloud node introspect --all-manageable --provide"
47       when:
48         - not virtual
49         - not aarch64
50     - name: Import inventory (virtual)
51       shell: "{{ stackrc }} && openstack overcloud node import --provide instackenv.json"
52       when: virtual
53     - name: Set flavors
54       shell: '{{ stackrc }} && openstack flavor set --property "cpu_arch"="{{ ansible_architecture }}" {{ item }}'
55       with_items:
56         - baremetal
57         - control
58         - compute
59     - name: Configure DNS server for ctlplane network
60       shell: "{{ stackrc }} && openstack subnet set ctlplane-subnet {{ dns_server_args }}"
61     - block:
62         - name: Execute Overcloud Deployment
63           shell: "{{ stackrc }} && bash deploy_command"
64       rescue:
65         - name: Show overcloud failures
66           shell: "{{ stackrc }} && openstack stack failures list overcloud --long"
67     - name: Show Keystone output
68       shell: "{{ overcloudrc }} && {{ item }}"
69       when: debug
70       with_items:
71         - openstack endpoint list
72         - openstack service list
73     - name: Get overcloud nodes and IPs
74       shell: "{{ stackrc }} && openstack server list -f json"
75       register: nova_list
76     - name: Write nova list output to file
77       local_action: copy content="{{ nova_list.stdout }}" dest="{{ apex_temp_dir }}/nova_output"
78     - name: Fetch overcloudrc
79       fetch:
80         src: /home/stack/overcloudrc
81         dest: "{{ apex_temp_dir }}/"
82         flat: yes