ansible-collection-prometheus/roles/mysqld_exporter/tasks/configure.yml
gardar 82d0c730ed
fix: correctly set no_log bool instead of string
Signed-off-by: gardar <gardar@users.noreply.github.com>
2023-08-21 15:17:27 +00:00

52 lines
1.7 KiB
YAML

---
- name: Copy the mysqld_exporter systemd service file
ansible.builtin.template:
src: mysqld_exporter.service.j2
dest: /etc/systemd/system/mysqld_exporter.service
owner: root
group: root
mode: '0644'
notify: restart mysqld_exporter
- name: Create mysqld_exporter config directory
ansible.builtin.file:
path: "{{ mysqld_exporter_config_dir }}"
state: directory
owner: root
group: root
mode: u+rwX,g+rwX,o=rX
- name: Copy the mysqld_exporter config file
ansible.builtin.template:
src: my_cnf.j2
dest: "{{ mysqld_exporter_config_dir }}/{{ mysqld_exporter_config_file }}"
owner: root
group: '{{ mysqld_exporter_system_group }}'
mode: '0640'
no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}"
notify: restart mysqld_exporter
- name: Configure mysqld_exporter web config
when:
( mysqld_exporter_tls_server_config | length > 0 ) or
( mysqld_exporter_http_server_config | length > 0 ) or
( mysqld_exporter_basic_auth_users | length > 0 )
block:
- name: Copy the mysqld_exporter web config file
ansible.builtin.template:
src: web_config.yaml.j2
dest: "{{ mysqld_exporter_config_dir }}/web_config.yaml"
owner: root
group: '{{ mysqld_exporter_system_group }}'
mode: '0640'
notify: restart mysqld_exporter
- name: Allow mysqld_exporter port in SELinux on RedHat OS family
community.general.seport:
ports: "{{ mysqld_exporter_web_listen_address.split(':')[-1] }}"
proto: tcp
setype: http_port_t
state: present
when:
- ansible_version.full is version_compare('2.4', '>=')
- ansible_selinux.status == "enabled"