Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playbooks: use group name variables consistently #7609

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
# using groups[] here otherwise it can't fallback to the mon if there's no mgr group.
# adding an additional | default(omit) in case where no monitors are present (external ceph cluster)
- name: Deploy dashboard
hosts: "{{ groups['mgrs'] | default(groups['mons']) | default(omit) }}"
hosts: "{{ groups[mgr_group_name|default('mgrs')] | default(groups[mon_group_name|default('mons')]) | default(omit) }}"
gather_facts: false
become: true
pre_tasks:
Expand Down
6 changes: 3 additions & 3 deletions infrastructure-playbooks/add-mon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# group in your inventory so that the ceph configuration file
# is created correctly for the new OSD(s).
- name: Pre-requisites operations for adding new monitor(s)
hosts: mons
hosts: "{{ mon_group_name|default('mons') }}"
gather_facts: false
vars:
delegate_facts_host: true
Expand Down Expand Up @@ -72,7 +72,7 @@
when: containerized_deployment | bool

- name: Deploy Ceph monitors
hosts: mons
hosts: "{{ mon_group_name|default('mons') }}"
gather_facts: false
become: true
tasks:
Expand Down Expand Up @@ -107,7 +107,7 @@
when: containerized_deployment | bool

- name: Update config file on OSD nodes
hosts: osds
hosts: "{{ osd_group_name|default('osds') }}"
gather_facts: true
become: true
tasks:
Expand Down
128 changes: 64 additions & 64 deletions infrastructure-playbooks/purge-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

- name: Gather facts on all hosts
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- nfss
- clients
- mgrs
- monitoring
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ client_group_name | default('clients') }}"
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ monitoring_group_name | default('monitoring') }}"
become: true
tasks:
- name: Gather facts on all Ceph hosts for following reference
Expand All @@ -49,7 +49,7 @@


- name: Check there's no ceph kernel threads present
hosts: clients
hosts: "{{ client_group_name | default('clients') }}"
become: true
gather_facts: false
any_errors_fatal: true
Expand Down Expand Up @@ -113,7 +113,7 @@


- name: Purge ceph nfs cluster
hosts: nfss
hosts: "{{ nfs_group_name | default('nfss') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand All @@ -140,15 +140,15 @@

- name: Purge node-exporter
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- nfss
- clients
- mgrs
- monitoring
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ client_group_name | default('clients') }}"
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ monitoring_group_name | default('monitoring') }}"
become: true
tasks:
- name: Import ceph-defaults role
Expand Down Expand Up @@ -184,7 +184,7 @@


- name: Purge ceph monitoring
hosts: monitoring
hosts: "{{ monitoring_group_name | default('monitoring') }}"
become: true
vars:
grafana_services:
Expand Down Expand Up @@ -247,7 +247,7 @@


- name: Purge ceph mds cluster
hosts: mdss
hosts: "{{ mds_group_name | default('mdss') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand All @@ -268,7 +268,7 @@


- name: Purge ceph mgr cluster
hosts: mgrs
hosts: "{{ mgr_group_name | default('mgrs') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand All @@ -289,7 +289,7 @@
- '.target'

- name: Purge rgwloadbalancer cluster
hosts: rgwloadbalancers
hosts: "{{ rgwloadbalancer_group_name | default('rgwloadbalancers') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand All @@ -302,7 +302,7 @@


- name: Purge ceph rgw cluster
hosts: rgws
hosts: "{{ rgw_group_name | default('rgws') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand Down Expand Up @@ -333,7 +333,7 @@


- name: Purge ceph rbd-mirror cluster
hosts: rbdmirrors
hosts: "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand All @@ -356,7 +356,7 @@
- name: Purge ceph osd cluster
vars:
reboot_osd_node: false
hosts: osds
hosts: "{{ osd_group_name | default('osds') }}"
gather_facts: false # Already gathered previously
become: true
handlers:
Expand Down Expand Up @@ -653,7 +653,7 @@
- '.target'

- name: Purge ceph mon cluster
hosts: mons
hosts: "{{ mon_group_name | default('mons') }}"
gather_facts: false # already gathered previously
become: true
tasks:
Expand Down Expand Up @@ -689,12 +689,12 @@

- name: Purge ceph-crash daemons
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- mgrs
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ mgr_group_name | default('mgrs') }}"
gather_facts: false
become: true
tasks:
Expand Down Expand Up @@ -728,12 +728,12 @@

