]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-config: move `ceph_config` module call to ceph-config role
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 11 Apr 2024 12:39:18 +0000 (14:39 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 11 Apr 2024 14:16:16 +0000 (16:16 +0200)
so you don't have to implement a similar play on your own
if not using main (sample) playbooks.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
roles/ceph-config/tasks/main.yml
site-container.yml.sample
site.yml.sample

index acfee21d1abaa53f78cf0387b4a9d210addccb4f..1043189dd06528bb319698a676283ef6391816af 100644 (file)
       ansible.builtin.set_fact:
         num_osds: "{{ num_osds | int + (lvm_list.stdout | default('{}') | from_json | dict2items | map(attribute='value') | flatten | map(attribute='devices') | sum(start=[]) | difference(lvm_volumes | default([]) | map(attribute='data')) | length | int) }}"
 
+- name: Set cluster configs
+  ceph_config:
+    action: set
+    who: "{{ item.0.key }}"
+    option: "{{ item.1.key }}"
+    value: "{{ item.1.value }}"
+  run_once: true
+  delegate_to: "{{ running_mon }}"
+  when:
+    - item.1.value != omit
+    - running_mon is defined
+  loop: "{{ ceph_cluster_conf | dict2dict }}"
+  environment:
+    CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
+    CEPH_CONTAINER_BINARY: "{{ container_binary }}"
+
 - name: Set osd related config facts
   when: inventory_hostname in groups.get(osd_group_name, [])
   block:
index 0c8de0e0ab810f8f3d28ce13e004cae18737965d..9facb5a5fc969763d43f70c0de8b99c36d88a032 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: mons[0]
-  become: true
-  gather_facts: false
-  any_errors_fatal: true
-  tasks:
-    - name: Import default role
-      ansible.builtin.import_role:
-        name: ceph-defaults
-
-    - name: Set cluster configs
-      ceph_config:
-        action: set
-        who: "{{ item.0.key }}"
-        option: "{{ item.1.key }}"
-        value: "{{ item.1.value }}"
-      when: item.1.value != omit
-      loop: "{{ ceph_cluster_conf | dict2dict }}"
-      environment:
-        CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
-        CEPH_CONTAINER_BINARY: "{{ container_binary }}"
-
 - hosts: osds
   become: True
   gather_facts: false
index ef1234bc5245eb8e1c54c5e92fc3a6bb3de2294a..046eb64b7d7610a7d28d74177eb88003e00a9750 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
-- hosts: mons[0]
-  become: true
-  gather_facts: false
-  any_errors_fatal: true
-  tasks:
-    - name: Import default role
-      ansible.builtin.import_role:
-        name: ceph-defaults
-
-    - name: Set cluster configs
-      ceph_config:
-        action: set
-        who: "{{ item.0.key }}"
-        option: "{{ item.1.key }}"
-        value: "{{ item.1.value }}"
-      when: item.1.value != omit
-      loop: "{{ ceph_cluster_conf | dict2dict }}"
-
 - hosts: osds
   gather_facts: false
   become: True