2014-03-04 02:08:51 +08:00
|
|
|
---
|
2019-07-09 21:40:47 +08:00
|
|
|
- name: set_fact add_osd
|
|
|
|
set_fact:
|
|
|
|
add_osd: "{{ groups[osd_group_name] | length != ansible_play_hosts_all | length }}"
|
|
|
|
|
2020-01-17 22:50:40 +08:00
|
|
|
- name: set_fact container_exec_cmd
|
|
|
|
set_fact:
|
2021-03-03 22:43:50 +08:00
|
|
|
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
2020-01-17 22:50:40 +08:00
|
|
|
with_items: "{{ groups.get(mon_group_name, []) }}"
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: true
|
|
|
|
run_once: true
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
|
2018-08-10 20:16:30 +08:00
|
|
|
- name: include_tasks system_tuning.yml
|
|
|
|
include_tasks: system_tuning.yml
|
2018-03-15 06:39:10 +08:00
|
|
|
|
2018-04-11 23:15:29 +08:00
|
|
|
- name: install dependencies
|
|
|
|
package:
|
|
|
|
name: parted
|
|
|
|
state: present
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
2021-03-03 22:43:50 +08:00
|
|
|
- ansible_facts['os_family'] != 'ClearLinux'
|
2018-04-11 23:15:29 +08:00
|
|
|
|
2019-03-11 22:44:47 +08:00
|
|
|
- name: install numactl when needed
|
|
|
|
package:
|
|
|
|
name: numactl
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- containerized_deployment | bool
|
2019-10-10 03:39:04 +08:00
|
|
|
- ceph_osd_numactl_opts | length > 0
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: with_pkg
|
2019-03-11 22:44:47 +08:00
|
|
|
|
2018-08-10 20:16:30 +08:00
|
|
|
- name: include_tasks common.yml
|
|
|
|
include_tasks: common.yml
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2019-07-09 21:40:47 +08:00
|
|
|
- name: set noup flag
|
2020-11-04 05:44:58 +08:00
|
|
|
ceph_osd_flag:
|
|
|
|
name: noup
|
|
|
|
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 }}"
|
2019-07-09 21:40:47 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2020-06-16 23:43:13 +08:00
|
|
|
when:
|
|
|
|
- not rolling_update | default(False) | bool
|
|
|
|
- not switch_to_containers | default(False) | bool
|
2019-07-09 21:40:47 +08:00
|
|
|
|
2018-10-03 05:54:57 +08:00
|
|
|
- name: include container_options_facts.yml
|
|
|
|
include_tasks: container_options_facts.yml
|
2020-01-21 00:24:08 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-07-25 23:54:26 +08:00
|
|
|
|
2018-08-10 20:16:30 +08:00
|
|
|
- name: include_tasks scenarios/lvm.yml
|
|
|
|
include_tasks: scenarios/lvm.yml
|
2017-07-19 23:05:42 +08:00
|
|
|
when:
|
2018-08-09 23:40:16 +08:00
|
|
|
- lvm_volumes|length > 0
|
2019-05-22 16:02:42 +08:00
|
|
|
- not rolling_update|default(False) | bool
|
2018-08-04 00:15:58 +08:00
|
|
|
|
2018-08-10 20:16:30 +08:00
|
|
|
- name: include_tasks scenarios/lvm-batch.yml
|
|
|
|
include_tasks: scenarios/lvm-batch.yml
|
2018-08-04 00:15:58 +08:00
|
|
|
when:
|
2018-08-09 23:40:16 +08:00
|
|
|
- devices|length > 0
|
2019-05-22 16:02:42 +08:00
|
|
|
- not rolling_update|default(False) | bool
|
2017-07-19 23:05:42 +08:00
|
|
|
|
2018-08-10 20:16:30 +08:00
|
|
|
- name: include_tasks start_osds.yml
|
|
|
|
include_tasks: start_osds.yml
|
2018-05-22 22:41:40 +08:00
|
|
|
|
2019-11-08 23:21:54 +08:00
|
|
|
- name: unset noup flag
|
2020-11-04 05:44:58 +08:00
|
|
|
ceph_osd_flag:
|
|
|
|
name: noup
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
state: absent
|
|
|
|
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 }}"
|
2019-11-08 23:21:54 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- not rolling_update | default(False) | bool
|
2020-06-16 23:43:13 +08:00
|
|
|
- not switch_to_containers | default(False) | bool
|
2019-11-08 23:21:54 +08:00
|
|
|
- inventory_hostname == ansible_play_hosts_all | last
|
|
|
|
|
2019-11-27 00:09:11 +08:00
|
|
|
- name: wait for all osd to be up
|
2020-10-24 21:59:17 +08:00
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd stat -f json"
|
2019-11-27 00:09:11 +08:00
|
|
|
register: wait_for_all_osds_up
|
|
|
|
retries: "{{ nb_retry_wait_osd_up }}"
|
|
|
|
delay: "{{ delay_wait_osd_up }}"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
until:
|
2020-10-24 21:59:17 +08:00
|
|
|
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] | int > 0
|
|
|
|
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"]
|
2019-11-08 23:21:54 +08:00
|
|
|
when:
|
2020-09-01 17:24:59 +08:00
|
|
|
- not ansible_check_mode
|
2019-11-08 23:21:54 +08:00
|
|
|
- inventory_hostname == ansible_play_hosts_all | last
|
2020-11-26 16:53:04 +08:00
|
|
|
tags: wait_all_osds_up
|
2019-11-27 00:09:11 +08:00
|
|
|
|
2019-11-01 04:17:33 +08:00
|
|
|
- name: include crush_rules.yml
|
|
|
|
include_tasks: crush_rules.yml
|
2020-02-11 02:43:31 +08:00
|
|
|
when: hostvars[groups[mon_group_name][0]]['crush_rule_config'] | default(crush_rule_config) | bool
|
2020-11-26 16:53:04 +08:00
|
|
|
tags: wait_all_osds_up
|
2019-11-01 04:17:33 +08:00
|
|
|
|
2018-06-01 21:11:21 +08:00
|
|
|
- name: set_fact openstack_keys_tmp - preserve backward compatibility after the introduction of the ceph_keys module
|
|
|
|
set_fact:
|
|
|
|
openstack_keys_tmp: "{{ openstack_keys_tmp|default([]) + [ { 'key': item.key, 'name': item.name, 'caps': { 'mon': item.mon_cap, 'osd': item.osd_cap|default(''), 'mds': item.mds_cap|default(''), 'mgr': item.mgr_cap|default('') } , 'mode': item.mode } ] }}"
|
|
|
|
with_items: "{{ openstack_keys }}"
|
|
|
|
when:
|
2019-07-09 21:40:47 +08:00
|
|
|
- not add_osd | bool
|
2019-05-22 16:02:42 +08:00
|
|
|
- openstack_config | bool
|
2018-11-01 19:48:59 +08:00
|
|
|
- item.get('mon_cap', None)
|
|
|
|
# it's enough to assume we are running an old-fashionned syntax simply by checking the presence of mon_cap since every key needs this cap
|
2018-06-01 21:11:21 +08:00
|
|
|
|
|
|
|
- name: set_fact keys - override keys_tmp with keys
|
|
|
|
set_fact:
|
|
|
|
openstack_keys: "{{ openstack_keys_tmp }}"
|
|
|
|
when:
|
2019-07-09 21:40:47 +08:00
|
|
|
- not add_osd | bool
|
2018-06-01 21:11:21 +08:00
|
|
|
- openstack_keys_tmp is defined
|
|
|
|
|
2018-05-22 22:41:40 +08:00
|
|
|
# Create the pools listed in openstack_pools
|
|
|
|
- name: include openstack_config.yml
|
2018-08-21 22:23:35 +08:00
|
|
|
include_tasks: openstack_config.yml
|
2018-05-22 22:41:40 +08:00
|
|
|
when:
|
2019-07-09 21:40:47 +08:00
|
|
|
- not add_osd | bool
|
2019-11-08 23:21:54 +08:00
|
|
|
- not rolling_update | default(False) | bool
|
2019-05-22 16:02:42 +08:00
|
|
|
- openstack_config | bool
|
2018-05-23 11:07:38 +08:00
|
|
|
- inventory_hostname == groups[osd_group_name] | last
|
2020-11-26 16:53:04 +08:00
|
|
|
tags: wait_all_osds_up
|