From b7b8aba47bcf92d5c972dea37677205fa5f7b4a4 Mon Sep 17 00:00:00 2001 From: Ha Phan Date: Tue, 5 Jun 2018 16:43:55 +0800 Subject: [PATCH] Generate a copy of ceph.conf locally Refers to #2697 This change creates a copy of `ceph.conf` in ansible server. Signed-off-by: Ha Phan --- group_vars/all.yml.sample | 2 ++ group_vars/rhcs.yml.sample | 2 ++ roles/ceph-config/tasks/main.yml | 24 ++++++++++++++++++++++++ roles/ceph-defaults/defaults/main.yml | 2 ++ 4 files changed, 30 insertions(+) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index f40cfcb06..77b119e9b 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -78,6 +78,8 @@ dummy: #ceph_rbdmirror_firewall_zone: public #ceph_iscsi_firewall_zone: public +# Generate local ceph.conf in fetch directory +#ceph_conf_local: false ############ # PACKAGES # diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 0d8518350..faa8b3272 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -78,6 +78,8 @@ fetch_directory: ~/ceph-ansible-keys #ceph_rbdmirror_firewall_zone: public #ceph_iscsi_firewall_zone: public +# Generate local ceph.conf in fetch directory +#ceph_conf_local: false ############ # PACKAGES # diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index 782a5d162..429a11bbe 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -26,6 +26,30 @@ - restart ceph rgws - restart ceph mgrs - restart ceph rbdmirrors + + - name: "ensure fetch directory exists" + run_once: true + become: false + local_action: + module: file + path: "{{ fetch_directory }}/{{ fsid }}/etc/ceph" + state: directory + mode: "0755" + when: + - ceph_conf_local + + - name: "generate {{ cluster }}.conf configuration file locally" + local_action: config_template + become: false + run_once: true + args: + src: "ceph.conf.j2" + dest: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.conf" + config_overrides: "{{ ceph_conf_overrides }}" + config_type: ini + when: + - inventory_hostname in groups[mon_group_name] + - ceph_conf_local when: - not containerized_deployment|bool diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index dba551e6f..3dee5c9a5 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -70,6 +70,8 @@ ceph_restapi_firewall_zone: public ceph_rbdmirror_firewall_zone: public ceph_iscsi_firewall_zone: public +# Generate local ceph.conf in fetch directory +ceph_conf_local: false ############ # PACKAGES #