add option to start and stop collectd for rhoso environment

Change-Id: Ic7f5aea595e4b8ce62bee5b3c3ddd26c41e73719
This commit is contained in:
Masco 2024-07-11 13:02:47 +05:30
parent f7a91aeca0
commit 67a03d5d4e
4 changed files with 58 additions and 16 deletions

View File

@ -0,0 +1,20 @@
- hosts: localhost
tasks:
- block:
- name: check if collectd already deployed using statefulset
shell: |
oc -n ospperf get statefulset osp-controlplane-collectd
register: is_statefulset_exist
ignore_errors: true
- name: get number of worker nodes
shell: |
oc get nodes -l node-role.kubernetes.io/worker --no-headers | wc -l
register: worker_node_count
- name: scale the collectd containers
shell: |
oc -n ospperf scale statefulset osp-controlplane-collectd --replicas={{ worker_node_count.stdout }}
when: is_statefulset_exist.rc == 0
environment:
KUBECONFIG: "{{ kubeconfig_path }}"

View File

@ -1,11 +1,18 @@
---
- name: set fact collectd_container
import_playbook: pre-collectd.yml
- name: start collectd for osp <= 17
block:
- name: set fact collectd_container
import_playbook: pre-collectd.yml
- name: Start containerized collectd (Stein and greater recommended)
import_playbook: start-collectd-container.yml
when: hostvars['undercloud']['collectd_container']
- name: Start containerized collectd (Stein and greater recommended)
import_playbook: start-collectd-container.yml
when: hostvars['undercloud']['collectd_container']
- name: Start collectd installed through RPMs
import_playbook: start-collectd-baremetal.yml
when: not hostvars['undercloud']['collectd_container']
- name: Start collectd installed through RPMs
import_playbook: start-collectd-baremetal.yml
when: not hostvars['undercloud']['collectd_container']
when: not is_rhoso_deployment
- name: Start collectd on RHOSO OCP workers
import_playbook: start-collectd-rhoso.yml
when: is_rhoso_deployment

View File

@ -0,0 +1,8 @@
- hosts: localhost
tasks:
- name: stop collectd on OCP nodes.
shell: |
oc scale -n ospperf statefulset osp-controlplane-collectd --replicas=0
environment:
KUBECONFIG: "{{ kubeconfig_path }}"
ignore_errors: yes

View File

@ -1,11 +1,18 @@
---
- name: set fact collectd_container
import_playbook: pre-collectd.yml
- name: stop collectd on osp <= 17
block:
- 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 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']
- name: Run collectd installed through RPMs
import_playbook: stop-collectd-baremetal.yml
when: not hostvars['undercloud']['collectd_container']
when: not is_rhoso_deployment
- name: stop collectd on RHOSO ocp workers
import_playbook: stop-collectd-rhoso.yml
when: is_rhoso_deployment