diff --git a/ansible/install/start-collectd-rhoso.yml b/ansible/install/start-collectd-rhoso.yml new file mode 100644 index 000000000..87b667a82 --- /dev/null +++ b/ansible/install/start-collectd-rhoso.yml @@ -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 }}" diff --git a/ansible/install/start-collectd.yml b/ansible/install/start-collectd.yml index bd9f697ac..2913f700a 100644 --- a/ansible/install/start-collectd.yml +++ b/ansible/install/start-collectd.yml @@ -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 diff --git a/ansible/install/stop-collectd-rhoso.yml b/ansible/install/stop-collectd-rhoso.yml new file mode 100644 index 000000000..5a12ab6fe --- /dev/null +++ b/ansible/install/stop-collectd-rhoso.yml @@ -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 diff --git a/ansible/install/stop-collectd.yml b/ansible/install/stop-collectd.yml index dff8c48cc..9ab09ef69 100644 --- a/ansible/install/stop-collectd.yml +++ b/ansible/install/stop-collectd.yml @@ -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