diff options
author | Jan Dittberner <jandd@cacert.org> | 2019-07-20 20:32:56 +0200 |
---|---|---|
committer | Jan Dittberner <jandd@cacert.org> | 2019-07-20 20:32:56 +0200 |
commit | 1fff654ff96ce0b0ebef22d8c6dd48180316a932 (patch) | |
tree | 075fa3a356e7bc0429bcfcf9dcad6df82551516c /sitemodules/profiles/templates | |
parent | e9c6dd7e0aa1a5646a69e8796675556cad987d25 (diff) | |
download | cacert-puppet-1fff654ff96ce0b0ebef22d8c6dd48180316a932.tar.gz cacert-puppet-1fff654ff96ce0b0ebef22d8c6dd48180316a932.tar.xz cacert-puppet-1fff654ff96ce0b0ebef22d8c6dd48180316a932.zip |
Add icinga2_agent node setup script
- generate /var/lib/icinga2/setup_agent.sh from template
- execute script if setup has not been run before
Diffstat (limited to 'sitemodules/profiles/templates')
-rw-r--r-- | sitemodules/profiles/templates/icinga2_agent/setup_agent.sh.epp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sitemodules/profiles/templates/icinga2_agent/setup_agent.sh.epp b/sitemodules/profiles/templates/icinga2_agent/setup_agent.sh.epp new file mode 100644 index 0000000..e6249a7 --- /dev/null +++ b/sitemodules/profiles/templates/icinga2_agent/setup_agent.sh.epp @@ -0,0 +1,18 @@ +<%-| String $pki_api_user, + String $pki_api_password, + String $master_host, + String $master_ip +|-%> +#!/bin/sh + +TICKET=$(curl -s --cacert /etc/icinga2/pki/ca.crt -u "<%= $pki_api_user %>:<%= $pki_api_password %>" -H "Accept: application/json" --resolve "<%= $master_host %>:5665:<%= $master_ip %>" "https://<%= $master_host %>:5665/v1/actions/generate_ticket" --data '{ "cn": "<%= $::facts["fqdn"] %>" }') + +icinga2 node setup --ticket "${TICKET}" \ +--cn "<%= $::facts["fqdn"] %>" \ +--endpoint "<%= $master_host %>,<%= $master_ip %>,5665" \ +--zone "<%= $::facts["fqdn"] %>" \ +--parent_zone "<%= $master_host %>" \ +--parent_host "<%= $master_host %>" \ +--trustedcert "/etc/icinga2/pki/ca.crt" \ +--accept-commands \ +--disable-confd |