- name: Purge ceph-exporter daemons
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- mgrs
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ mgr_group_name | default('mgrs') }}"
gather_facts: false
become: true
tasks:
Expand Down Expand Up @@ -762,13 +762,13 @@

- name: Check container hosts
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- nfss
- mgrs
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ mgr_group_name | default('mgrs') }}"
become: true
tasks:
- name: Containerized_deployment only
Expand Down Expand Up @@ -841,15 +841,15 @@
- keepalived
- haproxy
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- nfss
- clients
- mgrs
- monitoring
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ client_group_name | default('clients') }}"
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ monitoring_group_name | default('monitoring') }}"
gather_facts: false # Already gathered previously
become: true
handlers:
Expand Down Expand Up @@ -1113,14 +1113,14 @@

- name: Purge ceph directories
hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- nfss
- mgrs
- clients
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ client_group_name | default('clients') }}"
gather_facts: false # Already gathered previously
become: true
tasks:
Expand Down
13 changes: 11 additions & 2 deletions infrastructure-playbooks/rolling_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,16 @@
- '!ohai'
delegate_to: "{{ item }}"
delegate_facts: true
with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
with_items:
- "{{ groups[mon_group_name | default('mons')] | default([]) }}"
- "{{ groups[osd_group_name | default('osds')] | default([]) }}"
- "{{ groups[mds_group_name | default('mdss')] | default([]) }}"
- "{{ groups[rgw_group_name | default('rgws')] | default([]) }}"
- "{{ groups[mgr_group_name | default('mgrs')] | default([]) }}"
- "{{ groups[rbd_mirror_group_name | default('rbdmirrors')] | default([]) }}"
- "{{ groups[nfs_group_name | default('nfss')] | default([]) }}"
- "{{ groups[monitoring_group_name | default('monitoring')] | default([]) }}"
- "{{ groups[rgwloadbalancer_group_name | default('rgwloadbalancers')] | default([]) }}"
run_once: true
when: delegate_facts_host | bool

Expand Down Expand Up @@ -537,7 +546,7 @@
health_osd_check_retries: 600
health_osd_check_delay: 2
upgrade_ceph_packages: true
hosts: osds
hosts: "{{ osd_group_name|default('osds') }}"
tags: osds
serial: 1
become: true
Expand Down
2 changes: 1 addition & 1 deletion infrastructure-playbooks/shrink-mds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
tasks_from: container_binary

- name: Perform checks, remove mds and print cluster health
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
vars_prompt:
- name: ireallymeanit # noqa: name[casing]
Expand Down
2 changes: 1 addition & 1 deletion infrastructure-playbooks/shrink-mgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
msg: gather facts on all Ceph hosts for following reference

- name: Confirm if user really meant to remove manager from the ceph cluster
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
vars_prompt:
- name: ireallymeanit # noqa: name[casing]
Expand Down
2 changes: 1 addition & 1 deletion infrastructure-playbooks/shrink-mon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
msg: "gather facts on all Ceph hosts for following reference"

- name: Confirm whether user really meant to remove monitor from the ceph cluster
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
vars_prompt:
- name: ireallymeanit # noqa: name[casing]
Expand Down
6 changes: 3 additions & 3 deletions infrastructure-playbooks/shrink-osd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

- name: Gather facts and check the init system
hosts:
- mons
- osds
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"

become: true
tasks:
Expand All @@ -23,7 +23,7 @@
msg: "gather facts on all Ceph hosts for following reference"

- name: Confirm whether user really meant to remove osd(s) from the cluster
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
vars_prompt:
- name: ireallymeanit # noqa: name[casing]
Expand Down
6 changes: 3 additions & 3 deletions infrastructure-playbooks/shrink-rbdmirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

- name: Gather facts and check the init system
hosts:
- mons
- rbdmirrors
- "{{ mon_group_name | default('mons') }}"
- "{{ rbd_mirror_group_name | default('rbdmirrors') }}"
become: true
tasks:
- name: Gather facts on MONs and RBD mirrors
Expand All @@ -23,7 +23,7 @@

- name: Confirm whether user really meant to remove rbd mirror from the ceph
cluster
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
vars_prompt:
- name: ireallymeanit # noqa: name[casing]
Expand Down
2 changes: 1 addition & 1 deletion infrastructure-playbooks/shrink-rgw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
- '!ohai'

- name: Shrink rgw service
hosts: mons[0]
hosts: "{{ mon_group_name | default('mons') }}[0]"
become: true
gather_facts: false
pre_tasks:
Expand Down
Loading