diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index c80e3345ca..4d51184137 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -103,6 +103,7 @@ - _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: @@ -110,9 +111,44 @@ who: "osd.*/{{ ansible_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', '') == '' + when: _osd_memory_target is defined + +- 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_hostname + '.' + item.instance_name: { + 'log_file': '/var/log/ceph/' + cluster + '-rgw-' + ansible_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 + 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] }}" + notify: restart ceph rgws + + - 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: diff --git a/roles/ceph-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index 42bc739971..2e2ddaf6c8 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -1,37 +1,4 @@ --- -- name: set_fact _rgw_hostname - 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 file: path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}" diff --git a/site-container.yml.sample b/site-container.yml.sample index ed7c1eac13..61646e9df9 100644 --- a/site-container.yml.sample +++ b/site-container.yml.sample @@ -183,10 +183,6 @@ ansible.builtin.import_role: name: ceph-defaults - - name: Import config role - ansible.builtin.import_role: - name: ceph-config - - name: Set clsuter configs ceph_config: action: set diff --git a/site.yml.sample b/site.yml.sample index 9ed5947695..cbc014ea63 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -175,10 +175,6 @@ ansible.builtin.import_role: name: ceph-defaults - - name: Import config role - ansible.builtin.import_role: - name: ceph-config - - name: Set clsuter configs ceph_config: action: set