Initial commit
[ta/infra-ansible.git] / playbooks / site.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Defines deployment design and assigns role to server groups
18
19 - hosts:
20   - mons
21 #  - agents
22   - osds
23 #  - mdss
24 #  - rgws
25 #  - nfss
26 #  - restapis
27 #  - rbdmirrors
28 #  - clients
29   - mgrs
30 #  - iscsi-gws
31
32   gather_facts: false
33
34   tags:
35     - always
36
37   tasks:
38     # If we can't get python2 installed before any module is used we will fail
39     # so just try what we can to get it installed
40     - name: check for python2
41       stat:
42         path: /usr/bin/python
43       ignore_errors: yes
44       register: systempython2
45
46     - name: install python2 for debian based systems
47       raw: sudo apt-get -y install python-simplejson
48       ignore_errors: yes
49       when:
50         - systempython2.stat.exists is undefined or systempython2.stat.exists == false
51
52     - name: install python2 for fedora
53       raw: sudo dnf -y install python creates=/usr/bin/python
54       ignore_errors: yes
55       when:
56         - systempython2.stat.exists is undefined or systempython2.stat.exists == false
57
58     - name: gather and delegate facts
59       setup:
60       delegate_to: "{{ item }}"
61       delegate_facts: True
62       with_items: "{{ groups['all'] }}"
63
64     - name: install required packages for fedora > 23
65       raw: sudo dnf -y install python2-dnf libselinux-python ntp
66       when:
67         - ansible_distribution == 'Fedora'
68         - ansible_distribution_major_version|int >= 23
69
70 - hosts: mons
71   gather_facts: false
72   become: True
73   roles:
74     - ceph-defaults
75     - ceph-common
76     - ceph-config
77     - ceph-mon
78
79 - hosts: mgrs
80   gather_facts: false
81   become: True
82   roles:
83     - ceph-defaults
84     - ceph-common
85     - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
86     - { role: ceph-mgr, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
87
88 - hosts: agents
89   gather_facts: false
90   become: True
91   roles:
92     - ceph-defaults
93     - ceph-common
94     - ceph-config
95     - ceph-agent
96
97 - hosts: osds
98   gather_facts: false
99   become: True
100   roles:
101     - ceph-defaults
102     - ceph-common
103     - ceph-config
104     - ceph-osd
105
106 - hosts: mdss
107   gather_facts: false
108   become: True
109   roles:
110     - ceph-defaults
111     - ceph-common
112     - ceph-config
113     - ceph-mds
114
115 - hosts: rgws
116   gather_facts: false
117   become: True
118   roles:
119     - ceph-defaults
120     - ceph-common
121     - ceph-config
122     - ceph-rgw
123
124 - hosts: nfss
125   gather_facts: false
126   become: True
127   roles:
128     - ceph-defaults
129     - ceph-common
130     - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
131     - { role: ceph-nfs, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
132
133 - hosts: restapis
134   gather_facts: false
135   become: True
136   roles:
137     - ceph-defaults
138     - ceph-common
139     - ceph-config
140     - ceph-restapi
141
142 - hosts: rbdmirrors
143   gather_facts: false
144   become: True
145   roles:
146     - ceph-defaults
147     - ceph-common
148     - ceph-config
149     - ceph-rbd-mirror
150
151 - hosts: clients
152   gather_facts: false
153   become: True
154   roles:
155     - ceph-defaults
156     - ceph-common
157     - ceph-config
158     - ceph-client
159
160 - hosts: iscsi-gws
161   gather_facts: false
162   become: True
163   roles:
164     - ceph-defaults
165     - ceph-common
166     - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
167     - { role: ceph-iscsi-gw, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
168