ansible: Reduce verbosity of prometheus-node-exporter logs
authorKienan Stewart <kstewart@efficios.com>
Thu, 24 Oct 2024 17:59:14 +0000 (13:59 -0400)
committerKienan Stewart <kstewart@efficios.com>
Thu, 24 Oct 2024 17:59:14 +0000 (13:59 -0400)
Change-Id: Ife6e81686e0235ac7fa291f4a6d9c843d0d13823
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
automation/ansible/README.md
automation/ansible/host_vars/ci-host-amd64-1a.internal.efficios.com.yml
automation/ansible/roles/common/defaults/main.yml
automation/ansible/roles/common/tasks/main.yml
automation/ansible/roles/common/tasks/setup-Debian.yml

index faf76d5b1faf1ad5232d47a892e5840f914f5d9c..1204bacdc4e87eda3f36da5cef89b9a9ced13df4 100644 (file)
@@ -33,6 +33,7 @@ ansible-playbook -i hosts [-l SUBSET] site.yaml
 ## Tags
 
 * access: Any user / ssh access tasks
+* monitoring: Any tasks related to installing or configuring monitoring services
 * slow: Any tasks that may take a long time
 
 ### Example: Skip slow tasks
index 3f2c6751718ad2d407db895f88025c14c364fecc..eebb72400ed6df30566ca3ef2412a6ab39bdf3ac 100644 (file)
@@ -1,4 +1,6 @@
 ---
+common_prometheus_node_exporter_args: "--log.level=error --no-collector.nfsd"
+
 lxd_cluster_ip: 172.18.0.190
 lxd_cluster:
   server_name: ci-host-amd64-1a
index 321fbfc881a1483415c4db5cba489c478689c004..ec35d2bc097957d28134761f59689f0bddf9c573 100644 (file)
@@ -4,5 +4,6 @@ common_certificate_cert_path_prefix: '/etc/ssl/certs'
 common_certificate_key_path_prefix: '/etc/ssl/private'
 common_certificate_deploy_combined_pem: true
 
+common_prometheus_node_exporter_args: "--log.level=error"
 common_install_promtail: false
 common_promtail_client: 'http://graph01:3500/loki/api/v1/push'
index c77b47371ab664a451011808a729d22d7c16d6ca..ff3ed6536fa63cd05be84245825699c953499d9a 100644 (file)
 
 # Setup/install tasks.
 - ansible.builtin.include_tasks: setup-RedHat.yml
+  tags:
+    - always
   when: ansible_os_family in ['RedHat', 'Rocky']
 
 - ansible.builtin.include_tasks: setup-Debian.yml
+  tags:
+    - always
   when: ansible_os_family == 'Debian'
 
 - ansible.builtin.include_tasks: setup-Alpine.yml
+  tags:
+    - always
   when: ansible_os_family == 'Alpine'
 
 - ansible.builtin.include_tasks: setup-Suse.yml
+  tags:
+    - always
   when: ansible_os_family == 'Suse'
 
 - ansible.builtin.include_tasks: setup-Windows.yml
+  tags:
+    - always
   when: ansible_os_family == 'Windows'
 
 # Setup user accounts
 - ansible.builtin.include_tasks: users.yml
+  tags:
+    - always
   tags:
     - access
   when: ansible_os_family != 'Windows'
 
 - ansible.builtin.include_tasks: users-Windows.yml
+  tags:
+    - always
   tags:
     - access
   when: ansible_os_family == 'Windows'
index 70ab6e502373dc9b0ea5953f017e9c656e969212..e2c4bb24d0fb0e99ca3d519a348518a6f88f4c41 100644 (file)
         mode: '0644'
 - name: Install prometheus node exporter for physical hosts
   when: "'hosts' in group_names"
-  ansible.builtin.apt:
-    name:
-      - prometheus-node-exporter
-      - prometheus-node-exporter-collectors
+  tags:
+    - monitoring
+  block:
+    - ansible.builtin.apt:
+        name:
+          - prometheus-node-exporter
+          - prometheus-node-exporter-collectors
+    - ansible.builtin.lineinfile:
+        line: "ARGS={{common_prometheus_node_exporter_args|quote}}"
+        path: /etc/default/prometheus-node-exporter
+      register: node_exporter_config
+    - when: node_exporter_config.changed
+      ansible.builtin.service:
+        name: prometheus-node-exporter
+        state: restarted
+        enabled: true
 
 - name: Work-around for git hanging during checkouts
   # @see https://support.efficios.com/issues/1532
         value: 'HTTP/1.1'
 
 - when: common_install_promtail
+  tags:
+    - monitoring
   block:
     - name: Add apt source
       block:
This page took 0.02748 seconds and 4 git commands to generate.