Skip to content

Commit

Permalink
Merge pull request #222 from Icinga/feature/ticket-salt
Browse files Browse the repository at this point in the history
Adds possibility to delegate ticket creation to satellites
  • Loading branch information
mocdaniel authored Dec 7, 2023
2 parents 43c3880 + 0a1ef95 commit 1d45229
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/feature_add_satellite_delegation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- Added possibility to delegate ticket creation to satellites
15 changes: 13 additions & 2 deletions doc/role-icinga2/features/feature-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,24 @@ Create Signing Request to get a certificate managed by the parameter `ca_host` a
set to the master/server hostname, FQDN or IP, the node setup tries to connect
via API an retrieve the trusted certificate.

> **_NOTE:_** Ansible will delegate the ticket creation to the CA host. You can change this behaviour by setting 'icinga2_delegate_host' to match another Ansible alias.
> [!INFO]
> Ansible will delegate the ticket creation to the CA host. You can change this behaviour by setting 'icinga2_delegate_host' to match another Ansible alias.
```
```yaml
ca_host: icinga-server.localdomain
ca_host_port: 5665
```
> [!INFO]
> In case your agent can't connect to the CA host, you can use the variables `icinga2_delegate_host`
> and `ticket_salt` to delegate ticket creation to one of your satellites instead.

```yaml
ca_host: icinga-server.localdomain
icinga2_delegate_host: icinga-satellite.localdomain
ticket_salt: "{{ icinga2_constants.ticket_salt }}"
```

By default the FQDN is used as certificate common name, to put a name
yourself:

Expand Down
3 changes: 2 additions & 1 deletion roles/icinga2/tasks/features/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
icinga2_ssl_cert: "{{ icinga2_dict_features.api.ssl_cert | default(omit) }}"
icinga2_ssl_cacert: "{{ icinga2_dict_features.api.ssl_cacert | default(omit) }}"
icinga2_ssl_key: "{{ icinga2_dict_features.api.ssl_key | default(omit) }}"
icinga2_ticket_salt: "{{ icinga2_dict_features.api.ticket_salt | default(omit) }}"

- assert:
that: ((icinga2_ssl_cacert is defined and icinga2_ssl_cert is defined and icinga2_ssl_key is defined) or (icinga2_ssl_cacert is undefined and icinga2_ssl_cert is undefined and icinga2_ssl_key is undefined and icinga2_ca_host is defined))
Expand Down Expand Up @@ -135,7 +136,7 @@
{% if icinga2_ca_host != 'none' %} --cert "{{ icinga2_cert_path }}/{{ icinga2_cert_name }}.crt" {% else %} --csr "{{ icinga2_cert_path }}/{{ icinga2_cert_name }}.csr" {%- endif %}
- name: delegate ticket request to master
shell: icinga2 pki ticket --cn "{{ icinga2_cert_name }}"
shell: icinga2 pki ticket --cn "{{ icinga2_cert_name }}{% if icinga2_ticket_salt is defined %} --salt {{ icinga2_ticket_salt }}{% endif %}}"
delegate_to: "{{ icinga2_delegate_host | default(icinga2_ca_host) }}"
register: icinga2_ticket
when: icinga2_ca_host != 'none'
Expand Down

0 comments on commit 1d45229

Please sign in to comment.