]>
Commit | Line | Data |
---|---|---|
1adf2230 AA |
1 | --- |
2 | # Defines deployment design and assigns role to server groups | |
3 | ||
4 | - hosts: | |
5 | - mons | |
6 | - osds | |
7 | - mgrs | |
8 | ||
9 | gather_facts: false | |
10 | any_errors_fatal: true | |
11 | become: true | |
12 | ||
13 | tags: | |
14 | - always | |
15 | ||
16 | vars: | |
17 | delegate_facts_host: True | |
494da23a | 18 | dashboard_enabled: False |
1adf2230 | 19 | |
eafe8130 TL |
20 | environment: |
21 | DEBIAN_FRONTEND: noninteractive | |
22 | ||
1adf2230 AA |
23 | pre_tasks: |
24 | # If we can't get python2 installed before any module is used we will fail | |
25 | # so just try what we can to get it installed | |
26 | - name: check for python2 | |
27 | stat: | |
28 | path: /usr/bin/python | |
29 | ignore_errors: yes | |
30 | register: systempython2 | |
31 | ||
32 | - name: install python2 for debian based systems | |
33 | raw: sudo apt-get -y install python-simplejson | |
34 | ignore_errors: yes | |
35 | when: | |
36 | - systempython2.stat is undefined or systempython2.stat.exists == false | |
37 | ||
eafe8130 TL |
38 | # Ansible will try to auto-install python-apt, in some systems this might be |
39 | # python3-apt, or python-apt, and it has caused whole runs to fail because | |
40 | # it is trying to do an interactive prompt | |
41 | - name: install python-apt and aptitude in debian based systems | |
42 | raw: sudo apt-get -y install "{{ item }}" | |
43 | ignore_errors: yes | |
44 | with_items: | |
45 | - python3-apt | |
46 | - python-apt | |
47 | - aptitude | |
48 | ||
1adf2230 AA |
49 | - name: install python2 for fedora |
50 | raw: sudo dnf -y install python creates=/usr/bin/python | |
51 | ignore_errors: yes | |
52 | when: | |
53 | - systempython2.stat is undefined or systempython2.stat.exists == false | |
54 | ||
55 | - name: install python2 for opensuse | |
56 | raw: sudo zypper -n install python-base creates=/usr/bin/python2.7 | |
57 | ignore_errors: yes | |
58 | when: | |
59 | - systempython2.stat is undefined or systempython2.stat.exists == false | |
60 | ||
61 | - name: gather facts | |
62 | setup: | |
63 | when: | |
64 | - not delegate_facts_host | bool | |
65 | ||
66 | - name: gather and delegate facts | |
67 | setup: | |
68 | delegate_to: "{{ item }}" | |
69 | delegate_facts: True | |
70 | with_items: "{{ groups['all'] }}" | |
71 | run_once: true | |
72 | when: | |
73 | - delegate_facts_host | bool | |
74 | ||
75 | - name: install required packages for fedora > 23 | |
76 | raw: sudo dnf -y install python2-dnf libselinux-python ntp | |
77 | when: | |
522d829b TL |
78 | - ansible_facts['distribution'] == 'Fedora' |
79 | - ansible_facts['distribution_major_version']|int >= 23 | |
1adf2230 | 80 | |
11fdf7f2 TL |
81 | - name: check if it is atomic host |
82 | stat: | |
83 | path: /run/ostree-booted | |
84 | register: stat_ostree | |
85 | ||
86 | - name: set_fact is_atomic | |
87 | set_fact: | |
88 | is_atomic: '{{ stat_ostree.stat.exists }}' | |
89 | ||
1e59de90 TL |
90 | - name: force rpm pkg upgrade |
91 | package: | |
92 | name: rpm | |
93 | state: latest | |
94 | when: not is_atomic | bool | |
95 | ||
96 | - name: update the system | |
97 | command: dnf update -y | |
98 | changed_when: false | |
99 | when: not is_atomic | bool | |
100 | ||
11fdf7f2 TL |
101 | tasks: |
102 | - import_role: | |
103 | name: ceph-defaults | |
1911f103 TL |
104 | - import_role: |
105 | name: ceph-facts | |
11fdf7f2 TL |
106 | - import_role: |
107 | name: ceph-validate | |
1adf2230 AA |
108 | |
109 | - hosts: | |
110 | - mons | |
111 | - osds | |
112 | - mgrs | |
113 | gather_facts: false | |
114 | become: True | |
91327a77 | 115 | any_errors_fatal: true |
494da23a TL |
116 | vars: |
117 | dashboard_enabled: False | |
1adf2230 | 118 | tasks: |
11fdf7f2 TL |
119 | - import_role: |
120 | name: ceph-defaults | |
121 | - import_role: | |
122 | name: ceph-facts | |
123 | - import_role: | |
124 | name: ceph-handler | |
125 | - import_role: | |
126 | name: ceph-common | |
127 | ||
1adf2230 AA |
128 | - name: rsync ceph-volume to test nodes on centos |
129 | synchronize: | |
11fdf7f2 | 130 | src: "{{ toxinidir }}/../../../../ceph_volume" |
9f95a23c | 131 | dest: "/usr/lib/python3.6/site-packages" |
1adf2230 | 132 | use_ssh_args: true |
91327a77 | 133 | when: |
522d829b | 134 | - ansible_facts['os_family'] == "RedHat" |
91327a77 | 135 | - inventory_hostname in groups.get(osd_group_name, []) |
1adf2230 AA |
136 | |
137 | - name: rsync ceph-volume to test nodes on ubuntu | |
138 | synchronize: | |
11fdf7f2 | 139 | src: "{{ toxinidir }}/../../../../ceph_volume" |
1adf2230 AA |
140 | dest: "/usr/lib/python2.7/dist-packages" |
141 | use_ssh_args: true | |
91327a77 | 142 | when: |
522d829b | 143 | - ansible_facts['os_family'] == "Debian" |
91327a77 | 144 | - inventory_hostname in groups.get(osd_group_name, []) |
1adf2230 | 145 | |
91327a77 AA |
146 | - name: run ceph-config role |
147 | import_role: | |
148 | name: ceph-config | |
149 | ||
150 | - name: run ceph-mon role | |
151 | import_role: | |
152 | name: ceph-mon | |
153 | when: | |
154 | - inventory_hostname in groups.get(mon_group_name, []) | |
155 | ||
156 | - name: run ceph-mgr role | |
157 | import_role: | |
158 | name: ceph-mgr | |
159 | when: | |
160 | - inventory_hostname in groups.get(mgr_group_name, []) | |
161 | ||
162 | - name: run ceph-osd role | |
163 | import_role: | |
164 | name: ceph-osd | |
165 | when: | |
166 | - inventory_hostname in groups.get(osd_group_name, []) |