mirror of https://github.com/ceph/ceph-ansible.git
ceph-config: make rgw config to be in file
Signed-off-by: Seena Fallah <seenafallah@gmail.com>pull/7481/head
parent
a7b08fa146
commit
3f137f3b22
|
@ -97,26 +97,69 @@
|
||||||
- name: Set osd related config facts
|
- name: Set osd related config facts
|
||||||
when: inventory_hostname in groups.get(osd_group_name, [])
|
when: inventory_hostname in groups.get(osd_group_name, [])
|
||||||
block:
|
block:
|
||||||
- name: set_fact _osd_memory_target
|
- name: Set_fact _osd_memory_target
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
_osd_memory_target: "{{ ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) | int }}"
|
_osd_memory_target: "{{ ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) | int }}"
|
||||||
when:
|
when:
|
||||||
- _osd_memory_target is undefined
|
- _osd_memory_target is undefined
|
||||||
- num_osds | default(0) | int > 0
|
- num_osds | default(0) | int > 0
|
||||||
- ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) > (osd_memory_target | float)
|
- ((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
|
- name: Set osd_memory_target to cluster host config
|
||||||
ceph_config:
|
ceph_config:
|
||||||
action: set
|
action: set
|
||||||
who: "osd.*/{{ ansible_hostname }}:host"
|
who: "osd.*/{{ ansible_facts['hostname'] }}:host"
|
||||||
option: "osd_memory_target"
|
option: "osd_memory_target"
|
||||||
value: "{{ _osd_memory_target }}"
|
value: "{{ _osd_memory_target }}"
|
||||||
when:
|
when:
|
||||||
- _osd_memory_target is defined
|
- _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: create ceph conf directory
|
- name: Set rgw configs
|
||||||
file:
|
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
|
||||||
|
ansible.builtin.file:
|
||||||
path: "/etc/ceph"
|
path: "/etc/ceph"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "ceph"
|
owner: "ceph"
|
||||||
|
|
|
@ -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
|
- name: Create rados gateway directories
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
||||||
|
|
|
@ -182,11 +182,7 @@
|
||||||
ansible.builtin.import_role:
|
ansible.builtin.import_role:
|
||||||
name: ceph-defaults
|
name: ceph-defaults
|
||||||
|
|
||||||
- name: Import config role
|
- name: Set cluster configs
|
||||||
ansible.builtin.import_role:
|
|
||||||
name: ceph-config
|
|
||||||
|
|
||||||
- name: Set clsuter configs
|
|
||||||
ceph_config:
|
ceph_config:
|
||||||
action: set
|
action: set
|
||||||
who: "{{ item.0.key }}"
|
who: "{{ item.0.key }}"
|
||||||
|
|
|
@ -174,11 +174,7 @@
|
||||||
ansible.builtin.import_role:
|
ansible.builtin.import_role:
|
||||||
name: ceph-defaults
|
name: ceph-defaults
|
||||||
|
|
||||||
- name: Import config role
|
- name: Set cluster configs
|
||||||
ansible.builtin.import_role:
|
|
||||||
name: ceph-config
|
|
||||||
|
|
||||||
- name: Set clsuter configs
|
|
||||||
ceph_config:
|
ceph_config:
|
||||||
action: set
|
action: set
|
||||||
who: "{{ item.0.key }}"
|
who: "{{ item.0.key }}"
|
||||||
|
|
Loading…
Reference in New Issue