-
Notifications
You must be signed in to change notification settings - Fork 16
/
composable.yml
126 lines (110 loc) · 5.02 KB
/
composable.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
---
- hosts: localhost
tasks:
- name: override the overcloud_deploy.sh.j2 for composable roles
vars:
oc_deploy_template: "{{ ansible_user_dir }}/jetpack/templates/composable_roles_overcloud_deploy.sh.j2"
infrared_oc_deploy_template: "{{ ansible_user_dir }}/.infrared/plugins/tripleo-overcloud/templates/overcloud_deploy.sh.j2"
shell: |
cp {{ oc_deploy_template }} {{ infrared_oc_deploy_template }}
- name: create flavors
shell: |
source ~/stackrc
openstack flavor create --id auto --ram 4096 --disk 40 --vcpus 1 baremetal{{ item }}
openstack flavor set --property "capabilities:boot_option"="local" --property "capabilities:profile"="baremetal{{ item }}" baremetal{{ item }}
openstack flavor set baremetal{{ item }} --property "resources:VCPU"="0"
openstack flavor set baremetal{{ item }} --property "resources:MEMORY_MB"="0"
openstack flavor set baremetal{{ item }} --property "resources:DISK_GB"="0"
openstack flavor set baremetal{{ item }} --property "resources:CUSTOM_BAREMETAL"="1"
with_items: "{{ machine_types }} "
delegate_to: undercloud
when: osp_release|int < 17
- name: avoid compute role of controller machine type when insufficient nodes
set_fact:
machine_types: "{{ machine_types | difference(controller_machine_type) }}"
when: machine_count[controller_machine_type]|int == controller_count|int
- name: avoid compute role of ceph machine type when insufficient nodes
set_fact:
machine_types: "{{ machine_types | difference(ceph_machine_type) }}"
when: ceph_enabled and (machine_count[ceph_machine_type]|int == ceph_node_count|int)
- hosts: undercloud
vars:
machine_types: "{{ hostvars['localhost']['machine_types'] }}"
tn10rt: "{{ hostvars['localhost']['tn10rt'] }}"
tasks:
- name: copy roles directory
command: |
cp -r /usr/share/openstack-tripleo-heat-templates/roles /home/stack
- name: copy roles directory
command: |
cp -r ~/roles/Compute.yaml ~/roles/Compute{{ item }}.yaml
with_items: "{{ machine_types }}"
- name: replace control plane interface
lineinfile:
path: "/home/stack/roles/Compute{{ item }}.yaml"
regexp: '- name:'
line: "- name: Compute{{ item }}"
with_items: "{{ machine_types }}"
- name: replace control plane interface
lineinfile:
path: "/home/stack/roles/Compute{{ item }}.yaml"
regexp: ' HostnameFormatDefault:'
line: " HostnameFormatDefault: 'compute{{ item }}-%index%'"
with_items: "{{ machine_types }}"
- block:
- name: copy role for computePCI
command: |
cp -r ~/roles/Compute.yaml ~/roles/Compute{{ item }}PCI.yaml
when: item == pci_node_type
with_items: "{{ machine_types }}"
- name: replace control plane interface PCI
lineinfile:
path: "/home/stack/roles/Compute{{ item }}PCI.yaml"
regexp: '- name:'
line: "- name: Compute{{ item }}PCI"
when: item == pci_node_type
with_items: "{{ machine_types }}"
- name: replace control plane interface PCI
lineinfile:
path: "/home/stack/roles/Compute{{ item }}PCI.yaml"
regexp: ' HostnameFormatDefault:'
line: " HostnameFormatDefault: '%stackname%-compute{{ item }}pci-%index%'"
when: item == pci_node_type
with_items: "{{ machine_types }}"
when: passthrough_nvme is defined and pci_node_type is defined
- name: set roles
vars:
roles: "{{ ('Controller' + ' CephStorage') if ceph_enabled else 'Controller' }}"
set_fact:
roles: "{{ roles + ' Compute' + item }}"
when: (passthrough_nvme is not defined) and not manila_enabled
with_items: "{{ machine_types }}"
- name: set roles
vars:
roles: "{{ ('ControllerStorageNfs' + ' CephStorage') if ceph_enabled else 'ControllerStorageNfs' }}"
set_fact:
roles: "{{ roles + ' Compute' + item }}"
when: (passthrough_nvme is not defined) and manila_enabled
with_items: "{{ machine_types }}"
- name: set roles
vars:
roles: "{{ 'Controller' + ' CephStorage' + ( ' Compute' + pci_node_type + 'PCI') if ceph_enabled else 'Controller' + ( ' Compute' + pci_node_type + 'PCI') }}"
set_fact:
roles: "{{ roles + ' Compute' + item }}"
when: passthrough_nvme is defined and pci_node_type is defined
with_items: "{{ machine_types }}"
- name: generate roles_data
shell: |
source ~/stackrc
openstack overcloud roles generate -o ~/roles_data.yaml --roles-path ~/roles {{ roles }}
args:
chdir: "/home/stack"
- block:
- name: create roles directory as required for infrared
file:
path: "~/virt/roles"
state: directory
- name: copy roles_data file to virt directory
shell: |
cp ~/roles_data.yaml ~/virt/roles/
when: ceph_enabled and osp_release|int >= 17