]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-config: make rgw config to be in file
authorSeena Fallah <seenafallah@gmail.com>
Wed, 14 Feb 2024 20:47:35 +0000 (21:47 +0100)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 7 Mar 2024 20:03:33 +0000 (21:03 +0100)
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
roles/ceph-config/tasks/main.yml
roles/ceph-rgw/tasks/pre_requisite.yml
site-container.yml.sample
site.yml.sample

index 54528cfc55b602af14624ca71a8ae838fac10d46..e7fbf8e0b04304ea28e986046d2442707c3227b4 100644 (file)
 - name: Set osd related config facts
   when: inventory_hostname in groups.get(osd_group_name, [])
   block:
-    - name: set_fact _osd_memory_target
-      set_fact:
+    - name: Set_fact _osd_memory_target
+      ansible.builtin.set_fact:
         _osd_memory_target: "{{ ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) | int }}"
       when:
         - _osd_memory_target is undefined
         - num_osds | default(0) | int > 0
         - ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) > (osd_memory_target | float)
+        - ceph_conf_overrides.get('osd', {}).get('osd_memory_target', '') == ''
 
     - name: Set osd_memory_target to cluster host config
       ceph_config:
         action: set
-        who: "osd.*/{{ ansible_hostname }}:host"
+        who: "osd.*/{{ ansible_facts['hostname'] }}:host"
         option: "osd_memory_target"
         value: "{{ _osd_memory_target }}"
       when:
         - _osd_memory_target is defined
-        - ceph_conf_overrides.get('osd', {}).get('osd_memory_target', '') == ''
+        - running_mon is defined
+      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 }}"
+      delegate_to: "{{ running_mon }}"
+
+- name: Set rgw configs
+  when: inventory_hostname in groups.get(rgw_group_name, [])
+  block:
+    - name: Render rgw configs
+      vars:
+        _rgw_binding_socket: "{{ item.radosgw_address | default(_radosgw_address) | string + ':' + item.radosgw_frontend_port | default(radosgw_frontend_port) | string }}"
+        _rgw_beast_endpoint: "{{ 'ssl_' if radosgw_frontend_ssl_certificate else '' }}endpoint={{ _rgw_binding_socket }}"
+        _rgw_beast_ssl_option: "{{ ' ssl_certificate=' + radosgw_frontend_ssl_certificate if radosgw_frontend_ssl_certificate else '' }}"
+      ansible.builtin.set_fact:
+        _ceph_ansible_rgw_conf: >-
+          {{ _ceph_ansible_rgw_conf | default({}) | combine({
+              'client.rgw.' + ansible_facts['hostname'] + '.' + item.instance_name: {
+                'log_file': '/var/log/ceph/' + cluster + '-rgw-' + ansible_facts['hostname'] + '.' + item.instance_name + '.log',
+                'rgw_frontends': 'beast ' + _rgw_beast_endpoint + _rgw_beast_ssl_option,
+              }
+          }, recursive=true) }}
+      loop: "{{ rgw_instances }}"
+
+    - name: Set config to cluster
+      ceph_config:
+        action: set
+        who: "{{ item.0.key }}"
+        option: "{{ item.1.key }}"
+        value: "{{ item.1.value }}"
+      loop: "{{ _ceph_ansible_rgw_conf | dict2dict }}"
+      when:
+        - rgw_conf_to_cluster | default(true) | bool
+        - running_mon is defined
+      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 }}"
+      delegate_to: "{{ running_mon }}"
+
+    - name: Set rgw configs to file
+      ansible.builtin.set_fact:
+        ceph_conf_overrides: "{{ ceph_conf_overrides | default({}) | combine(_ceph_ansible_rgw_conf, recursive=true) }}"
+      when: not rgw_conf_to_cluster | default(true) | bool
 
-- name: create ceph conf directory
-  file:
+- name: Create ceph conf directory
+  ansible.builtin.file:
     path: "/etc/ceph"
     state: directory
     owner: "ceph"
index 9d307484993c1490627bf81d08f01d77dd6a2c84..a31b88dfb244ab2c07996acb75214fb6d8355e46 100644 (file)
@@ -1,37 +1,4 @@
 ---
-- name: Set_fact _rgw_hostname
-  ansible.builtin.set_fact:
-    _rgw_hostname: "{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] }}"
-
-- name: Set rgw parameter (log file)
-  ceph_config:
-    action: set
-    who: "client.rgw.{{ _rgw_hostname + '.' + item.instance_name }}"
-    option: "log file"
-    value: "/var/log/ceph/{{ cluster }}-rgw-{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] + '.' + item.instance_name }}.log"
-  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 }}"
-  delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
-  loop: "{{ hostvars[inventory_hostname]['rgw_instances'] }}"
-
-- name: Set rgw parameter (rgw_frontends)
-  vars:
-    _rgw_binding_socket: "{{ item.radosgw_address | default(_radosgw_address) | string + ':' + item.radosgw_frontend_port | default(radosgw_frontend_port) | string }}"
-    _rgw_beast_endpoint: "{{ 'ssl_' if radosgw_frontend_ssl_certificate else '' }}endpoint={{ _rgw_binding_socket }}"
-    _rgw_beast_ssl_option: "{{ ' ssl_certificate='+radosgw_frontend_ssl_certificate if radosgw_frontend_ssl_certificate else '' }}"
-  ceph_config:
-    action: set
-    who: "client.rgw.{{ _rgw_hostname + '.' + item.instance_name }}"
-    option: "rgw_frontends"
-    value: "beast {{ _rgw_beast_endpoint }}{{ _rgw_beast_ssl_option }}"
-  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 }}"
-  delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
-  loop: "{{ hostvars[inventory_hostname]['rgw_instances'] }}"
-  notify: Restart ceph rgws
-
 - name: Create rados gateway directories
   ansible.builtin.file:
     path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
index caf45645ecc391783e2cdc2d399ba4d7ca93e26a..3935f9b20dfc04b79edd310f92f8ec6658157522 100644 (file)
       ansible.builtin.import_role:
         name: ceph-defaults
 
-    - name: Import config role
-      ansible.builtin.import_role:
-        name: ceph-config
-
-    - name: Set clsuter configs
+    - name: Set cluster configs
       ceph_config:
         action: set
         who: "{{ item.0.key }}"
index 21107260014b9d46b59b18641d2a4c83d70910fa..e5bd9de61671127c086e6d41a4681613dac8cc77 100644 (file)
       ansible.builtin.import_role:
         name: ceph-defaults
 
-    - name: Import config role
-      ansible.builtin.import_role:
-        name: ceph-config
-
-    - name: Set clsuter configs
+    - name: Set cluster configs
       ceph_config:
         action: set
         who: "{{ item.0.key }}"