From 1f7c1c62c039b76c9a95532622785a4b4be67ce8 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Mon, 27 Jul 2015 09:30:05 -0400 Subject: Ansible deploy for our monitoring containers --- .../adhoc/deploy_monitoring_containers/deploy.yml | 58 ++++++++++++++++++++++ .../oso-f22-host-monitoring.service | 36 ++++++++++++++ .../oso-rhel7-zagg-client.service | 39 +++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 playbooks/adhoc/deploy_monitoring_containers/deploy.yml create mode 100644 playbooks/adhoc/deploy_monitoring_containers/oso-f22-host-monitoring.service create mode 100644 playbooks/adhoc/deploy_monitoring_containers/oso-rhel7-zagg-client.service (limited to 'playbooks') diff --git a/playbooks/adhoc/deploy_monitoring_containers/deploy.yml b/playbooks/adhoc/deploy_monitoring_containers/deploy.yml new file mode 100644 index 000000000..44df693d5 --- /dev/null +++ b/playbooks/adhoc/deploy_monitoring_containers/deploy.yml @@ -0,0 +1,58 @@ +--- +- name: Setup hosts + hosts: localhost + gather_facts: no + user: root + tasks: + - name: build inven + add_host: "name={{ hostvars[item]['ec2_public_dns_name'] }} groups=oo_hosts" + with_items: groups['tag_env-host-type_kwoodsontest2-openshift-node'] + + - debug: msg=oo_hosts + +- name: Deploy host-monitoring + hosts: oo_hosts + user: root + tasks: + - name: Deploy docker oso-f22-host-monitoring + command: docker pull docker-registry.ops.rhcloud.com/ops/oso-f22-host-monitoring + + - name: Deploy oso-rhel7-zagg-client + command: docker pull docker-registry.ops.rhcloud.com/ops/oso-rhel7-zagg-client + + - name: Copy oso-f22-host-monitoring systemd file + copy: + src: oso-f22-host-monitoring.service + dest: /etc/systemd/system/oso-f22-host-monitoring.service + owner: root + group: root + mode: 0644 + register: pcp_systemd + + - name: Copy zagg-client systemd file + copy: + src: oso-rhel7-zagg-client.service + dest: /etc/systemd/system/oso-rhel7-zagg-client.service + owner: root + group: root + mode: 0644 + register: zagg_systemd + + - name: reload systemd + command: /usr/bin/systemctl --system daemon-reload + when: pcp_systemd.changed or zagg_systemd.changed + + - name: pasue for a few seconds + pause: seconds=5 + + - name: Start the oso-f22-host-monitoring service + service: + name: oso-f22-host-monitoring + state: started + enabled: yes + + - name: Start the oso-rhel7-zagg-client service + service: + name: oso-rhel7-zagg-client + state: started + enabled: yes diff --git a/playbooks/adhoc/deploy_monitoring_containers/oso-f22-host-monitoring.service b/playbooks/adhoc/deploy_monitoring_containers/oso-f22-host-monitoring.service new file mode 100644 index 000000000..852be09b6 --- /dev/null +++ b/playbooks/adhoc/deploy_monitoring_containers/oso-f22-host-monitoring.service @@ -0,0 +1,36 @@ +# 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 pcp-docker +# systemctl start pcp-docker +# +# +[Unit] +Description=PCP Collector Contatainer +Requires=docker.service +After=docker.service + + +[Service] +Type=simple +TimeoutStartSec=5m +#Slice=container-small.slice + +ExecStartPre=-/usr/bin/docker rm "oso-f22-host-monitoring" + +ExecStart=/usr/bin/docker run --rm --name=oso-f22-host-monitoring \ + --privileged --net=host --pid=host --ipc=host \ + -v /sys:/sys:ro -v /etc/localtime:/etc/localtime:ro \ + -v /var/lib/docker:/var/lib/docker:ro -v /run:/run \ + -v /var/log:/var/log \ + docker-registry.ops.rhcloud.com/ops/oso-f22-host-monitoring + +ExecReload=-/usr/bin/docker stop "oso-f22-host-monitoring" +ExecReload=-/usr/bin/docker rm "oso-f22-host-monitoring" +ExecStop=-/usr/bin/docker stop "oso-f22-host-monitoring" + +[Install] +WantedBy=default.target diff --git a/playbooks/adhoc/deploy_monitoring_containers/oso-rhel7-zagg-client.service b/playbooks/adhoc/deploy_monitoring_containers/oso-rhel7-zagg-client.service new file mode 100644 index 000000000..381c7b487 --- /dev/null +++ b/playbooks/adhoc/deploy_monitoring_containers/oso-rhel7-zagg-client.service @@ -0,0 +1,39 @@ +# 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 zagg-client-docker +# systemctl start zagg-client-docker +# +# +[Unit] +Description=Zagg Client Contatainer +Requires=docker.service +After=docker.service + + +[Service] +Type=simple +TimeoutStartSec=5m +#Slice=container-small.slice + +ExecStartPre=-/usr/bin/docker rm "oso-rhel7-zagg-client" + + +ExecStart=/usr/bin/docker run --name oso-rhel7-zagg-client \ + -e ZAGG_SERVER=SERVERNAME \ + -e ZAGG_USER=USERNAME \ + -e ZAGG_PASSWORD=PASSWORD \ + -v /etc/localtime:/etc/localtime \ + -v /run/pcp:/run/pcp \ + docker-registry.ops.rhcloud.com/ops/oso-rhel7-zagg-client + + +ExecReload=-/usr/bin/docker stop "oso-rhel7-zagg-client" +ExecReload=-/usr/bin/docker rm "oso-rhel7-zagg-client" +ExecStop=-/usr/bin/docker stop "oso-rhel7-zagg-client" + +[Install] +WantedBy=default.target -- cgit v1.2.3 From 8bdaac7f60a5826b8e8518a6f8ded737bd713f82 Mon Sep 17 00:00:00 2001 From: Wesley Hearn Date: Mon, 27 Jul 2015 16:26:17 -0400 Subject: Setup openshift-node on the masters so that the web console can access the pods --- playbooks/aws/openshift-cluster/config.yml | 1 + playbooks/common/openshift-cluster/config.yml | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'playbooks') diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml index 6ee539c7e..8106d5da9 100644 --- a/playbooks/aws/openshift-cluster/config.yml +++ b/playbooks/aws/openshift-cluster/config.yml @@ -15,6 +15,7 @@ g_nodes_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-node' }}" g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}" g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}" + g_nodeonmaster: true openshift_cluster_id: "{{ cluster_id }}" openshift_debug_level: 4 openshift_deployment_type: "{{ deployment_type }}" diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml index 0779cfe47..4c74f96db 100644 --- a/playbooks/common/openshift-cluster/config.yml +++ b/playbooks/common/openshift-cluster/config.yml @@ -39,6 +39,15 @@ ansible_sudo: "{{ g_sudo | default(omit) }}" with_items: groups[g_nodes_group] | default([]) + - name: Evaluate oo_nodes_to_config + add_host: + name: "{{ item }}" + groups: oo_nodes_to_config + ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" + ansible_sudo: "{{ g_sudo | default(omit) }}" + with_items: groups[g_masters_group] | default([]) + when: g_nodeonmaster is defined and g_nodeonmaster == true + - name: Evaluate oo_first_etcd add_host: name: "{{ groups[g_etcd_group][0] }}" -- cgit v1.2.3