|
@@ -0,0 +1,74 @@
|
|
|
+# This is a systemd file to run this docker container under systemd.
|
|
|
+# To make this work:
|
|
|
+# * pull the image (probably from ops docker registry)
|
|
|
+# * place this file in /etc/systemd/system without the .systemd extension
|
|
|
+# * run the commands:
|
|
|
+# systemctl daemon-reload
|
|
|
+# systemctl enable oso-rhel7-host-monitoring
|
|
|
+# systemctl start oso-rhel7-host-monitoring
|
|
|
+#
|
|
|
+#
|
|
|
+[Unit]
|
|
|
+Description=Openshift Host Monitoring Container
|
|
|
+Requires=docker.service
|
|
|
+After=docker.service
|
|
|
+
|
|
|
+
|
|
|
+[Service]
|
|
|
+Type=simple
|
|
|
+TimeoutStartSec=5m
|
|
|
+Environment=HOME=/etc/docker/ops
|
|
|
+#Slice=container-small.slice
|
|
|
+
|
|
|
+# systemd syntax '=-' ignore errors from return codes.
|
|
|
+ExecStartPre=-/usr/bin/docker kill "{{ osohm_host_monitoring }}"
|
|
|
+ExecStartPre=-/usr/bin/docker rm "{{ osohm_host_monitoring }}"
|
|
|
+ExecStartPre=-/usr/bin/docker pull "{{ osohm_docker_registry_url }}{{ osohm_host_monitoring }}"
|
|
|
+
|
|
|
+# mwoodson note 1-7-16:
|
|
|
+# pcp recommends mounting /run in their Dockerfile
|
|
|
+# /run conflicts with cron which also runs in this container.
|
|
|
+# I am leaving /run out for now. the guys in #pcp said that they mounted /run
|
|
|
+# to shared the pcp socket that is created in /run. We are not using this,
|
|
|
+# as far as I know.
|
|
|
+# This problem goes away with systemd being run in the containers and not using
|
|
|
+# cron but using systemd timers
|
|
|
+# -v /run:/run \
|
|
|
+
|
|
|
+ExecStart=/usr/bin/docker run --name {{ osohm_host_monitoring }} \
|
|
|
+ --privileged \
|
|
|
+ --pid=host \
|
|
|
+ --net=host \
|
|
|
+ --ipc=host \
|
|
|
+ -e ZAGG_URL={{ osohm_zagg_web_url }} \
|
|
|
+ -e ZAGG_USER={{ osohm_default_zagg_server_user }} \
|
|
|
+ -e ZAGG_PASSWORD={{ osohm_default_zagg_server_password }} \
|
|
|
+ -e ZAGG_CLIENT_HOSTNAME={{ ec2_tag_Name }} \
|
|
|
+ -e ZAGG_SSL_VERIFY={{ osohm_zagg_verify_ssl }} \
|
|
|
+ -e OSO_CLUSTER_GROUP={{ cluster_group }} \
|
|
|
+ -e OSO_CLUSTER_ID={{ oo_clusterid }} \
|
|
|
+ -e OSO_HOST_TYPE={{ hostvars[inventory_hostname]['ec2_tag_host-type'] }} \
|
|
|
+ -e OSO_SUB_HOST_TYPE={{ hostvars[inventory_hostname]['ec2_tag_sub-host-type'] }} \
|
|
|
+ -v /etc/localtime:/etc/localtime \
|
|
|
+ -v /sys:/sys:ro \
|
|
|
+ -v /sys/fs/selinux \
|
|
|
+ -v /var/lib/docker:/var/lib/docker:ro \
|
|
|
+ -v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
+ -v /var/run/openvswitch:/var/run/openvswitch \
|
|
|
+{% if hostvars[inventory_hostname]['ec2_tag_host-type'] == 'master' %}
|
|
|
+ -v /etc/openshift/master/admin.kubeconfig:/etc/openshift/master/admin.kubeconfig \
|
|
|
+ -v /etc/openshift/master/master.etcd-client.crt:/etc/openshift/master/master.etcd-client.crt \
|
|
|
+ -v /etc/openshift/master/master.etcd-client.key:/etc/openshift/master/master.etcd-client.key \
|
|
|
+ -v /etc/openshift/master/master-config.yaml:/etc/openshift/master/master-config.yaml \
|
|
|
+{% endif %}
|
|
|
+ {{ osohm_docker_registry_url }}{{ osohm_host_monitoring }}
|
|
|
+
|
|
|
+
|
|
|
+ExecReload=-/usr/bin/docker stop "{{ osohm_host_monitoring }}"
|
|
|
+ExecReload=-/usr/bin/docker rm "{{ osohm_host_monitoring }}"
|
|
|
+ExecStop=-/usr/bin/docker stop "{{ osohm_host_monitoring }}"
|
|
|
+Restart=always
|
|
|
+RestartSec=30
|
|
|
+
|
|
|
+[Install]
|
|
|
+WantedBy=default.target
|