-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpf9-express.yml
170 lines (154 loc) · 5.47 KB
/
pf9-express.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
##
## pf9-express - Platform9 Systems, Inc. - https://www.platform9.com/
##
## This playbook can be used to deploy and manage Platform9's PMO and PMK products.
##
######################################################################
# Repair Inventory
#
# In Ansible 2.8+, hyphens are not allowed in inventory group names.
# The following tasks backup and repair the inventory file as needed.
# See Issue #210 for more information.
######################################################################
- hosts: all
any_errors_fatal: true
tasks:
- name: Grab all group names in inventory containing hyphens
shell: grep -E -o '\[.*?-.*?\]' {{ inventory_file }} | sed 's/[][]//g'
register: groups_list
failed_when: "groups_list.rc == 2"
changed_when: false
delegate_to: localhost
run_once: true
- debug:
msg: "The following group name/reference will be modified: {{ item }}"
with_items: "{{ groups_list.stdout_lines }}"
when: groups_list.stdout != ""
run_once: true
- name: Make a backup of the inventory file, if needed
copy:
src: "{{ inventory_file }}"
dest: "{{ inventory_file }}.{{ ansible_date_time.iso8601 }}.bak"
when: groups_list.stdout != ""
delegate_to: localhost
run_once: true
- name: Replace hyphens with underscores in inventory group names
replace:
path: "{{ inventory_file }}"
regexp: "{{ item }}"
replace: "{{ item | regex_replace('-','_') }}"
with_items: "{{ groups_list.stdout_lines }}"
when: groups_list.stdout != ""
delegate_to: localhost
run_once: true
# Common Roles
- hosts:
- hypervisors
- k8s_master
- k8s_worker
become: true
gather_facts: False
pre_tasks:
- debug: var=autoreg
- name: install python2 on Ubuntu to enable running Ansible on Ubuntu hosts
raw: if [ -e /etc/lsb-release -a ! -e /usr/bin/python ]; then (apt-get -y update && apt-get install -y python-minimal); fi
# Run pre_flight_checks
- hosts:
- hypervisors
- k8s_master
- k8s_worker
become: true
roles:
- pf9-auth
# Run pre_hook
- hosts:
- hypervisors
- k8s_master
- k8s_worker
become: true
roles:
- pre-hook
# Configure the bond
- hosts: bond_config
become: true
roles:
- { role: "bond-config", when: manage_network == True }
- { role: "pf9-auth", when: manage_network == True and ansible_distribution == "Ubuntu" }
# OpenStack Hypervisor Nodes
- hosts: hypervisors
become: true
roles:
- pre-flight-checks-openstack
- common
- ntp
- pf9-hostagent
- qemu-kvm-ev
- neutron-prerequisites
- { role: "network-hook", when: manage_network == True }
- { role: "map-role", rolename: "pf9-ostackhost-neutron", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-neutron-base", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-ceilometer", when: autoreg == "on" and ceilometer == "on" }
- { role: "map-role", rolename: "pf9-neutron-ovs-agent", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-neutron-l3-agent", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-neutron-metadata-agent", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-neutron-dhcp-agent", when: autoreg == "on" and dhcp == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
- { role: "multipath", when: multipath == True }
- { role: "enable-nested-virt", when: nested_virt == True }
- { role: "enable-ksm", when: kernel_same_page_merging == True }
- { role: "secure-live-migration", when: autoreg == "on" and live_migration == True }
- { role: "customize-ceilometer", when: ceilometer == "on" and ceilometer_customize == True }
# Openstack Image Nodes
- hosts: glance
become: true
roles:
- { role: "glance-host", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-glance-role", when: autoreg == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
# Openstack Block Storage Nodes
- hosts: cinder
become: true
roles:
- { role: "lvm", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-cindervolume-base", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-cindervolume-lvm", when: autoreg == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
# Openstack Designate Nodes
- hosts: designate
become: true
roles:
- { role: "map-role", rolename: "pf9-designate", when: autoreg == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
# Kubernetes Master Nodes
- hosts: k8s_master
become: true
roles:
- common
- ntp
- disable-swap
- pf9-hostagent
- { role: "wait-for-convergence", flags: "k8s", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-kube", when: autoreg == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
- { role: "k8s-cluster-attach", k8s_node_type: "master", when: autoreg == "on" }
# Kubernetes Worker Nodes
- hosts: k8s_worker
become: true
roles:
- common
- ntp
- disable-swap
- pf9-hostagent
- { role: "wait-for-convergence", flags: "k8s", when: autoreg == "on" }
- { role: "map-role", rolename: "pf9-kube", when: autoreg == "on" }
- { role: "wait-for-convergence", when: autoreg == "on" }
- { role: "k8s-cluster-attach", k8s_node_type: "worker", when: autoreg == "on" }
# Run post_hook
- hosts:
- hypervisors
- k8s_master
- k8s_worker
become: true
roles:
- post-hook