-
Notifications
You must be signed in to change notification settings - Fork 16
/
post_introspect.yml
128 lines (109 loc) · 4.92 KB
/
post_introspect.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
- hosts: undercloud
vars:
tn10rt: "{{ hostvars['localhost']['tn10rt'] }}"
tasks:
- name: check and delete introspection failed nodes
include_tasks: tasks/delete_introspection_failed_nodes.yml
when: scale_compute_vms == false
- name: get all nodes
shell: |
source ~/stackrc
openstack baremetal node list -f value -c UUID
register: total_nodes
changed_when: false
- name: enable root_hints
include_tasks: tasks/set_root_hints.yml
when: lab_name in ['scale', 'alias']
- block:
- name: introspection data for a nodes
shell: |
source ~/stackrc
openstack baremetal introspection data save {{ item }} | jq . | grep by-path | cut -d \" -f 4
register: storage_disks_info
with_items: "{{ total_nodes.stdout_lines | default([]) }}"
when: composable_roles != true
- name: introspection data for a nodes
shell: |
source ~/stackrc
for i in $(openstack baremetal node list --format value -c UUID); do
if [[ `openstack baremetal node show $i --fields driver_info -f json | jq '.driver_info.ipmi_address'` =~ {{ ceph_machine_type }} ]]
then
openstack baremetal introspection data save $i | jq . | grep by-path | cut -d \" -f 4
fi
done
register: storage_disks_info_comp
with_items: "{{ total_nodes.stdout_lines | default([]) }}"
when: composable_roles
- name: set fact storage_node_disks
set_fact:
storage_node_disks: "{{ storage_node_disks|default([]) + item.stdout_lines }}"
with_items: "{{ storage_disks_info.results }}"
when: composable_roles != true
- name: set fact storage_node_disks
set_fact:
storage_node_disks: "{{ storage_node_disks|default([]) + item.stdout_lines }}"
with_items: "{{ storage_disks_info_comp.results }}"
when: composable_roles
when: storage_node_disks is not defined and ceph_enabled and osp_release|int < 17
- name: show the storage_node_disks
debug:
msg: "{{ storage_node_disks|unique }}"
when: ceph_enabled and osp_release|int < 17
- name: setting node capabilities (boot_mode bios)
vars:
boot_mode: bios
include_tasks: tasks/set_boot_mode.yml
when: osp_release|int >= 17 or composable_roles
- hosts: localhost
gather_facts: yes
vars:
nodes_uuids: "{{ hostvars['undercloud']['total_nodes'] }}"
tasks:
- name: Set compute count fact
set_fact:
compute_count: "{{ compute_count|default(oc_instackenv_content.nodes|length - (controller_count|int) - (ceph_node_count|int)) }}"
- block:
- name: check registered nodes with requested node count
debug:
msg: "Less nodes {{ nodes_uuids.stdout_lines|length }} registered with ironic than requested {{ compute_count|int + controller_count|int + ceph_node_count|int }}. So we will be adjusting controller and compute count according to registered available nodes"
when: nodes_uuids.stdout_lines|length < (compute_count|int + controller_count|int + ceph_node_count|int)
- name: Adjust compute count
set_fact:
compute_count: "{{ compute_count|int - 1 }}"
when: nodes_uuids.stdout_lines|length < (compute_count|int + controller_count|int + ceph_node_count|int)
with_items: "{{ nodes_uuids }}"
when: scale_compute_vms == false
- name: save the compute count
shell: |
echo "{{ compute_count }}" > compute_count
- name: fail when compute count is less than 1
fail:
msg: "Failing as compute count is less than 1"
when: compute_count|int < 1
- name: set facts about failed nodes
set_fact:
failed_nodes_machine_type: "{{ hostvars['undercloud']['failed_nodes_machine_type'] }}"
failed_nodes_machine_count: "{{ hostvars['undercloud']['failed_nodes_machine_count'] }}"
when: composable_roles
ignore_errors: true
- name: prepare baremetal_deployment.yaml.j2
template:
src: baremetal_deployment.yaml.j2
dest: "{{ ansible_user_dir }}/virt/network/baremetal_deployment.yaml.j2"
when: osp_release|int == 17
- name: Template out nodes_data file
template:
src: nodes_data.yml.j2
dest: ~/virt/nodes_data.yaml
when: composable_roles
- name: set fact for storage nodes
set_fact:
storage_node_disks: "{{ hostvars['undercloud']['storage_node_disks']|unique }}"
when: ceph_enabled and storage_node_disks is not defined and osp_release|int < 17
- name: generate internal.yml.j2
template:
src: internal.yml.j2
dest: ~/.infrared/plugins/tripleo-overcloud/templates/storage/internal.yml.j2
force: yes
when: ceph_enabled