mirror of https://github.com/ceph/ceph-ansible.git
257 lines
6.3 KiB
YAML
257 lines
6.3 KiB
YAML
---
|
|
- include: ./checks/check_system.yml
|
|
|
|
- include: ./checks/check_mandatory_vars.yml
|
|
|
|
- include: ./checks/check_firewall.yml
|
|
|
|
- include: ./misc/system_tuning.yml
|
|
when: osd_group_name in group_names
|
|
|
|
- include: ./pre_requisites/prerequisite_ice.yml
|
|
when: ceph_stable_ice
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./pre_requisites/prerequisite_rh_storage_iso_install.yml
|
|
when:
|
|
ceph_stable_rh_storage and
|
|
ceph_stable_rh_storage_iso_install and
|
|
ansible_os_family == "RedHat"
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./pre_requisites/prerequisite_rh_storage_cdn_install.yml
|
|
when:
|
|
ceph_stable_rh_storage and
|
|
ceph_stable_rh_storage_cdn_install and
|
|
ansible_os_family == "RedHat"
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./installs/install_on_redhat.yml
|
|
when: ansible_os_family == 'RedHat'
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./installs/install_on_debian.yml
|
|
when:
|
|
ansible_os_family == 'Debian' and
|
|
not ceph_stable_rh_storage
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./installs/install_rh_storage_on_debian.yml
|
|
when:
|
|
ansible_os_family == 'Debian' and
|
|
ceph_stable_rh_storage
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./installs/install_rgw_on_redhat.yml
|
|
when:
|
|
ansible_os_family == 'RedHat' and
|
|
radosgw_frontend == 'apache' and
|
|
rgw_group_name in group_names
|
|
tags:
|
|
- package-install
|
|
|
|
- include: ./installs/install_rgw_on_debian.yml
|
|
when:
|
|
ansible_os_family == 'Debian' and
|
|
radosgw_frontend == 'apache' and
|
|
rgw_group_name in group_names
|
|
tags:
|
|
- package-install
|
|
|
|
- name: get ceph version
|
|
command: ceph --version
|
|
changed_when: false
|
|
register: ceph_version
|
|
|
|
- set_fact:
|
|
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
|
|
|
|
# NOTE (leseb/jsaintrocc): Your supposed to qoute variables
|
|
# that follow colons to avoid confusion with dicts but this
|
|
# causes issues with the boolean, so we keep this syntax styling...
|
|
- set_fact:
|
|
is_ceph_infernalis={{ ceph_version | version_compare('9.2.0', '>=') }}
|
|
|
|
- set_fact:
|
|
dir_owner: ceph
|
|
dir_group: ceph
|
|
dir_mode: "0755"
|
|
when: is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
dir_owner: root
|
|
dir_group: root
|
|
dir_mode: "0755"
|
|
when: not is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
key_owner: root
|
|
key_group: root
|
|
key_mode: "0600"
|
|
when: not is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
key_owner: ceph
|
|
key_group: ceph
|
|
key_mode: "0600"
|
|
when: is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
activate_file_owner: ceph
|
|
activate_file_group: ceph
|
|
activate_file_mode: "0644"
|
|
when: is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
activate_file_owner: root
|
|
activate_file_group: root
|
|
activate_file_mode: "0644"
|
|
when: not is_ceph_infernalis
|
|
|
|
- set_fact:
|
|
rbd_client_directory_owner: root
|
|
when:
|
|
not is_ceph_infernalis and
|
|
(rbd_client_directory_owner is not defined or
|
|
not rbd_client_directory_owner)
|
|
|
|
- set_fact:
|
|
rbd_client_directory_owner: ceph
|
|
when:
|
|
is_ceph_infernalis and
|
|
(rbd_client_directory_owner is not defined or
|
|
not rbd_client_directory_owner)
|
|
|
|
- set_fact:
|
|
rbd_client_directory_group: root
|
|
when:
|
|
not is_ceph_infernalis and
|
|
(rbd_client_directory_group is not defined or
|
|
not rbd_client_directory_group)
|
|
|
|
- set_fact:
|
|
rbd_client_directory_group: ceph
|
|
when:
|
|
is_ceph_infernalis and
|
|
(rbd_client_directory_group is not defined or
|
|
not rbd_client_directory_group)
|
|
|
|
- set_fact:
|
|
rbd_client_directory_mode: "1777"
|
|
when:
|
|
not is_ceph_infernalis and
|
|
(rbd_client_directory_mode is not defined or
|
|
not rbd_client_directory_mode)
|
|
|
|
- set_fact:
|
|
rbd_client_directory_mode: "0770"
|
|
when:
|
|
is_ceph_infernalis and
|
|
(rbd_client_directory_mode is not defined or
|
|
not rbd_client_directory_mode)
|
|
|
|
- name: check for a ceph socket
|
|
shell: "stat /var/run/ceph/*.asok > /dev/null 2>&1"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: socket
|
|
|
|
- name: check for a rados gateway socket
|
|
shell: "stat {{ rbd_client_admin_socket_path }}*.asok > /dev/null 2>&1"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: socketrgw
|
|
|
|
- name: create a local fetch directory if it does not exist
|
|
local_action: file path={{ fetch_directory }} state=directory
|
|
changed_when: false
|
|
become: false
|
|
run_once: true
|
|
when:
|
|
cephx or
|
|
generate_fsid
|
|
|
|
- name: generate cluster uuid
|
|
local_action: shell python -c 'import uuid; print str(uuid.uuid4())' | tee {{ fetch_directory }}/ceph_cluster_uuid.conf
|
|
creates="{{ fetch_directory }}/ceph_cluster_uuid.conf"
|
|
register: cluster_uuid
|
|
become: false
|
|
when: generate_fsid
|
|
|
|
- name: read cluster uuid if it already exists
|
|
local_action: command cat {{ fetch_directory }}/ceph_cluster_uuid.conf
|
|
removes="{{ fetch_directory }}/ceph_cluster_uuid.conf"
|
|
changed_when: false
|
|
register: cluster_uuid
|
|
become: false
|
|
when: generate_fsid
|
|
|
|
- name: create ceph conf directory
|
|
file:
|
|
path: /etc/ceph
|
|
state: directory
|
|
owner: "{{ dir_owner }}"
|
|
group: "{{ dir_group }}"
|
|
mode: "{{ dir_mode }}"
|
|
|
|
- name: generate ceph configuration file
|
|
action: config_template
|
|
args:
|
|
src: ceph.conf.j2
|
|
dest: /etc/ceph/{{ cluster }}.conf
|
|
owner: "{{ dir_owner }}"
|
|
group: "{{ dir_group }}"
|
|
mode: "{{ activate_file_mode }}"
|
|
config_overrides: "{{ ceph_conf_overrides }}"
|
|
config_type: ini
|
|
notify:
|
|
- restart ceph mons
|
|
- restart ceph mons on ubuntu
|
|
- restart ceph mons with systemd
|
|
- restart ceph osds
|
|
- restart ceph osds on ubuntu
|
|
- restart ceph osds with systemd
|
|
- restart ceph mdss
|
|
- restart ceph mdss on ubuntu
|
|
- restart ceph mdss with systemd
|
|
- restart ceph rgws
|
|
- restart ceph rgws on ubuntu
|
|
- restart ceph rgws on red hat
|
|
- restart ceph rgws with systemd
|
|
|
|
- name: create rbd client directory
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ rbd_client_directory_owner }}"
|
|
group: "{{ rbd_client_directory_group }}"
|
|
mode: "{{ rbd_client_directory_mode }}"
|
|
with_items:
|
|
- "{{ rbd_client_admin_socket_path }}"
|
|
- "{{ rbd_client_log_path }}"
|
|
when: rbd_client_directories
|
|
|
|
- name: configure cluster name
|
|
lineinfile:
|
|
dest: /etc/sysconfig/ceph
|
|
insertafter: EOF
|
|
create: yes
|
|
line: "CLUSTER={{ cluster }}"
|
|
when:
|
|
ansible_os_family == "RedHat"
|
|
|
|
- name: configure cluster name
|
|
lineinfile:
|
|
dest: /etc/default/ceph/ceph
|
|
insertafter: EOF
|
|
create: yes
|
|
line: "CLUSTER={{ cluster }}"
|
|
when:
|
|
ansible_os_family == "Debian"
|