Skip to content

Commit 0983dbe

Browse files
committed
Add JEA installation
1 parent 5a4d42a commit 0983dbe

File tree

5 files changed

+53
-6
lines changed

5 files changed

+53
-6
lines changed

roles/ifw/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Table of contents:
9090
Default: `[]`
9191

9292
- `ifw_icinga2_parents: list of dictionaries`
93-
Here you can specify the parent endpoint(s) of your host's parent zone (O(ifw_icinga2_parent_zone)).
93+
Here you can specify the parent endpoint(s) of your host's parent zone (`ifw_icinga2_parent_zone`).
9494
You can specify each parent's `cn`, its `host` attribute and the `port` on which it listens. The `cn` attribute is **required**.
9595
Default: `none`
9696
Example:
@@ -108,6 +108,17 @@ Table of contents:
108108
The name of your parent(s) zone.
109109
Default: `none`
110110

111+
- `ifw_jea_install: boolean`
112+
Whether to install the Icinga for Windows JEA profile.
113+
If `ifw_jea_managed_user=false`, the JEA will profile will be created and registered.
114+
If `ifw_jea_managed_user=true`, the service user 'icinga' will also be created to run Icinga for Windows as.
115+
[Read more about Icinga for Windows and JEA](https://icinga.com/docs/icinga-for-windows/latest/doc/130-JEA/01-JEA-Profiles/).
116+
Default: `true`
117+
118+
- `ifw_jea_managed_user: boolean`
119+
Whether to use the Icinga for Windows service user 'icinga' when `ifw_jea_install=true`.
120+
Default: `true`
121+
111122
### Getting a Certificate
112123

113124
If neither `ifw_icinga2_ca_host` nor `ifw_icinga2_ticket` is specified, your target host will connect to the first parent in `ifw_icinga2_parents` and file a CSR. This needs to be signed manually afterwards.

roles/ifw/defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ ifw_framework_path:
77
ifw_repositories: []
88

99
ifw_components:
10+
- name: "service"
11+
state: "present"
1012
- name: "plugins"
1113
state: "present"
1214
- name: "agent"
@@ -18,3 +20,6 @@ ifw_force_newcert: false
1820
ifw_icinga2_cn: "{{ inventory_hostname }}"
1921
ifw_icinga2_port: 5665
2022
ifw_icinga2_global_zones: []
23+
24+
ifw_jea_install: true
25+
ifw_jea_managed_user: true

roles/ifw/meta/argument_specs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ argument_specs:
6464
elements: dict
6565
required: false
6666
default:
67+
- name: "service"
68+
state: "present"
6769
- name: "plugins"
6870
state: "present"
6971
- name: "agent"
@@ -163,3 +165,18 @@ argument_specs:
163165
- The name of the Icinga 2 parent(s) zone.
164166
- *icinga2_requirements
165167
type: list
168+
ifw_jea_install:
169+
description:
170+
- Whether to install the Icinga for Windows JEA profile.
171+
If O(ifw_jea_managed_user=false), the JEA will profile will be created and registered.
172+
If O(ifw_jea_managed_user=true), the service user 'icinga' will also be created to run Icinga for Windows as.
173+
L(Read more about Icinga for Windows and JEA, https://icinga.com/docs/icinga-for-windows/latest/doc/130-JEA/01-JEA-Profiles/).
174+
type: bool
175+
required: false
176+
default: true
177+
ifw_jea_managed_user:
178+
description:
179+
- Whether to use the Icinga for Windows service user 'icinga' when O(ifw_jea_install=true).
180+
type: bool
181+
required: false
182+
default: true

roles/ifw/tasks/configure_icinga2.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@
101101
ansible.builtin.set_fact:
102102
_current_ca_server: "{{ _framework_config_live['IfW-CAServer']['Values'][0] | default(none) }}"
103103
_current_global_zones: "{{ _framework_config_live['IfW-CustomZones']['Values'] }}"
104+
_current_cn: "{{ _framework_config_live['IfW-CustomHostname']['Values'][0] }}"
104105
_current_port: "{{ _framework_config_live['IfW-Port']['Values'][0] | default(none) }}"
105106
_current_parent_zone: "{{ _framework_config_live['IfW-ParentZone']['Values'][0] | default(none) }}"
106107
_current_parents: "{{ _framework_config_live['IfW-ParentNodes']['Values'] }}"
107108
_current_parents0: "{{ _framework_config_live['IfW-ParentAddress:' + ifw_icinga2_parents[0].cn]['Values'][0] | default(none) }}"
108109
_current_parents1: "{{ (_framework_config_live['IfW-ParentAddress:' + ifw_icinga2_parents[1].cn]['Values'][0] if ifw_icinga2_parents | length > 1 else none) | default(none) }}" # noqa: yaml[line-length]
110+
_current_jea: "{{ _framework_config_live['IfW-InstallJEAProfile']['Selection'] }}"
109111

110112
- name: Check whether requested and existing configuration is identical
111113
failed_when: false
@@ -118,11 +120,15 @@
118120
- (_current_icinga_configuration.content | b64decode | from_json).Framework.Config.Live is defined
119121
- (_current_ca_server | default(true, true)) == (_ifw_ca_server)
120122
- _current_global_zones == ifw_icinga2_global_zones
123+
- _current_cn == ifw_icinga2_cn
121124
- (_current_port | int) == (ifw_icinga2_port | int)
122125
- _current_parent_zone == ifw_icinga2_parent_zone
123126
- _current_parents == (ifw_icinga2_parents | map(attribute='cn'))
124127
- _current_parents0 == _parent0
125128
- (_current_parents1 == _parent1 if ifw_icinga2_parents | length > 1 else true)
129+
- (_current_jea == "0" if (ifw_jea_install and not ifw_jea_managed_user) else true)
130+
- (_current_jea == "1" if (ifw_jea_install and ifw_jea_managed_user) else true)
131+
- (_current_jea == "2" if not ifw_jea_install else true)
126132
fail_msg: "Configuration needs an update"
127133
success_msg: "Configuration needs no update"
128134
register: _assertion_result

roles/ifw/templates/windows/icinga_install_command.j2

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,18 @@
9494
{# 0 -> Don't install IfW Api Check Forwarder #}
9595
"Selection": "0"
9696
},
97-
"IfW-AgentUser": {
98-
{# TODO WIP - Define user to run service as #}
99-
"Values": [
100-
"NT Authority\\NetworkService"
101-
]
97+
"IfW-InstallJEAProfile": {
98+
{% if ifw_jea_install %}
99+
{% if not ifw_jea_managed_user %}
100+
{# 0 Install JEA Profile #}
101+
"Selection": "0"
102+
{% else %}
103+
{# 1 Install JEA Profile with managed user "icinga" #}
104+
"Selection": "1"
105+
{% endif %}
106+
{% else %}
107+
{# 2 Do not install JEA Profile #}
108+
"Selection": "2"
109+
{% endif %}
102110
}
103111
}

0 commit comments

Comments
 (0)