diff --git a/ansible/monitoring.yml b/ansible/monitoring.yml index 0f08cd48a85c1d42a111eab7dd353a1e91e34db9..34297f921f9ce88be7f032232f561d456a3b14d2 100644 --- a/ansible/monitoring.yml +++ b/ansible/monitoring.yml @@ -2,7 +2,7 @@ hosts: swarm-agent-for-prometheus become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Create prometheus data dir file: @@ -12,13 +12,13 @@ owner: 'nobody' group: 'nogroup' tags: - - prometheus + - swarm-prometheus - name: Creating prometheus-stateful configuration folder hosts: swarm-agent-for-prometheus-stateful become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Create prometheus data dir file: @@ -28,12 +28,12 @@ owner: 'nobody' group: 'nogroup' tags: - - prometheus + - prometheus-stateful - hosts: swarm-agent-dashboard become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Create grafana data dir file: path=/var/dockerdata/grafana state=directory mode=755 @@ -45,7 +45,7 @@ - hosts: swarm-agent-for-alertmanager become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Create alertmanager data dir file: @@ -58,7 +58,7 @@ - hosts: alertmanager_stateful become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Create alertmanager data dir file: @@ -66,63 +66,76 @@ state: directory mode: 0755 tags: - - alertmanager + - stateful-alertmanager - hosts: swarm-bootstrap-manager gather_facts: false become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Add label for prometheus node shell: "docker node update --label-add prometheus=1 {{ hostvars[groups['swarm-agent-for-prometheus'][0]]['ansible_hostname'] }}" + tags: + - swarm-prometheus + run_once: true + +- hosts: swarm-bootstrap-manager + gather_facts: false + become: yes + vars_files: + - ['{{inventory_dir}}/secrets.yml'] + tasks: - name: Add label for alertmanager node shell: "docker node update --label-add alertmanager=1 {{ hostvars[groups['swarm-agent-for-alertmanager'][0]]['ansible_hostname'] }}" tags: - - monitor-labels + - alertmanager run_once: true -- name: labelling grafana and stateful prom +- name: labelling grafana hosts: swarm-dashboard become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - name: Add label for grafana node command: "docker node update --label-add grafana=1 {{ hostvars[groups['swarm-agent-dashboard'][0]]['ansible_hostname'] }}" - - name: Adding label for stateful prometheus - shell: "docker node update --label-add prometheus_stateful=1 {{ hostvars[groups['swarm-agent-for-prometheus-stateful'][0]]['ansible_hostname'] }}" - - name: Adding label for stateful alertmanager - shell: "docker node update --label-add alertmanager_stateful=1 {{ hostvars[groups['alertmanager_stateful'][0]]['ansible_hostname'] }}" tags: - - grafana-label + - grafana run_once: true -- name: labelling grafana and stateful prom +- name: labelling stateful prom hosts: swarm-dashboard become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] tasks: - - name: Add label for grafana node - command: "docker node update --label-add grafana=1 {{ hostvars[groups['swarm-agent-dashboard'][0]]['ansible_hostname'] }}" - name: Adding label for stateful prometheus shell: "docker node update --label-add prometheus_stateful=1 {{ hostvars[groups['swarm-agent-for-prometheus-stateful'][0]]['ansible_hostname'] }}" + tags: + - prometheus-stateful + +- name: labelling statefull alermanager + hosts: swarm-dashboard + become: yes + vars_files: + - ['{{inventory_dir}}/secrets.yml'] + tasks: - name: Adding label for stateful alertmanager shell: "docker node update --label-add alertmanager_stateful=1 {{ hostvars[groups['alertmanager_stateful'][0]]['ansible_hostname'] }}" tags: - - grafana-label + - stateful-alertmanager - hosts: swarm-bootstrap-manager gather_facts: false become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] roles: - stack-monitor - {role: 'monit', monit_checks: ['alertmanager', 'prometheus']} tags: - - stack-monitor + - swarm-prometheus run_once: true - name: Deploying stateful monitoring @@ -130,68 +143,41 @@ gather_facts: false become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] roles: - stack-monitor-stateful tags: - - stack-monitor-stateful + - prometheus-stateful run_once: true - hosts: swarm-dashboard become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] roles: - stack-grafana tags: - - stack-grafana + - grafana run_once: true -- name: Deploying stateful monitoring - hosts: swarm-dashboard - gather_facts: false - become: yes - vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] - roles: - - stack-monitor-stateful - tags: - - stack-monitor-stateful - -- hosts: swarm-dashboard - become: yes - vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] - roles: - - stack-grafana - tags: - - stack-grafana - - hosts: all become: yes gather_facts: false vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] roles: - vm-agents-nodeexporter tags: - - metrics-exporter + - node-exporter + - lp_dp_monitoring - hosts: process-exporter become: yes vars_files: - - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml'] + - ['{{inventory_dir}}/secrets.yml'] roles: - vm-agents-processexporter tags: - - metrics-exporter - -- hosts: swarm-dashboard - gather_facts: false - become: yes - vars_files: - - ['{{inventory_dir}}/secrets.yml','secrets/{{env}}.yml'] - roles: - - prometheus_config - tags: + - process-exporter - lp_dp_monitoring + diff --git a/pipelines/deploy/monitor/Core/Jenkinsfile b/pipelines/deploy/monitor/Core/Jenkinsfile index 2d139577acb235ffb8b98aa3d4367a7e23c17b70..2fc42370521fd28cc175aeea21ee8ac3594882c0 100644 --- a/pipelines/deploy/monitor/Core/Jenkinsfile +++ b/pipelines/deploy/monitor/Core/Jenkinsfile @@ -20,7 +20,7 @@ node() { module = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-2].trim() jobName = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-1].trim() ansiblePlaybook = "${currentWs}/ansible/monitoring.yml" - ansibleExtraArgs = "--skip-tags lp_dp_monitoring --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" + ansibleExtraArgs = "--tags ${params.tag} --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" values.put('currentWs', currentWs) values.put('env', envDir) values.put('module', module) diff --git a/pipelines/deploy/monitor/DataPipeline/Jenkinsfile b/pipelines/deploy/monitor/DataPipeline/Jenkinsfile index a16a39e5c91a17b3dabe8b9122fc43fa1c33cc21..6b5320d355bf8a013eb3f8197db28f1f9a8aab3d 100644 --- a/pipelines/deploy/monitor/DataPipeline/Jenkinsfile +++ b/pipelines/deploy/monitor/DataPipeline/Jenkinsfile @@ -20,7 +20,7 @@ node() { module = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-2].trim() jobName = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-1].trim() ansiblePlaybook = "${currentWs}/ansible/monitoring.yml" - ansibleExtraArgs = "--extra-vars \"keycloak_api_management_user_email=\"\"\" --tags metrics-exporter,lp_dp_monitoring --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" + ansibleExtraArgs = "--extra-vars \"keycloak_api_management_user_email=\"\"\" --tags lp_dp_monitoring --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" values.put('currentWs', currentWs) values.put('env', envDir) values.put('module', module) diff --git a/pipelines/deploy/monitor/KnowledgePlatform/Jenkinsfile b/pipelines/deploy/monitor/KnowledgePlatform/Jenkinsfile index 85f6a1ef2ec3e196e1faf0c8f300bcbf1b8cd668..c056ec43e814c7807bfc165e1783d8ce3cc33104 100644 --- a/pipelines/deploy/monitor/KnowledgePlatform/Jenkinsfile +++ b/pipelines/deploy/monitor/KnowledgePlatform/Jenkinsfile @@ -20,7 +20,7 @@ node() { module = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-2].trim() jobName = sh(returnStdout: true, script: "echo $JOB_NAME").split('/')[-1].trim() ansiblePlaybook = "${currentWs}/ansible/monitoring.yml" - ansibleExtraArgs = "--tags metrics-exporter,lp_dp_monitoring --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" + ansibleExtraArgs = "--tags lp_dp_monitoring --vault-password-file /var/lib/jenkins/secrets/vault-pass -v" values.put('currentWs', currentWs) values.put('env', envDir) values.put('module', module)