ceph-ansible/site.yml.sample

424 lines
11 KiB
Plaintext
Raw Normal View History

---
# Defines deployment design and assigns role to server groups
- hosts:
- mons
- agents
- osds
- mdss
- rgws
- nfss
- restapis
- rbdmirrors
- clients
- mgrs
- iscsigws
- iscsi-gws # for backward compatibility only!
gather_facts: false
any_errors_fatal: true
become: true
tags:
- always
vars:
delegate_facts_host: True
pre_tasks:
# If we can't get python2 installed before any module is used we will fail
# so just try what we can to get it installed
- name: check for python2
stat:
path: /usr/bin/python
ignore_errors: yes
register: systempython2
- name: install python2 for debian based systems
raw: sudo apt-get -y install python-simplejson
ignore_errors: yes
when:
site.yml.sample: fix install python2 Check `systempython2.stat` instead of `systempython2.stat.exists`. Without this change, in the case that python2 is not installed, the `stat` task fails without defining `systempython2.stat`. It leads that the next installation tasks fail because of undefined `systempython2.stat`. An example error output (edited for readability): ``` TASK [check for python2] *********************************************** Wednesday 25 July 2018 14:52:47 +0900 (0:00:00.182) 0:00:00.182 * fatal: [ceph-osd1.vlan221.vtj]: FAILED! => { "changed": false, "module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 127} ...ignoring TASK [install python2 for debian based systems] ************************ Wednesday 25 July 2018 14:51:00 +0900 (0:00:01.742) 0:00:01.926 * fatal: [ceph-mon2]: FAILED! => { "msg": "The conditional check 'systempython2.stat.exists is undefined or systempython2.stat.exists == false' failed. The error was: error while evaluating conditional (systempython2.stat.exists is undefined or systempython2.stat.exists == false): 'dict object' has no attribute 'stat' \n\n The error appears to have been in '/Users/arata/git/ceph-ansible/site.yml.sample': line 36, column 7, but may\n be elsewhere in the file depending on the exact syntax problem.\n\n The offending line appears to be:\n\n\n - name: install python2 for debian based systems\n ^ here\n "} ...ignoring ``` Fixes: #2930 Signed-off-by: Arata Notsu <arata776@gmail.com>
2018-07-25 14:17:33 +08:00
- systempython2.stat is undefined or systempython2.stat.exists == false
- name: install python2 for fedora
raw: sudo dnf -y install python creates=/usr/bin/python
ignore_errors: yes
when:
site.yml.sample: fix install python2 Check `systempython2.stat` instead of `systempython2.stat.exists`. Without this change, in the case that python2 is not installed, the `stat` task fails without defining `systempython2.stat`. It leads that the next installation tasks fail because of undefined `systempython2.stat`. An example error output (edited for readability): ``` TASK [check for python2] *********************************************** Wednesday 25 July 2018 14:52:47 +0900 (0:00:00.182) 0:00:00.182 * fatal: [ceph-osd1.vlan221.vtj]: FAILED! => { "changed": false, "module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 127} ...ignoring TASK [install python2 for debian based systems] ************************ Wednesday 25 July 2018 14:51:00 +0900 (0:00:01.742) 0:00:01.926 * fatal: [ceph-mon2]: FAILED! => { "msg": "The conditional check 'systempython2.stat.exists is undefined or systempython2.stat.exists == false' failed. The error was: error while evaluating conditional (systempython2.stat.exists is undefined or systempython2.stat.exists == false): 'dict object' has no attribute 'stat' \n\n The error appears to have been in '/Users/arata/git/ceph-ansible/site.yml.sample': line 36, column 7, but may\n be elsewhere in the file depending on the exact syntax problem.\n\n The offending line appears to be:\n\n\n - name: install python2 for debian based systems\n ^ here\n "} ...ignoring ``` Fixes: #2930 Signed-off-by: Arata Notsu <arata776@gmail.com>
2018-07-25 14:17:33 +08:00
- systempython2.stat is undefined or systempython2.stat.exists == false
- name: install python2 for opensuse
raw: sudo zypper -n install python-base creates=/usr/bin/python2.7
ignore_errors: yes
when:
site.yml.sample: fix install python2 Check `systempython2.stat` instead of `systempython2.stat.exists`. Without this change, in the case that python2 is not installed, the `stat` task fails without defining `systempython2.stat`. It leads that the next installation tasks fail because of undefined `systempython2.stat`. An example error output (edited for readability): ``` TASK [check for python2] *********************************************** Wednesday 25 July 2018 14:52:47 +0900 (0:00:00.182) 0:00:00.182 * fatal: [ceph-osd1.vlan221.vtj]: FAILED! => { "changed": false, "module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 127} ...ignoring TASK [install python2 for debian based systems] ************************ Wednesday 25 July 2018 14:51:00 +0900 (0:00:01.742) 0:00:01.926 * fatal: [ceph-mon2]: FAILED! => { "msg": "The conditional check 'systempython2.stat.exists is undefined or systempython2.stat.exists == false' failed. The error was: error while evaluating conditional (systempython2.stat.exists is undefined or systempython2.stat.exists == false): 'dict object' has no attribute 'stat' \n\n The error appears to have been in '/Users/arata/git/ceph-ansible/site.yml.sample': line 36, column 7, but may\n be elsewhere in the file depending on the exact syntax problem.\n\n The offending line appears to be:\n\n\n - name: install python2 for debian based systems\n ^ here\n "} ...ignoring ``` Fixes: #2930 Signed-off-by: Arata Notsu <arata776@gmail.com>
2018-07-25 14:17:33 +08:00
- systempython2.stat is undefined or systempython2.stat.exists == false
- name: gather facts
setup:
when:
- not delegate_facts_host | bool
- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: True
with_items: "{{ groups['all'] }}"
run_once: true
when:
- delegate_facts_host | bool
- name: install required packages for fedora > 23
raw: sudo dnf -y install python2-dnf libselinux-python ntp
when:
- ansible_distribution == 'Fedora'
- ansible_distribution_major_version|int >= 23
roles:
- ceph-defaults
- ceph-validate
- ceph-infra
- hosts: mons
gather_facts: false
become: True
pre_tasks:
- name: set ceph monitor install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mon:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-mon
post_tasks:
- name: set ceph monitor install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mon:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mgrs
gather_facts: false
become: True
pre_tasks:
- name: set ceph manager install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mgr:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
- role: ceph-mgr
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
post_tasks:
- name: set ceph manager install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mgr:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: agents
gather_facts: false
become: True
pre_tasks:
- name: set ceph agent install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_agent:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-agent
post_tasks:
- name: set ceph agent install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_agent:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: osds
gather_facts: false
become: True
pre_tasks:
- name: set ceph osd install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_osd:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-osd
post_tasks:
- name: set ceph osd install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_osd:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mdss
gather_facts: false
become: True
pre_tasks:
- name: set ceph mds install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mds:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-mds
post_tasks:
- name: set ceph mds install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mds:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: rgws
gather_facts: false
become: True
pre_tasks:
- name: set ceph rgw install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_rgw:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-rgw
post_tasks:
- name: set ceph rgw install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_rgw:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: nfss
gather_facts: false
become: True
pre_tasks:
- name: set ceph nfs install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_nfs:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
- role: ceph-nfs
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
post_tasks:
- name: set ceph nfs install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_nfs:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: restapis
gather_facts: false
become: True
pre_tasks:
- name: set ceph rest api install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_restapi:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
when:
- ceph_release_num[ceph_release] <= ceph_release_num.luminous
- role: ceph-restapi
when:
- ceph_release_num[ceph_release] <= ceph_release_num.luminous
post_tasks:
- name: set ceph rest api install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_restapi:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: rbdmirrors
gather_facts: false
become: True
pre_tasks:
- name: set ceph rbd mirror install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_rbdmirror:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-rbd-mirror
post_tasks:
- name: set ceph rbd mirror install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_rbdmirror:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: clients
gather_facts: false
become: True
pre_tasks:
- name: set ceph client install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_client:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
- role: ceph-client
post_tasks:
- name: set ceph client install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_client:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts:
- iscsigws
- iscsi-gws # for backward compatibility only!
gather_facts: false
become: True
pre_tasks:
- name: set ceph iscsi gateway install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_iscsi_gw:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
tags: ['ceph_update_config']
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
- role: ceph-iscsi-gw
when:
- ceph_release_num[ceph_release] >= ceph_release_num.luminous
post_tasks:
- name: set ceph iscsi gw install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_iscsi_gw:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mons
gather_facts: false
become: True
tasks:
- name: get ceph status from the first monitor
command: ceph --cluster {{ cluster | default ('ceph') }} -s
register: ceph_status
changed_when: false
delegate_to: "{{ groups['mons'][0] }}"
run_once: true
ignore_errors: true # we skip the error if mon_group_name is different than 'mons'
- name: "show ceph status for cluster {{ cluster | default ('ceph') }}"
debug:
msg: "{{ ceph_status.stdout_lines }}"
delegate_to: "{{ groups['mons'][0] }}"
run_once: true
when: not ceph_status.failed