More (and better) variables
This commit is contained in:
parent
4c9dbfce50
commit
6b24c3daac
@ -6,8 +6,9 @@ services:
|
||||
context: ./image-files
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
- HOST=
|
||||
- MASTERHOST=
|
||||
- MASTERPORT=5665
|
||||
- CN=
|
||||
- ZONE=
|
||||
- PARENTHOST=
|
||||
- PARENTCN=
|
||||
- PARENTZONE=
|
||||
- TICKET=
|
||||
|
@ -1,19 +1,37 @@
|
||||
#!/bin/bash
|
||||
icinga2 pki new-cert --cn $HOST \
|
||||
--key /var/lib/icinga2/certs/${HOST}.key \
|
||||
--cert /var/lib/icinga2/certs/${HOST}.crt
|
||||
|
||||
icinga2 pki save-cert --key /var/lib/icinga2/certs/${HOST}.key \
|
||||
--cert /var/lib/icinga2/certs/${HOST}.crt \
|
||||
--trustedcert /var/lib/icinga2/certs/${MASTERHOST}.crt \
|
||||
--host ${MASTERHOST}
|
||||
# If parent cn is not specified, default it to the parent host.
|
||||
# If the zone if not specified, default it to the cn of the satellite/agent.
|
||||
# Use the default port if none is specified.
|
||||
|
||||
icinga2 node setup --ticket $TICKET \
|
||||
--cn $HOST \
|
||||
--endpoint ${MASTERHOST},${MASTERHOST},${MASTERPORT} \
|
||||
--zone $HOST \
|
||||
--parent_zone $PARENTZONE \
|
||||
--parent_host $MASTERHOST \
|
||||
--trustedcert /var/lib/icinga2/certs/${MASTERHOST}.crt \
|
||||
if [ -z "$PARENTCN" ]; then
|
||||
PARENTCN="$PARENTHOST"
|
||||
fi
|
||||
|
||||
if [ -z "$ZONE" ]; then
|
||||
ZONE="$CN"
|
||||
fi
|
||||
|
||||
if [ -z "$PARENTPORT" ]; then
|
||||
PARENTPORT=5665
|
||||
fi
|
||||
|
||||
|
||||
icinga2 pki new-cert --cn "$CN" \
|
||||
--key /var/lib/icinga2/certs/"${CN}".key \
|
||||
--cert /var/lib/icinga2/certs/"${CN}".crt
|
||||
|
||||
icinga2 pki save-cert --key /var/lib/icinga2/certs/"${CN}".key \
|
||||
--cert /var/lib/icinga2/certs/"${CN}".crt \
|
||||
--trustedcert /var/lib/icinga2/certs/"${PARENTCN}".crt \
|
||||
--host "${PARENTHOST}"
|
||||
|
||||
icinga2 node setup --ticket "$TICKET" \
|
||||
--cn "$CN" \
|
||||
--endpoint "${PARENTCN}","${PARENTHOST}","${PARENTPORT}" \
|
||||
--zone "$ZONE" \
|
||||
--parent_zone "$PARENTZONE" \
|
||||
--parent_host "$PARENTHOST" \
|
||||
--trustedcert /var/lib/icinga2/certs/"${PARENTCN}".crt \
|
||||
--accept-commands --accept-config \
|
||||
--disable-confd
|
||||
|
Loading…
x
Reference in New Issue
Block a user