Merge "add support for stoping the collectd"

This commit is contained in:
Zuul 2021-08-04 06:57:15 +00:00 committed by Gerrit Code Review
commit 680f9dc764
3 changed files with 213 additions and 0 deletions

View File

@ -0,0 +1,80 @@
---
#
# Playbook to stop collectd on undercloud/overcloud
#
# Stop on all undercloud/overcloud machines:
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml
#
# Or use tags:
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "undercloud"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "controller"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "networker"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "blockstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "objectstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "cephstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-baremetal.yml --tag "compute"
#
- hosts: Undercloud
remote_user: "{{ local_remote_user }}"
tasks:
- name: Stop Collectd on undercloud
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: undercloud
- hosts: Controller
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on controller
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: controller
- hosts: Networker
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on networker
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: networker
- hosts: BlockStorage
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on blockstorage
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: blockstorage
- hosts: ObjectStorage
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on objectstorage
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: objectstorage
- hosts: CephStorage
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on cephstorage
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: cephstorage
- hosts: Compute
remote_user: "{{ host_remote_user }}"
tasks:
- name: Stop Collectd on compute
service: name=collectd state=stopped enabled=false
become: true
ignore_errors: true
tags: compute

View File

@ -0,0 +1,122 @@
#
# Playbook to stop collectd on undercloud/overcloud
#
# Stop collectd on all undercloud/overcloud machines:
# ansible-playbook -i hosts.yaml install/stop-collectd-container.yml
#
# Or use tags:
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "undercloud"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "controller"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "networker"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "blockstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "objectstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "cephstorage"
# ansible-playbook -i hosts.yml install/stop-collectd-container.yml --tag "compute"
#
- hosts: Undercloud
remote_user: "{{ local_remote_user }}"
vars:
config_type: undercloud
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: undercloud
- hosts: Controller
remote_user: "{{ host_remote_user }}"
vars:
config_type: controller
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: controller
- hosts: Networker
remote_user: "{{ host_remote_user }}"
vars:
config_type: networker
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: networker
- hosts: BlockStorage
remote_user: "{{ host_remote_user }}"
vars:
config_type: blockstorage
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: blockstorage
- hosts: ObjectStorage
remote_user: "{{ host_remote_user }}"
vars:
config_type: objectstorage
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: objectstorage
- hosts: CephStorage
remote_user: "{{ host_remote_user }}"
vars:
config_type: cephstorage
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: cephstorage
- hosts: Compute
remote_user: "{{ host_remote_user }}"
vars:
config_type: compute
roles:
- { role: osp_version }
- { role: containers }
tasks:
- name: Stop Collectd on {{ config_type }}
shell: |
{{ container_cli }} stop collectd-{{ config_type }}
become: yes
ignore_errors: true
tags: compute

View File

@ -0,0 +1,11 @@
---
- name: set fact collectd_container
import_playbook: pre-collectd.yml
- name: Run containerized collectd (Stein and greater recommended)
import_playbook: stop-collectd-container.yml
when: hostvars['undercloud']['collectd_container']
- name: Run collectd installed through RPMs
import_playbook: stop-collectd-baremetal.yml
when: not hostvars['undercloud']['collectd_container']