ceph-ansible/roles/ceph-common/tasks/configure_cluster_name.yml

55 lines
1.7 KiB
YAML
Raw Normal View History

---
- name: configure cluster name
lineinfile:
dest: /etc/sysconfig/ceph
insertafter: EOF
create: yes
line: "CLUSTER={{ cluster }}"
regexp: "^CLUSTER="
when:
- ansible_os_family in ["RedHat", "Suse"]
# NOTE(leseb): we are performing the following check
# to ensure any Jewel installation will not fail.
# The following commit https://github.com/ceph/ceph/commit/791eba81a5467dd5de4f1680ed0deb647eb3fb8b
# fixed a package issue where the path was the wrong.
# This bug is not yet on all the distros package so we are working around it
# Impacted versions:
# - Jewel from UCA: https://bugs.launchpad.net/ubuntu/+source/ceph/+bug/1582773
# - Jewel from latest Canonical 16.04 distro
# - All previous versions from Canonical
# - Infernalis from ceph.com
- name: debian based systems - configure cluster name
when:
- ansible_os_family == "Debian"
block:
- name: check /etc/default/ceph exist
stat:
path: /etc/default/ceph
register: etc_default_ceph
check_mode: no
- name: configure cluster name
when:
- etc_default_ceph.stat.exists
block:
- name: when /etc/default/ceph is not dir
lineinfile:
dest: /etc/default/ceph
insertafter: EOF
create: yes
regexp: "^CLUSTER="
line: "CLUSTER={{ cluster }}"
when:
- not etc_default_ceph.stat.isdir
- name: when /etc/default/ceph is dir
lineinfile:
dest: /etc/default/ceph/ceph
insertafter: EOF
create: yes
regexp: "^CLUSTER="
line: "CLUSTER={{ cluster }}"
when:
- etc_default_ceph.stat.isdir