deep_scrub_choked
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Ansible role: ceph-facts
|
||||
|
||||
Documentation is available at http://docs.ceph.com/ceph-ansible/.
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
galaxy_info:
|
||||
company: Red Hat
|
||||
author: Guillaume Abrioux
|
||||
description: Set some facts for ceph to be deployed
|
||||
license: Apache
|
||||
min_ansible_version: '2.7'
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
- name: EL
|
||||
versions:
|
||||
- 'all'
|
||||
galaxy_tags:
|
||||
- system
|
||||
dependencies: []
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Check if podman binary is present
|
||||
ansible.builtin.stat:
|
||||
path: /usr/bin/podman
|
||||
register: podman_binary
|
||||
|
||||
- name: Set_fact container_binary
|
||||
ansible.builtin.set_fact:
|
||||
container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] in ['8', '9']) else 'docker' }}"
|
||||
when: not docker2podman | default(false) | bool
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
- name: Resolve devices
|
||||
when:
|
||||
- devices is defined
|
||||
- not osd_auto_discovery | default(False) | bool
|
||||
block:
|
||||
- name: Resolve device link(s)
|
||||
ansible.builtin.command: readlink -f {{ item }}
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
with_items: "{{ devices }}"
|
||||
register: devices_prepare_canonicalize
|
||||
|
||||
- name: Set_fact build devices from resolved symlinks
|
||||
ansible.builtin.set_fact:
|
||||
devices: "{{ devices_prepare_canonicalize.results | map(attribute='stdout') | reject('search', '/dev/disk') | list | unique }}"
|
||||
|
||||
- name: Resolve dedicated_device
|
||||
when:
|
||||
- dedicated_devices is defined
|
||||
- not osd_auto_discovery | default(False) | bool
|
||||
block:
|
||||
- name: Resolve dedicated_device link(s)
|
||||
ansible.builtin.command: readlink -f {{ item }}
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
with_items: "{{ dedicated_devices }}"
|
||||
register: dedicated_devices_prepare_canonicalize
|
||||
|
||||
- name: Set_fact build dedicated_devices from resolved symlinks
|
||||
ansible.builtin.set_fact:
|
||||
dedicated_devices: "{{ dedicated_devices_prepare_canonicalize.results | map(attribute='stdout') | reject('search', '/dev/disk') | list | unique }}"
|
||||
|
||||
- name: Resolve bluestore_wal_device
|
||||
when:
|
||||
- bluestore_wal_devices is defined
|
||||
- not osd_auto_discovery | default(False) | bool
|
||||
block:
|
||||
- name: Resolve bluestore_wal_device link(s)
|
||||
ansible.builtin.command: readlink -f {{ item }}
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
with_items: "{{ bluestore_wal_devices }}"
|
||||
register: bluestore_wal_devices_prepare_canonicalize
|
||||
|
||||
- name: Set_fact build bluestore_wal_devices from resolved symlinks
|
||||
ansible.builtin.set_fact:
|
||||
bluestore_wal_devices: "{{ bluestore_wal_devices_prepare_canonicalize.results | map(attribute='stdout') | reject('search', '/dev/disk') | list | unique }}"
|
||||
|
||||
- name: Collect existed devices
|
||||
vars:
|
||||
device: "{{ item.key | regex_replace('^', '/dev/') }}"
|
||||
ansible.builtin.command: test -b {{ device }}
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
loop: "{{ ansible_facts['devices'] | dict2items }}"
|
||||
when:
|
||||
- osd_auto_discovery | default(False) | bool
|
||||
- ansible_facts['devices'] is defined
|
||||
- item.value.removable == "0"
|
||||
- item.value.sectors != "0"
|
||||
- item.value.partitions|count == 0
|
||||
- item.value.holders|count == 0
|
||||
- ansible_facts['mounts'] | selectattr('device', 'equalto', device) | list | length == 0
|
||||
- item.key is not match osd_auto_discovery_exclude
|
||||
- device not in dedicated_devices | default([])
|
||||
- device not in bluestore_wal_devices | default([])
|
||||
- device not in (lvm_volumes | default([]) | map(attribute='data') | list)
|
||||
register: devices_check
|
||||
|
||||
- name: Set_fact devices generate device list when osd_auto_discovery
|
||||
vars:
|
||||
device: "{{ item.item.key | regex_replace('^', '/dev/') }}"
|
||||
ansible.builtin.set_fact:
|
||||
devices: "{{ devices | default([]) | union([device]) }}"
|
||||
loop: "{{ devices_check.results }}"
|
||||
when:
|
||||
- devices_check is defined
|
||||
- devices_check is not skipped
|
||||
- not item.skipped | default(false)
|
||||
- not item.failed | default(false)
|
||||
@@ -0,0 +1,250 @@
|
||||
---
|
||||
- name: Check if it is atomic host
|
||||
ansible.builtin.stat:
|
||||
path: /run/ostree-booted
|
||||
register: stat_ostree
|
||||
|
||||
- name: Set_fact is_atomic
|
||||
ansible.builtin.set_fact:
|
||||
is_atomic: "{{ stat_ostree.stat.exists }}"
|
||||
|
||||
- name: Import_tasks container_binary.yml
|
||||
ansible.builtin.import_tasks: container_binary.yml
|
||||
|
||||
- name: Set_fact ceph_cmd
|
||||
ansible.builtin.set_fact:
|
||||
ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:z -v /var/run/ceph:/var/run/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }}"
|
||||
|
||||
# In case ansible_python_interpreter is set by the user,
|
||||
# ansible will not discover python and discovered_interpreter_python
|
||||
# will not be set
|
||||
- name: Set_fact discovered_interpreter_python
|
||||
ansible.builtin.set_fact:
|
||||
discovered_interpreter_python: "{{ ansible_python_interpreter }}"
|
||||
when: ansible_python_interpreter is defined
|
||||
|
||||
# If ansible_python_interpreter is not defined, this can result in the
|
||||
# discovered_interpreter_python fact from being set. This fails later in this
|
||||
# playbook and is used elsewhere.
|
||||
- name: Set_fact discovered_interpreter_python if not previously set
|
||||
ansible.builtin.set_fact:
|
||||
discovered_interpreter_python: "{{ ansible_facts['discovered_interpreter_python'] }}"
|
||||
when:
|
||||
- discovered_interpreter_python is not defined
|
||||
- ansible_facts['discovered_interpreter_python'] is defined
|
||||
|
||||
# Set ceph_release to ceph_stable by default
|
||||
- name: Set_fact ceph_release ceph_stable_release
|
||||
ansible.builtin.set_fact:
|
||||
ceph_release: "{{ ceph_stable_release }}"
|
||||
|
||||
- name: Set_fact monitor_name ansible_facts['hostname']
|
||||
ansible.builtin.set_fact:
|
||||
monitor_name: "{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
with_items: "{{ groups.get(mon_group_name, []) }}"
|
||||
run_once: true
|
||||
when: groups.get(mon_group_name, []) | length > 0
|
||||
|
||||
- name: Find a running monitor
|
||||
when: groups.get(mon_group_name, []) | length > 0
|
||||
block:
|
||||
- name: Set_fact container_exec_cmd
|
||||
ansible.builtin.set_fact:
|
||||
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] if not rolling_update | bool else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_facts']['hostname'] }}"
|
||||
when:
|
||||
- containerized_deployment | bool
|
||||
|
||||
- name: Find a running mon container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter name=ceph-mon-{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
||||
register: find_running_mon_container
|
||||
failed_when: false
|
||||
run_once: true
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: "{{ groups.get(mon_group_name, []) }}"
|
||||
changed_when: false
|
||||
when:
|
||||
- containerized_deployment | bool
|
||||
|
||||
- name: Check for a ceph mon socket
|
||||
ansible.builtin.shell: stat --printf=%n {{ rbd_client_admin_socket_path }}/{{ cluster }}-mon*.asok
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: mon_socket_stat
|
||||
run_once: true
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: "{{ groups.get(mon_group_name, []) }}"
|
||||
when:
|
||||
- not containerized_deployment | bool
|
||||
|
||||
- name: Check if the ceph mon socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.stdout }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: mon_socket
|
||||
run_once: true
|
||||
delegate_to: "{{ hostvars[item.item]['inventory_hostname'] }}"
|
||||
with_items: "{{ mon_socket_stat.results }}"
|
||||
when:
|
||||
- not containerized_deployment | bool
|
||||
- item.rc == 0
|
||||
|
||||
- name: Set_fact running_mon - non_container
|
||||
ansible.builtin.set_fact:
|
||||
running_mon: "{{ hostvars[item.item.item]['inventory_hostname'] }}"
|
||||
with_items: "{{ mon_socket.results }}"
|
||||
run_once: true
|
||||
when:
|
||||
- not containerized_deployment | bool
|
||||
- item.rc is defined
|
||||
- item.rc == 0
|
||||
|
||||
- name: Set_fact running_mon - container
|
||||
ansible.builtin.set_fact:
|
||||
running_mon: "{{ item.item }}"
|
||||
run_once: true
|
||||
with_items: "{{ find_running_mon_container.results }}"
|
||||
when:
|
||||
- containerized_deployment | bool
|
||||
- item.stdout_lines | default([]) | length > 0
|
||||
|
||||
- name: Set_fact _container_exec_cmd
|
||||
ansible.builtin.set_fact:
|
||||
_container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0] if running_mon is undefined else running_mon]['ansible_facts']['hostname'] }}"
|
||||
when:
|
||||
- containerized_deployment | bool
|
||||
|
||||
# this task shouldn't run in a rolling_update situation
|
||||
# because it blindly picks a mon, which may be down because
|
||||
# of the rolling update
|
||||
- name: Get current fsid if cluster is already running
|
||||
ansible.builtin.command: "{{ timeout_command }} {{ _container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fsid"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: current_fsid
|
||||
run_once: true
|
||||
delegate_to: "{{ groups[mon_group_name][0] if running_mon is undefined else running_mon }}"
|
||||
when:
|
||||
- not rolling_update | bool
|
||||
|
||||
# set this as a default when performing a rolling_update
|
||||
# so the rest of the tasks here will succeed
|
||||
- name: Set_fact current_fsid rc 1
|
||||
ansible.builtin.set_fact:
|
||||
current_fsid:
|
||||
rc: 1
|
||||
when: rolling_update | bool or groups.get(mon_group_name, []) | length == 0
|
||||
|
||||
- name: Get current fsid
|
||||
ansible.builtin.command: "{{ timeout_command }} {{ container_exec_cmd }} ceph --admin-daemon /var/run/ceph/{{ cluster }}-mon.{{ hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_facts']['hostname'] }}.asok config get fsid"
|
||||
register: rolling_update_fsid
|
||||
delegate_to: "{{ mon_host | default(groups[mon_group_name][0]) }}"
|
||||
until: rolling_update_fsid is succeeded
|
||||
changed_when: false
|
||||
when:
|
||||
- rolling_update | bool
|
||||
- groups.get(mon_group_name, []) | length > 0
|
||||
|
||||
- name: Set_fact fsid
|
||||
ansible.builtin.set_fact:
|
||||
fsid: "{{ (rolling_update_fsid.stdout | from_json).fsid }}"
|
||||
when:
|
||||
- rolling_update | bool
|
||||
- groups.get(mon_group_name, []) | length > 0
|
||||
|
||||
- name: Set_fact fsid from current_fsid
|
||||
ansible.builtin.set_fact:
|
||||
fsid: "{{ current_fsid.stdout }}"
|
||||
run_once: true
|
||||
when: current_fsid.rc == 0
|
||||
|
||||
- name: Fsid related tasks
|
||||
when:
|
||||
- generate_fsid | bool
|
||||
- current_fsid.rc != 0
|
||||
- not rolling_update | bool
|
||||
block:
|
||||
- name: Generate cluster fsid
|
||||
ansible.builtin.command: "{{ hostvars[groups[mon_group_name][0]]['discovered_interpreter_python'] }} -c 'import uuid; print(str(uuid.uuid4()))'"
|
||||
register: cluster_uuid
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set_fact fsid
|
||||
ansible.builtin.set_fact:
|
||||
fsid: "{{ cluster_uuid.stdout }}"
|
||||
|
||||
- name: Import_tasks devices.yml
|
||||
ansible.builtin.import_tasks: devices.yml
|
||||
when: inventory_hostname in groups.get(osd_group_name, [])
|
||||
|
||||
- name: Check if the ceph conf exists
|
||||
ansible.builtin.stat:
|
||||
path: '/etc/ceph/{{ cluster }}.conf'
|
||||
register: ceph_conf
|
||||
|
||||
- name: Set default osd_pool_default_crush_rule fact
|
||||
ansible.builtin.set_fact:
|
||||
osd_pool_default_crush_rule: "{{ ceph_osd_pool_default_crush_rule }}"
|
||||
|
||||
- name: Get default crush rule value from ceph configuration
|
||||
when: ceph_conf.stat.exists | bool
|
||||
block:
|
||||
- &read-osd-pool-default-crush-rule
|
||||
name: Read osd pool default crush rule
|
||||
ansible.builtin.command: grep 'osd_pool_default_crush_rule' /etc/ceph/{{ cluster }}.conf
|
||||
register: crush_rule_variable
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
failed_when: crush_rule_variable.rc not in (0, 1)
|
||||
- &set-osd-pool-default-crush-rule-fact
|
||||
name: Set osd_pool_default_crush_rule fact
|
||||
ansible.builtin.set_fact:
|
||||
osd_pool_default_crush_rule: "{{ crush_rule_variable.stdout.split(' = ')[1] }}"
|
||||
when: crush_rule_variable.rc == 0
|
||||
|
||||
- name: Get default crush rule value from running monitor ceph configuration
|
||||
when:
|
||||
- running_mon is defined
|
||||
- not ceph_conf.stat.exists | bool
|
||||
block:
|
||||
- <<: *read-osd-pool-default-crush-rule # noqa: name[casing]
|
||||
delegate_to: "{{ running_mon }}"
|
||||
- *set-osd-pool-default-crush-rule-fact
|
||||
|
||||
- name: Import_tasks set_monitor_address.yml
|
||||
ansible.builtin.import_tasks: set_monitor_address.yml
|
||||
when: groups.get(mon_group_name, []) | length > 0
|
||||
|
||||
- name: Import_tasks set_radosgw_address.yml
|
||||
ansible.builtin.include_tasks: set_radosgw_address.yml
|
||||
when:
|
||||
- set_radosgw_address | default(true)
|
||||
- inventory_hostname in groups.get(rgw_group_name, [])
|
||||
|
||||
- name: Set_fact ceph_run_cmd
|
||||
ansible.builtin.set_fact:
|
||||
ceph_run_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }}"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
with_items:
|
||||
- "{{ groups[mon_group_name] if groups[mon_group_name] | default([]) | length > 0 else [] }}"
|
||||
- "{{ groups[mds_group_name] if groups[mds_group_name] | default([]) | length > 0 else [] }}"
|
||||
- "{{ groups[client_group_name] if groups[client_group_name] | default([]) | length > 0 else [] }}"
|
||||
|
||||
- name: Set_fact ceph_admin_command
|
||||
ansible.builtin.set_fact:
|
||||
ceph_admin_command: "{{ hostvars[item]['ceph_run_cmd'] }} -n client.admin -k /etc/ceph/{{ cluster }}.client.admin.keyring"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
with_items:
|
||||
- "{{ groups[mon_group_name] if groups[mon_group_name] | default([]) | length > 0 else [] }}"
|
||||
- "{{ groups[mds_group_name] if groups[mds_group_name] | default([]) | length > 0 else [] }}"
|
||||
- "{{ groups[client_group_name] if groups[client_group_name] | default([]) | length > 0 else [] }}"
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Get current default crush rule details
|
||||
ceph_crush_rule_info:
|
||||
cluster: "{{ cluster }}"
|
||||
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 }}"
|
||||
register: default_crush_rule_details
|
||||
delegate_to: "{{ delegated_node | default(groups[mon_group_name][0]) }}"
|
||||
run_once: true
|
||||
|
||||
- name: Get current default crush rule name
|
||||
ansible.builtin.set_fact:
|
||||
ceph_osd_pool_default_crush_rule_name: "{{ item.rule_name }}"
|
||||
with_items: "{{ default_crush_rule_details.stdout | default('{}', True) | from_json }}"
|
||||
run_once: true
|
||||
when: item.rule_id | int == osd_pool_default_crush_rule | int
|
||||
@@ -0,0 +1,35 @@
|
||||
- name: Set grafana_server_addr fact - ipv4
|
||||
ansible.builtin.set_fact:
|
||||
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first }}"
|
||||
when:
|
||||
- groups.get(monitoring_group_name, []) | length > 0
|
||||
- ip_version == 'ipv4'
|
||||
- dashboard_enabled | bool
|
||||
- inventory_hostname in groups[monitoring_group_name]
|
||||
|
||||
- name: Set grafana_server_addr fact - ipv6
|
||||
ansible.builtin.set_fact:
|
||||
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap }}"
|
||||
when:
|
||||
- groups.get(monitoring_group_name, []) | length > 0
|
||||
- ip_version == 'ipv6'
|
||||
- dashboard_enabled | bool
|
||||
- inventory_hostname in groups[monitoring_group_name]
|
||||
|
||||
- name: Set grafana_server_addrs fact - ipv4
|
||||
ansible.builtin.set_fact:
|
||||
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(grafana_network.split(',')) | first]) | unique }}"
|
||||
with_items: "{{ groups.get(monitoring_group_name, []) }}"
|
||||
when:
|
||||
- groups.get(monitoring_group_name, []) | length > 0
|
||||
- ip_version == 'ipv4'
|
||||
- dashboard_enabled | bool
|
||||
|
||||
- name: Set grafana_server_addrs fact - ipv6
|
||||
ansible.builtin.set_fact:
|
||||
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap]) | unique }}"
|
||||
with_items: "{{ groups.get(monitoring_group_name, []) }}"
|
||||
when:
|
||||
- groups.get(monitoring_group_name, []) | length > 0
|
||||
- ip_version == 'ipv6'
|
||||
- dashboard_enabled | bool
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Include facts.yml
|
||||
ansible.builtin.include_tasks: facts.yml
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Set_fact _monitor_addresses - ipv4
|
||||
ansible.builtin.set_fact:
|
||||
_monitor_addresses: "{{ _monitor_addresses | default({}) | combine({item: hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(hostvars[item]['public_network'].split(',')) | first}) }}"
|
||||
with_items: "{{ groups.get(mon_group_name, []) }}"
|
||||
when:
|
||||
- ip_version == 'ipv4'
|
||||
|
||||
- name: Set_fact _monitor_addresses - ipv6
|
||||
ansible.builtin.set_fact:
|
||||
_monitor_addresses: "{{ _monitor_addresses | default({}) | combine({item: hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[item]['public_network'].split(',')) | last | ansible.utils.ipwrap}) }}"
|
||||
with_items: "{{ groups.get(mon_group_name, []) }}"
|
||||
when:
|
||||
- ip_version == 'ipv6'
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
- name: Dashboard related tasks
|
||||
when: ceph_dashboard_call_item is defined
|
||||
block:
|
||||
- name: Set current radosgw_address_block, radosgw_address, radosgw_interface from node "{{ ceph_dashboard_call_item }}"
|
||||
ansible.builtin.set_fact:
|
||||
radosgw_address_block: "{{ hostvars[ceph_dashboard_call_item]['radosgw_address_block'] | default(radosgw_address_block) }}"
|
||||
radosgw_address: "{{ hostvars[ceph_dashboard_call_item]['radosgw_address'] | default(radosgw_address) }}"
|
||||
radosgw_interface: "{{ hostvars[ceph_dashboard_call_item]['radosgw_interface'] | default(radosgw_interface) }}"
|
||||
|
||||
- name: Set_fact _radosgw_address to radosgw_address_block ipv4
|
||||
ansible.builtin.set_fact:
|
||||
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | first }}"
|
||||
when:
|
||||
- radosgw_address_block is defined
|
||||
- radosgw_address_block != 'subnet'
|
||||
- ip_version == 'ipv4'
|
||||
|
||||
- name: Set_fact _radosgw_address to radosgw_address_block ipv6
|
||||
ansible.builtin.set_fact:
|
||||
_radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | last | ansible.utils.ipwrap }}"
|
||||
when:
|
||||
- radosgw_address_block is defined
|
||||
- radosgw_address_block != 'subnet'
|
||||
- ip_version == 'ipv6'
|
||||
|
||||
- name: Set_fact _radosgw_address to radosgw_address
|
||||
ansible.builtin.set_fact:
|
||||
_radosgw_address: "{{ radosgw_address | ansible.utils.ipwrap }}"
|
||||
when:
|
||||
- radosgw_address is defined
|
||||
- radosgw_address != 'x.x.x.x'
|
||||
|
||||
- name: Tasks for radosgw interface
|
||||
when:
|
||||
- radosgw_address_block == 'subnet'
|
||||
- radosgw_address == 'x.x.x.x'
|
||||
- radosgw_interface != 'interface'
|
||||
block:
|
||||
- name: Set_fact _interface
|
||||
ansible.builtin.set_fact:
|
||||
_interface: "{{ (hostvars[item]['radosgw_interface'] | replace('-', '_')) }}"
|
||||
loop: "{{ groups.get(rgw_group_name, []) }}"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
|
||||
- name: Set_fact _radosgw_address to radosgw_interface - ipv4
|
||||
ansible.builtin.set_fact:
|
||||
_radosgw_address: "{{ hostvars[item]['ansible_facts'][hostvars[item]['_interface']][ip_version]['address'] }}"
|
||||
loop: "{{ groups.get(rgw_group_name, []) }}"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
when: ip_version == 'ipv4'
|
||||
|
||||
- name: Set_fact _radosgw_address to radosgw_interface - ipv6
|
||||
ansible.builtin.set_fact:
|
||||
_radosgw_address: "{{ hostvars[item]['ansible_facts'][hostvars[item]['_interface']][ip_version][0]['address'] | ansible.utils.ipwrap }}"
|
||||
loop: "{{ groups.get(rgw_group_name, []) }}"
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
when: ip_version == 'ipv6'
|
||||
|
||||
- name: Rgw_instances
|
||||
when:
|
||||
- ceph_dashboard_call_item is defined or
|
||||
inventory_hostname in groups.get(rgw_group_name, [])
|
||||
block:
|
||||
- name: Reset rgw_instances (workaround)
|
||||
ansible.builtin.set_fact:
|
||||
rgw_instances: []
|
||||
|
||||
- name: Set_fact rgw_instances
|
||||
ansible.builtin.set_fact:
|
||||
rgw_instances: "{{ rgw_instances | default([]) | union([{'instance_name': 'rgw' + item | string, 'radosgw_address': hostvars[ceph_dashboard_call_item | default(inventory_hostname)]['_radosgw_address'], 'radosgw_frontend_port': radosgw_frontend_port | int + item | int}]) }}"
|
||||
with_sequence: start=0 end={{ radosgw_num_instances | int - 1 }}
|
||||
delegate_to: "{{ ceph_dashboard_call_item if ceph_dashboard_call_item is defined else inventory_hostname }}"
|
||||
delegate_facts: true
|
||||
Reference in New Issue
Block a user