Initial commit
This commit is contained in:
commit
4c9dbfce50
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
|
||||||
|
icinga:
|
||||||
|
build:
|
||||||
|
context: ./image-files
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
- HOST=
|
||||||
|
- MASTERHOST=
|
||||||
|
- MASTERPORT=5665
|
||||||
|
- PARENTZONE=
|
||||||
|
- TICKET=
|
13
image-files/Dockerfile
Normal file
13
image-files/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
RUN apt-get update && apt-get upgrade -y && apt-get install wget gnupg expect -y && \
|
||||||
|
wget -O - https://packages.icinga.com/icinga.key | apt-key add -
|
||||||
|
RUN printf "deb http://packages.icinga.com/ubuntu icinga-bionic main\ndeb-src http://packages.icinga.com/ubuntu icinga-bionic main" > /etc/apt/sources.list.d/icinga2.list && \
|
||||||
|
apt-get update && apt-get install icinga2 -y && \
|
||||||
|
mkdir /run/icinga2 && chown nagios:nagios /run/icinga2 && \
|
||||||
|
mkdir -p /var/lib/icinga2/certs && \
|
||||||
|
chown -R nagios:nagios /var/lib/icinga2/certs
|
||||||
|
|
||||||
|
COPY create-satellite.sh /create-satellite.sh
|
||||||
|
RUN chmod +x /create-satellite.sh
|
||||||
|
|
||||||
|
CMD /create-satellite.sh ; /usr/sbin/icinga2 daemon
|
19
image-files/create-satellite.sh
Executable file
19
image-files/create-satellite.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/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}
|
||||||
|
|
||||||
|
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 \
|
||||||
|
--accept-commands --accept-config \
|
||||||
|
--disable-confd
|
Loading…
x
Reference in New Issue
Block a user