Skip to content

Commit

Permalink
lint complete collection (#67)
Browse files Browse the repository at this point in the history
* lint complete collection, except var-naming[no-role-prefix] and args[module]
  • Loading branch information
beechesII authored Jan 2, 2024
1 parent 611bcc0 commit 092733c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
1 change: 0 additions & 1 deletion .config/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ exclude_paths:
offline: false

warn_list:
- fqcn[keyword]
- var-naming[no-role-prefix]
- args[module]
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This Ansible collection contains:
1. A [role](roles/icinga_agent) to manage the Installation for your Icinga agents

2. A [role](roles/icinga_plugins) to deploy your custom check scripts to your Icinga agents

3. A [role](roles/icinga_downtime) to manage downtimes in your Icinga

3. The [collection](https://github.com/telekom-mms/ansible-collection-icinga-director) to deploy your Icinga master via the Icinga Director module
Expand Down Expand Up @@ -60,26 +60,26 @@ Check out the 'Documentation' part for this collection [here](https://github.com
| mms_standard.yml | create a timeperiod and service template to use for other checks | -
| azure_oauth_token.yml | get azure oauth token to use in other checks | [azure_oauth_token.py](https://gist.github.com/rndmh3ro/e9abbca17a4d39597443176f99d585ae) needs to exist in the [PluginDir](https://icinga.com/docs/icinga-2/latest/doc/04-configuration/#constants-conf) on your Icinga Server or Agent
| check_gitlab_scheduler.yml | check gitlab scheduled pipelines | [check_gitlab_scheduler](https://github.com/telekom-mms/check_gitlab_scheduler/) needs to exist in the [PluginDir](https://icinga.com/docs/icinga-2/latest/doc/04-configuration/#constants-conf) on your Icinga Server or Agent
| check_https.yml | check https reachability and certificates | -
| check_https.yml | check https reachability and certificates | -
| check_json_azure_restapi_resourcehealth.yml | check state of azure resourcehealth | [check_json.pl](https://github.com/c-kr/check_json) needs to exist in the [PluginDir](https://icinga.com/docs/icinga-2/latest/doc/04-configuration/#constants-conf) on your Icinga Server or Agent
| check_json_azure_restapi.yml | do a json check against azure restapi (with oauth_token) | [check_json.pl](https://github.com/c-kr/check_json) needs to exist in the [PluginDir](https://icinga.com/docs/icinga-2/latest/doc/04-configuration/#constants-conf) on your Icinga Server or Agent
| check_json.yml | do a json check | [check_json.pl](https://github.com/c-kr/check_json) needs to exist in the [PluginDir](https://icinga.com/docs/icinga-2/latest/doc/04-configuration/#constants-conf) on your Icinga Server or Agent
| template_empty_host.yml | create a host template for an empty host | -
| template_empty_host.yml | create a host template for an empty host | -

You can use these playbooks in your playbook like this:

```
- name: Import mms standard playbook to create services that other checks depend on
import-playbook: telekom_mms.ansible_collection_icinga.mms_standard
ansible.builtin.import_playbook: telekom_mms.ansible_collection_icinga.mms_standard
- name: Import playbook to create azure oauth token check
import-playbook: telekom_mms.ansible_collection_icinga.check_azure_oauth_token
ansible.builtin.import_playbook: telekom_mms.ansible_collection_icinga.check_azure_oauth_token
- name: Import playbook to create gitlab_scheduler check
import-playbook: telekom_mms.ansible_collection_icinga.check_gitlab_scheduler
ansible.builtin.import_playbook: telekom_mms.ansible_collection_icinga.check_gitlab_scheduler
- name: Import playbook to create check_https checks
import-playbook: telekom_mms.ansible_collection_icinga.check_https
ansible.builtin.import_playbook: telekom_mms.ansible_collection_icinga.check_https
```

Expand Down
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
- name: telekom_mms.icinga_director
version: 1.35.0
4 changes: 2 additions & 2 deletions roles/icinga_agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- name: Create /etc/icinga2/repository.d
ansible.builtin.file:
dest: /etc/icinga2/repository.d
path: /etc/icinga2/repository.d
mode: "0750"
owner: "{{ icinga2_user[ansible_os_family] }}"
group: "{{ icinga2_group[ansible_os_family] }}"
Expand Down Expand Up @@ -71,7 +71,7 @@
src: ../features-available/{{ item }}
dest: /etc/icinga2/features-enabled/{{ item }}
state: link
with_items:
loop:
- "{{ icinga_agent_enable_features }}"
when:
- icinga_agent_enable_features is defined
Expand Down
18 changes: 9 additions & 9 deletions roles/icinga_downtime/tasks/add_downtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- name: Add icinga host downtimes
ansible.builtin.uri:
url: "{{ icinga_api_uri }}:{{ icinga_api_port }}/v1/actions/schedule-downtime?type=Host"
user: "{{ icinga_api_user }}"
password: "{{ icinga_api_password }}"
url_username: "{{ icinga_api_user }}"
url_password: "{{ icinga_api_password }}"
validate_certs: true
method: POST
status_code: 200
Expand All @@ -20,16 +20,16 @@
"pretty": true,
"fixed": true,
}'
with_items:
loop:
- "{{ icinga_host_filter }}"
when:
- host_downtime

- name: Add icinga service downtimes
ansible.builtin.uri:
url: "{{ icinga_api_uri }}:{{ icinga_api_port }}/v1/actions/schedule-downtime?type=Service"
user: "{{ icinga_api_user }}"
password: "{{ icinga_api_password }}"
url_username: "{{ icinga_api_user }}"
url_password: "{{ icinga_api_password }}"
validate_certs: true
method: POST
status_code: 200
Expand All @@ -47,7 +47,7 @@
"fixed": true,
}'
delegate_to: localhost
with_items:
loop:
- "{{ icinga_host_filter }}"
when:
- service_downtime
Expand All @@ -56,8 +56,8 @@
- name: Add icinga single service downtimes
ansible.builtin.uri:
url: "{{ icinga_api_uri }}:{{ icinga_api_port }}/v1/actions/schedule-downtime?type=Service"
user: "{{ icinga_api_user }}"
password: "{{ icinga_api_password }}"
url_username: "{{ icinga_api_user }}"
url_password: "{{ icinga_api_password }}"
validate_certs: true
method: POST
status_code: 200
Expand All @@ -75,7 +75,7 @@
"fixed": true,
}'
delegate_to: localhost
with_items:
loop:
- "{{ icinga_host_filter }}"
when:
- single_service_downtime
Expand Down
9 changes: 6 additions & 3 deletions roles/icinga_downtime/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
- not single_host_downtime

- name: Include add_downtimes
ansible.builtin.include_tasks: add_downtimes.yml
ansible.builtin.include_tasks:
file: add_downtimes.yml
when:
- icinga_action == "add_downtimes"

- name: Include remove_downtimes
ansible.builtin.include_tasks: remove_downtimes.yml
ansible.builtin.include_tasks:
file: remove_downtimes.yml
when:
- icinga_action == "remove_downtimes"

- name: Include remove_all_downtimes
ansible.builtin.include_tasks: remove_all_downtimes.yml
ansible.builtin.include_tasks:
file: remove_all_downtimes.yml
when:
- icinga_action == "remove_all_downtimes"
4 changes: 2 additions & 2 deletions roles/icinga_downtime/tasks/remove_all_downtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- name: Delete all icinga downtimes (host and service)
ansible.builtin.uri:
url: "{{ icinga_api_uri }}:{{ icinga_api_port }}/v1/actions/remove-downtime?type=Downtime"
user: "{{ icinga_api_user }}"
password: "{{ icinga_api_password }}"
url_username: "{{ icinga_api_user }}"
url_password: "{{ icinga_api_password }}"
validate_certs: true
method: POST
status_code: 200
Expand Down
6 changes: 3 additions & 3 deletions roles/icinga_downtime/tasks/remove_downtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- name: Delete icinga downtimes (host and service) from defined author
ansible.builtin.uri:
url: "{{ icinga_api_uri }}:{{ icinga_api_port }}/v1/actions/remove-downtime?type=Downtime"
user: "{{ icinga_api_user }}"
password: "{{ icinga_api_password }}"
url_username: "{{ icinga_api_user }}"
url_password: "{{ icinga_api_password }}"
validate_certs: true
method: POST
status_code: 200
Expand All @@ -13,5 +13,5 @@
body_format: json
body: '{ "filter": "host.name==\"{{ item }}\" && downtime.author==\"{{ author }}\"", "pretty": true }'
delegate_to: localhost
with_items:
loop:
- "{{ icinga_host_filter }}"
2 changes: 1 addition & 1 deletion roles/icinga_plugins/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# https://github.com/Icinga/icinga2/issues/7927
- name: Install icinga and nagios plugins except for the mysql-plugins on el8
ansible.builtin.package:
ansible.builtin.yum:
name: "{{ item }}"
exclude:
- nagios-plugins-all
Expand Down

0 comments on commit 092733c

Please sign in to comment.