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>
pull/3442/head
Guillaume Abrioux 2018-12-10 15:46:32 +01:00 committed by Sébastien Han
parent ae7f3d66a6
commit 0eb56e36f8
16 changed files with 160 additions and 13 deletions

View File

@ -45,6 +45,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-validate
@ -68,6 +71,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler

View File

@ -321,6 +321,10 @@
name: ceph-defaults
private: false
- import_role:
name: ceph-facts
private: false
- name: get all the running osds
shell: |
systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"
@ -588,6 +592,10 @@
name: ceph-defaults
private: false
- import_role:
name: ceph-facts
private: false
- name: show container list on all the nodes (should be empty)
command: >
{{ container_binary }} ps --filter='name=ceph' -a -q

View File

@ -120,6 +120,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -250,6 +252,8 @@
tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- name: non container - get current fsid
command: "ceph --cluster {{ cluster }} fsid"
@ -330,6 +334,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -395,6 +401,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -487,6 +495,8 @@
tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- name: set_fact docker_exec_cmd_osd
set_fact:
@ -538,6 +548,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -587,6 +599,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -644,6 +658,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -697,6 +713,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -753,6 +771,8 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
@ -785,6 +805,8 @@
tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:

View File

@ -70,6 +70,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
# post_tasks for preceding import
- name: pick a monitor different than the one we want to remove
set_fact:

View File

@ -59,6 +59,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
post_tasks:
- name: set_fact docker_exec_cmd build docker exec command (containerized)
set_fact:

View File

@ -114,10 +114,16 @@
tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
- import_role:
name: ceph-container-common
- import_role:
name: ceph-mon
@ -176,6 +182,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
@ -292,6 +301,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
@ -363,6 +375,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
@ -413,6 +428,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
@ -462,6 +480,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler
@ -516,6 +537,9 @@
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
- import_role:
name: ceph-handler

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

@ -106,6 +106,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -144,6 +147,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -181,6 +187,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -217,6 +226,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -253,6 +265,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -289,6 +304,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -325,6 +343,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -361,6 +382,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -401,6 +425,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -425,6 +452,8 @@
gather_facts: false
become: True
tasks:
- import_role:
name: ceph-defaults
- name: check if podman binary is present
stat:
path: /usr/bin/podman
@ -432,16 +461,15 @@
- name: get ceph status from the first monitor
command: >
{{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else 'docker' }} exec ceph-mon-{{ hostvars[groups['mons'][0]]['ansible_hostname'] }} ceph --cluster {{ cluster | default ('ceph') }} -s
{{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else '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

@ -96,6 +96,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -134,6 +137,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -170,6 +176,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -206,6 +215,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -242,6 +254,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -278,6 +293,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -314,6 +332,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -350,6 +371,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -386,6 +410,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -424,6 +451,9 @@
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
@ -449,17 +479,18 @@
gather_facts: false
become: True
tasks:
- import_role:
name: ceph-defaults
- 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