Getting started¶
Example inventory¶
The debops.icinga
role is not included in the common.yml
playbook and
needs to be activated by adding a host to a specific Ansible inventory group.
The role is designed to be used on all hosts in the cluster, therefore the
easiest way to do this is to include the main DebOps group in the Icinga
inventory group.
[debops_all_hosts]
icinga-master
hostname1
hostname2
[debops_service_icinga:children]
debops_all_hosts
See the Deployment guide documentation for more details about deploying Icinga in DebOps.
Example playbook¶
If you are using this role without DebOps, here's an example Ansible playbook
that uses the debops.icinga
role:
---
- name: Configure Icinga service
collections: [ 'debops.debops', 'debops.roles01',
'debops.roles02', 'debops.roles03' ]
hosts: [ 'debops_service_icinga' ]
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
pre_tasks:
- import_role:
name: 'icinga'
tasks_from: 'main_env'
tags: [ 'role::icinga', 'role::secret' ]
roles:
- role: keyring
tags: [ 'role::keyring', 'skip::keyring', 'role::icinga' ]
keyring__dependent_apt_keys:
- '{{ icinga__keyring__dependent_apt_keys }}'
- role: secret
tags: [ 'role::secret', 'role::icinga' ]
secret__directories:
- '{{ icinga__secret__directories | d([]) }}'
- role: apt_preferences
tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
apt_preferences__dependent_list:
- '{{ icinga__apt_preferences__dependent_list }}'
- role: etc_services
tags: [ 'role::etc_services', 'skip::etc_services' ]
etc_services__dependent_list:
- '{{ icinga__etc_services__dependent_list }}'
- role: unattended_upgrades
tags: [ 'role::unattended_upgrades', 'skip::unattended_upgrades' ]
unattended_upgrades__dependent_origins: '{{ icinga__unattended_upgrades__dependent_origins }}'
- role: ferm
tags: [ 'role::ferm', 'skip::ferm' ]
ferm__dependent_rules:
- '{{ icinga__ferm__dependent_rules }}'
- role: icinga
tags: [ 'role::icinga', 'skip::icinga' ]
Ansible tags¶
You can use Ansible --tags
or --skip-tags
parameters to limit what
tasks are performed during Ansible run. This can be used after a host was first
configured to speed up playbook execution, when you are sure that most of the
configuration is already in the desired state.
Available role tags:
role::icinga
- Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.
role::icinga:register
- This tag can be used to register an Icinga 2 instance in the Icinga Director via the REST API. Already registered nodes are not registered again.