introduce new role ceph-facts

sometimes we play the whole role `ceph-defaults` just to access the
default value of some variables. It means we play the `facts.yml` part
in this role while it's not desired. Splitting this role will speedup
the playbook.

Closes: #3282

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 0eb56e36f8)
pull/3484/head
Guillaume Abrioux 2018-12-10 15:46:32 +01:00 committed by Sébastien Han
parent c3bb76b8e9
commit 416b503476
14 changed files with 284 additions and 199 deletions

View File

@ -44,6 +44,7 @@
roles:
- ceph-defaults
- ceph-validate
- ceph-facts
- hosts: osds
gather_facts: False
@ -67,6 +68,7 @@
- role: ceph-infra
- role: ceph-docker-common
when: containerized_deployment | bool
- role: ceph-facts
- role: ceph-common
when: not containerized_deployment | bool
- role: ceph-config

View File

@ -308,12 +308,11 @@
gather_facts: true
become: true
tasks:
- import_role:
name: ceph-defaults
private: false
# This is a tricks so we can access 'ceph-defaults' defaults variables in 'ceph-facts
roles:
- ceph-defaults
post_tasks:
- name: gather monitors facts
setup:
delegate_to: "{{ item }}"
@ -592,12 +591,11 @@
gather_facts: true
become: true
tasks:
- import_role:
name: ceph-defaults
private: false
# This is a tricks so we can access 'ceph-defaults' defaults variables in 'ceph-facts'
roles:
- ceph-defaults
post_tasks:
- import_role:
name: ceph-facts
private: false

View File

@ -121,6 +121,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -299,6 +300,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -361,6 +363,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -446,6 +449,7 @@
roles:
- ceph-defaults
- ceph-facts
tasks:
- name: set_fact docker_exec_cmd_osd
@ -502,6 +506,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -549,6 +554,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -604,6 +610,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -655,6 +662,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -709,6 +717,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }
@ -737,6 +746,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- { role: ceph-common, when: not containerized_deployment }
- { role: ceph-docker-common, when: containerized_deployment }

View File

@ -72,6 +72,7 @@
roles:
- ceph-defaults
- ceph-facts
post_tasks:
- name: pick a monitor different than the one we want to remove

View File

@ -57,6 +57,7 @@
roles:
- ceph-defaults
- ceph-facts
post_tasks:

View File

@ -118,6 +118,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-mon
@ -176,6 +177,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-mgr
@ -283,6 +285,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-osd
@ -345,6 +348,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-mds
@ -388,6 +392,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-rgw
@ -431,6 +436,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-rbd-mirror
@ -478,6 +484,7 @@
roles:
- ceph-defaults
- ceph-facts
- ceph-handler
- ceph-docker-common
- ceph-nfs

View File

@ -1,3 +1 @@
---
- name: include facts.yml
include_tasks: facts.yml

View File

@ -0,0 +1,3 @@
# Ansible role: ceph-facts
Documentation is available at http://docs.ceph.com/ceph-ansible/.

View File

@ -0,0 +1 @@
---

View File

@ -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:
- 7
galaxy_tags:
- system
dependencies: []

View File

@ -0,0 +1,3 @@
---
- name: include facts.yml
include_tasks: facts.yml

View File

@ -53,6 +53,8 @@
roles:
- role: ceph-defaults
tags: [with_pkg, fetch_container_image]
- role: ceph-facts
tags: [with_pkg, fetch_container_image]
- role: ceph-validate
- role: ceph-infra
- role: ceph-handler
@ -89,6 +91,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -122,6 +126,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -151,6 +157,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -180,6 +188,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -209,6 +219,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -238,6 +250,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -267,6 +281,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -296,6 +312,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
- role: ceph-config
@ -329,6 +347,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-docker-common
when:
@ -361,6 +381,7 @@
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- { role: ceph-defaults, tags: ['ceph_update_config'] }
- { role: ceph-facts, tags: ['ceph_update_config'] }
- role: ceph-handler
- ceph-docker-common
- { role: ceph-config, tags: ['ceph_update_config'] }
@ -378,18 +399,20 @@
any_errors_fatal: true
gather_facts: false
become: True
roles:
- ceph-defaults
tasks:
- name: get ceph status from the first monitor
command: docker exec ceph-mon-{{ hostvars[groups['mons'][0]]['ansible_hostname'] }} ceph --cluster {{ cluster | default ('ceph') }} -s
command: docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s
register: ceph_status
changed_when: false
delegate_to: "{{ groups['mons'][0] }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
ignore_errors: true # we skip the error if mon_group_name is different than 'mons'
- name: "show ceph status for cluster {{ cluster | default ('ceph') }}"
- name: "show ceph status for cluster {{ cluster }}"
debug:
msg: "{{ ceph_status.stdout_lines }}"
delegate_to: "{{ groups['mons'][0] }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: not ceph_status.failed

View File

@ -92,6 +92,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -120,6 +122,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -148,6 +152,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -176,6 +182,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -204,6 +212,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -232,6 +242,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -260,6 +272,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -320,6 +334,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -348,6 +364,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -378,6 +396,8 @@
roles:
- role: ceph-defaults
tags: ['ceph_update_config']
- role: ceph-facts
tags: ['ceph_update_config']
- role: ceph-handler
- role: ceph-common
- role: ceph-config
@ -396,18 +416,19 @@
gather_facts: false
become: True
any_errors_fatal: true
tasks:
roles:
- role: ceph-defaults
post_tasks:
- name: get ceph status from the first monitor
command: ceph --cluster {{ cluster | default ('ceph') }} -s
command: ceph --cluster {{ cluster }} -s
register: ceph_status
changed_when: false
delegate_to: "{{ groups['mons'][0] }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
ignore_errors: true # we skip the error if mon_group_name is different than 'mons'
- name: "show ceph status for cluster {{ cluster | default ('ceph') }}"
- name: "show ceph status for cluster {{ cluster }}"
debug:
msg: "{{ ceph_status.stdout_lines }}"
delegate_to: "{{ groups['mons'][0] }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: not ceph_status.failed