-
Notifications
You must be signed in to change notification settings - Fork 0
/
tripleo_roles.yml
137 lines (124 loc) · 5.15 KB
/
tripleo_roles.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
129
130
131
132
133
134
135
136
137
---
- name: Create roles templates
hosts: undercloud
any_errors_fatal: true
gather_facts: yes
vars:
template_base: "{{ ansible_user_dir }}/{{ install.deployment.files | basename }}"
roles_base: "/usr/share/openstack-tripleo-heat-templates/roles"
ipv6_postfix: "{{ (install.network.protocol == 'ipv4') | ternary('', '-v6')}}"
ipv6_postfix_underscore: "{{ (install.network.protocol == 'ipv4') | ternary('', '_v6')}}"
nics_subfolder: "{{ (install.version|default(undercloud_version)|openstack_release > 10) | ternary('', 'legacy') }}"
flavor_name_mapping:
Controller: Control
ObjectStorage: SwiftStorage
role_names_mapping:
ceph: CephStorage
swift: ObjectStorage
compute_dvr: ComputeDVR
aio: Standalone
tht_mapping:
- regexp: ^(Controller).*
net_config_file: "controller{{ ipv6_postfix }}.yaml"
node_name: controller
- regexp: ^(Novacontrol).*
net_config_file: "novacontrol.yaml"
node_name: novacontrol
- regexp: ^(Compute).*
net_config_file: "compute.yaml"
node_name: compute
- regexp: ^(Ceph).*
net_config_file: "ceph-storage.yaml"
node_name: ceph
- regexp: ^(ObjectStorage).*
net_config_file: "swift-storage.yaml"
node_name: swift
- regexp: ^(Database).*
net_config_file: "database_internal.yaml"
node_name: database
- regexp: ^(Messaging).*
net_config_file: "messaging_internal.yaml"
node_name: messaging
- regexp: ^(Networker).*
net_config_file: "networker.yaml"
node_name: networker
- regexp: ^(HciCephAll).*
net_config_file: "osdcompute.yaml"
node_name: hcicephall
tags:
- deploy_preparation
- tht_roles
tasks:
- name: create roles folder
file:
path: "{{ template_base }}/roles"
state: directory
- name: template for generating roles_data.yml
template:
src: tripleo_roles/tripleo_roles.sh.j2
dest: "{{ template_base }}/roles/tripleo_roles.sh"
force: yes
- name: generate roles_data.yaml
shell: |
source ~/stackrc
bash "{{ template_base }}/roles/tripleo_roles.sh" &> roles_data.log
register: roles_data
- name: generate node_names_mapping from role_names_mapping
set_fact:
node_names_mapping: "{{ node_names_mapping|default({}) | combine({ item.value: item.key}) }}"
with_dict: "{{ role_names_mapping }}"
- name: read roles data file
command: "cat {{ template_base }}/roles/roles_data.yaml"
register: roles_data_output
- name: load roles data to var
set_fact:
roles_data_var: "{{ roles_data_output.stdout | from_yaml }}"
- name: create list with nodes which don't have hostname format
set_fact:
nodes_without_hostname_format: "{{ nodes_without_hostname_format|default({}) | combine({node_names_mapping.get(item.name, item.name|lower): item.name}) }}"
when: item.HostnameFormatDefault is not defined
with_items: "{{ roles_data_var }}"
- name: prepare hostname template for roles without default format
template:
src: tripleo_roles/hostnames.yaml.j2
dest: "{{ template_base }}/hostnames.yaml"
when: nodes_without_hostname_format is defined
- name: load networks mapping for specific ips
include_vars:
file: "files/control_node_placement/network_mapping.yaml"
when:
- install.predictable
- install.predictable.ips
- install.version|default(undercloud_version) | openstack_release >= 10
- name: create the nodes file
template:
src: tripleo_roles/nodes.yaml.j2
dest: "{{ template_base }}/roles/nodes.yaml"
force: yes
- name: replace '%stackname%- in host name formats
replace:
path: "{{ template_base }}/roles/roles_data.yaml"
regexp: "HostnameFormatDefault: '%stackname%-(.*)'"
replace: 'HostnameFormatDefault: "\1"'
- name: replace host names for roles
replace:
path: "{{ template_base }}/roles/roles_data.yaml"
regexp: 'HostnameFormatDefault: "{{ item.old }}-(.*)"'
replace: 'HostnameFormatDefault: "{{ item.new }}-\1"'
with_items:
- old: novacompute[a-z]*
new: compute
- old: compute[a-z]*
new: compute
- name: assigning specific node ids
import_tasks: tasks/control_node_placement/specific_node_ids.yml
when:
- install.specific.node.ids
- install.version|default(undercloud_version) | openstack_release >= 10
vars:
role_file_path: "{{ template_base }}/roles/roles_data.yaml"
generate_scheduler_hints: yes
- name: Deploy the Overcloud with composable roles
import_playbook: "{{ overcloud_deploy | default('deploy.yml') }}"
tags:
- tripleo_roles_deploy