Skip to content
Snippets Groups Projects
Verified Commit 1e393676 authored by Chris Croome's avatar Chris Croome
Browse files

updates

parent 6e1fbadd
No related branches found
No related tags found
No related merge requests found
Pipeline #33158 passed
......@@ -25,7 +25,7 @@ repos:
- templates
# https://github.com/jackdewinter/pymarkdown/releases
- repo: https://github.com/jackdewinter/pymarkdown.git
rev: 0.9.16
rev: v0.9.18
hooks:
- id: pymarkdown
name: Markdown Lint
......@@ -34,14 +34,14 @@ repos:
- README.md
# https://github.com/ansible/ansible-lint/releases
- repo: https://github.com/ansible/ansible-lint.git
rev: v24.2.0
rev: v24.2.2
hooks:
- id: ansible-lint
name: Ansible Lint
language: python
additional_dependencies:
# https://github.com/kellyjonbrazil/jc/releases
- jc==1.25.0
- jc==1.25.2
# https://github.com/jmespath/jmespath.py/tags
- jmespath==1.0.1
...
......@@ -20,12 +20,12 @@
- name: "Ensure that ansible_host is defined for the icinga_master_nodes"
ansible.builtin.assert:
that:
- hostvars[icinga_master_node].ansible_host is defined
- hostvars[icinga_master_node].ansible_host is ansible.utils.ip
- hostvars[icinga_master_node_item].ansible_host is defined
- hostvars[icinga_master_node_item].ansible_host is ansible.utils.ip
quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
loop: "{{ groups['icinga_master_nodes'] }}"
loop_control:
loop_var: icinga_master_node
loop_var: icinga_master_node_item
when:
- groups['icinga_master_nodes'] is defined
- groups['icinga_master_nodes'] | length > 0
......
......@@ -8,7 +8,7 @@ object Host "{{ icinga_host }}" {
vars.agent_endpoint = name
{% endif %}
{% if icinga_remote_node is defined and not icinga_remote_node %}
{% if icinga_remote_node is defined and not icinga_remote_node | bool %}
{% if hostvars[icinga_host]['ansible_system'] is defined %}
vars.os = "{{ hostvars[icinga_host]['ansible_system'] }}"
{% endif %}
......@@ -17,28 +17,32 @@ object Host "{{ icinga_host }}" {
{% endif %}
{% endif %}
{% for check, config in icinga_host_checks.items() %}
vars.checks["{{ check }}"] = {
{% if config.command is defined %}
"command" = "{{ config.command }}",
{% for icinga_check, icinga_config in icinga_host_checks.items() %}
vars.checks["{{ icinga_check }}"] = {
{% if icinga_config.command is defined %}
"command" = "{{ icinga_config.command }}",
{% else %}
"command" = "{{ check }}",
"command" = "{{ icinga_check }}",
{% endif %}
{% if config.remote is defined %}
"remote" = {% if config.remote | bool %}true{% else %}false{% endif %},
{% elif check is regex('^dns|http|ping|ssh$') %}
{% if icinga_config.remote is defined and icinga_config.remote | ansible.builtin.type_debug == "bool" %}
"remote" = {{ icinga_config.remote | lower }},
{% elif icinga_check is regex('^dns|http|ping|ssh$') %}
{# run dns, http, ping and ssh checks from the master #}
"remote" = false,
{% elif config.command is defined and config.command is regex('^dns|http|ping|ssh$') %}
{% elif icinga_config.command is defined and icinga_config.command is regex('^dns|http|ping|ssh$') %}
{# run dns, http, ping and ssh checks from the master #}
"remote" = false,
{% else %}
{# default to running checks on the agent #}
"remote" = true,
{% endif %}
{% if config.args is defined %}
{% for key, value in config.args.items() %}
args["{{ key }}"] = "{{ value }}",
{% if icinga_config.args is defined %}
{% for icinga_config_key, icinga_config_value in icinga_config.args.items() %}
{% if icinga_config_value | ansible.builtin.type_debug == "bool" %}
args["{{ icinga_config_key }}"] = "{{ icinga_config_value | lower }}",
{% else %}
args["{{ icinga_config_key }}"] = "{{ icinga_config_value }}",
{% endif %}
{% endfor %}
{% endif %}
}
......@@ -50,4 +54,4 @@ object Host "{{ icinga_host }}" {
}
# vim: set syntax=icinga2
#{# vim: set syntax=jinja2 #} vim: set syntax=icinga2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment