chore: fix syntax for ansible lint

This commit is contained in:
Adrien Waksberg 2024-05-07 22:39:05 +02:00
parent 8aa3a9cbaa
commit 118d86bfe0
5 changed files with 69 additions and 72 deletions

View file

@ -1,10 +1,10 @@
---
- name: reload icinga2
- name: Reload icinga2
ansible.builtin.service:
name: icinga2
state: reloaded
- name: restart icinga2
- name: Restart icinga2
ansible.builtin.service:
name: icinga2
state: restarted

View file

@ -1,12 +1,9 @@
---
- name: install dependencies packages
- name: Install dependencies packages
ansible.builtin.package:
name:
- apt-transport-https
- gpg
retries: 2
register: result
until: result is succeeded
tags: icinga2
- name: Add repository key
@ -15,7 +12,7 @@
dest: /etc/apt/keyrings/icinga.asc
owner: root
group: root
mode: 0644
mode: "0644"
checksum: sha256:be677e07972ed57b99ffc2fd211379ac11b9c6a7c8d9460086b447b96b0a82bb
tags: icinga2
@ -27,24 +24,21 @@
filename: icinga
tags: icinga2
- name: install packages
- name: Install packages
ansible.builtin.package:
name:
- icinga2
- 'icinga2-ido-{{ icinga2_db_type }}'
- "icinga2-ido-{{ icinga2_db_type }}"
- icingacli
- monitoring-plugins
- nagios-nrpe-plugin
retries: 2
register: result
until: result is succeeded
tags: icinga2
- name: create certs directory
- name: Create certs directory
ansible.builtin.file:
path: /var/lib/icinga2/certs
owner: root
group: nagios
mode: 0750
mode: "0750"
state: directory
tags: icinga2

View file

@ -1,30 +1,30 @@
---
- name: remove old config files
- name: Remove old config files
ansible.builtin.file:
path: /etc/icinga2/conf.d/apt.conf
state: absent
notify: reload icinga2
notify: Reload icinga2
tags: icinga2
- name: copy scripts
- name: Copy scripts
ansible.builtin.copy:
content: '{{ item.value }}'
dest: '/etc/icinga2/scripts/{{ item.key }}'
content: "{{ item.value }}"
dest: "/etc/icinga2/scripts/{{ item.key }}"
owner: root
group: nagios
mode: 0750
loop: '{{ icinga2_scripts | dict2items }}'
mode: "0750"
loop: "{{ icinga2_scripts | dict2items }}"
loop_control:
label: '{{ item.key }}'
label: "{{ item.key }}"
tags: icinga2
- name: copy config files
- name: Copy config files
ansible.builtin.template:
src: '{{ item }}.conf.j2'
dest: '/etc/icinga2/conf.d/{{ item }}.conf'
src: "{{ item }}.conf.j2"
dest: "/etc/icinga2/conf.d/{{ item }}.conf"
owner: root
group: nagios
mode: 0640
mode: "0640"
loop:
- check_commands
- commands
@ -36,95 +36,95 @@
- templates
- timeperiods
- users
notify: reload icinga2
notify: Reload icinga2
tags: icinga2
- name: copy zones config files
- name: Copy zones config files
ansible.builtin.template:
src: zones.conf.j2
dest: /etc/icinga2/zones.conf
owner: root
group: nagios
mode: 0640
notify: reload icinga2
mode: "0640"
notify: Reload icinga2
tags: icinga2
- name: copy ido config file
- name: Copy ido config file
ansible.builtin.template:
src: ido-db.conf.j2
dest: /etc/icinga2/conf.d/ido-db.conf
owner: root
group: nagios
mode: 0640
notify: restart icinga2
mode: "0640"
notify: Restart icinga2
tags: icinga2
- name: copy api SSL key
- name: Copy api SSL key
ansible.builtin.copy:
content: '{{ icinga2_api_ssl_node_key }}'
dest: '/var/lib/icinga2/certs/{{ inventory_hostname }}.key'
content: "{{ icinga2_api_ssl_node_key }}"
dest: "/var/lib/icinga2/certs/{{ inventory_hostname }}.key"
owner: root
group: nagios
mode: 0640
when: '"api" in icinga2_features'
notify: restart icinga2
mode: "0640"
when: "'api' in icinga2_features"
notify: Restart icinga2
tags: icinga2
- name: copy api SSL certificate
- name: Copy api SSL certificate
ansible.builtin.copy:
content: '{{ icinga2_api_ssl_node_crt }}'
dest: '/var/lib/icinga2/certs/{{ inventory_hostname }}.crt'
content: "{{ icinga2_api_ssl_node_crt }}"
dest: "/var/lib/icinga2/certs/{{ inventory_hostname }}.crt"
owner: root
group: nagios
mode: 0640
when: '"api" in icinga2_features'
notify: restart icinga2
mode: "0640"
when: "'api' in icinga2_features"
notify: Restart icinga2
tags: icinga2
- name: copy api SSL ca certifiacte
- name: Copy api SSL ca certifiacte
ansible.builtin.copy:
content: '{{ icinga2_api_ssl_ca_crt }}'
dest: '{{ item }}/ca.crt'
content: "{{ icinga2_api_ssl_ca_crt }}"
dest: "{{ item }}/ca.crt"
owner: root
group: nagios
mode: 0640
when: '"api" in icinga2_features'
mode: "0640"
when: "'api' in icinga2_features"
loop:
- /var/lib/icinga2/certs
- /etc/icinga2/pki
notify: restart icinga2
notify: Restart icinga2
tags: icinga2
- name: copy api SSL ca key
- name: Copy api SSL ca key
ansible.builtin.copy:
content: '{{ icinga2_api_ssl_ca_key }}'
content: "{{ icinga2_api_ssl_ca_key }}"
dest: /etc/icinga2/pki/ca.key
owner: root
group: nagios
mode: 0640
when: '"api" in icinga2_features and icinga2_master'
notify: restart icinga2
mode: "0640"
when: "'api' in icinga2_features and icinga2_master"
notify: Restart icinga2
tags: icinga2
- name: copy feature config files
- name: Copy feature config files
ansible.builtin.template:
src: feature.conf.j2
dest: '/etc/icinga2/features-available/{{ item.key }}.conf'
dest: "/etc/icinga2/features-available/{{ item.key }}.conf"
owner: root
group: nagios
mode: 0640
loop: '{{ icinga2_features | dict2items }}'
mode: "0640"
loop: "{{ icinga2_features | dict2items }}"
loop_control:
label: '{{ item.key }}'
notify: restart icinga2
label: "{{ item.key }}"
notify: Restart icinga2
tags: icinga2
- name: manage features
- name: Manage features
community.general.icinga2_feature:
name: '{{ item.key }}'
state: '{{ item.state | default("present") }}'
loop: '{{ icinga2_features | dict2items }}'
name: "{{ item.key }}"
state: "{{ item.state | default('present') }}"
loop: "{{ icinga2_features | dict2items }}"
loop_control:
label: '{{ item.key }}'
notify: restart icinga2
label: "{{ item.key }}"
notify: Restart icinga2
tags: icinga2

View file

@ -1,4 +1,7 @@
---
- import_tasks: base.yml
- import_tasks: config.yml
- import_tasks: service.yml
- name: Import base
ansible.builtin.import_tasks: base.yml
- name: Import config
ansible.builtin.import_tasks: config.yml
- name: Import service
ansible.builtin.import_tasks: service.yml

View file

@ -1,5 +1,5 @@
---
- name: enable and start service
- name: Enable and start service
ansible.builtin.service:
name: icinga2
enabled: true