summaryrefslogtreecommitdiffstats
path: root/roles/atomic_proxy
diff options
context:
space:
mode:
Diffstat (limited to 'roles/atomic_proxy')
-rw-r--r--roles/atomic_proxy/handlers/main.yml3
-rw-r--r--roles/atomic_proxy/tasks/main.yml20
-rw-r--r--roles/atomic_proxy/tasks/setup_containers.yml57
-rw-r--r--roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2 (renamed from roles/atomic_proxy/files/ctr-proxy-1.service)9
-rw-r--r--roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2 (renamed from roles/atomic_proxy/files/ctr-proxy-monitoring-1.service)13
-rw-r--r--roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2 (renamed from roles/atomic_proxy/files/ctr-proxy-puppet-1.service)10
6 files changed, 71 insertions, 41 deletions
diff --git a/roles/atomic_proxy/handlers/main.yml b/roles/atomic_proxy/handlers/main.yml
index 8de31258f..8eedec17a 100644
--- a/roles/atomic_proxy/handlers/main.yml
+++ b/roles/atomic_proxy/handlers/main.yml
@@ -1,2 +1,3 @@
---
-# handlers file for atomic_proxy
+- name: reload systemd
+ command: systemctl daemon-reload
diff --git a/roles/atomic_proxy/tasks/main.yml b/roles/atomic_proxy/tasks/main.yml
index d5a5a0a47..073a1c61e 100644
--- a/roles/atomic_proxy/tasks/main.yml
+++ b/roles/atomic_proxy/tasks/main.yml
@@ -1,21 +1,3 @@
---
-- name: upload sbin scripts
- copy: >
- src={{ item }}
- dest=/usr/local/sbin/{{ item }}
- mode=0750
- with_items:
- - setup-proxy-containers.sh
-
-- name: upload /usr/local/etc files
- copy: >
- src={{ item }}
- dest=/usr/local/etc/{{ item }}
- mode=0640
- with_items:
- - proxy_containers_deploy_descriptor.json
- - ctr-proxy-1.service
- - ctr-proxy-puppet-1.service
- - ctr-proxy-monitoring-1.service
-
- include: setup_puppet.yml
+- include: setup_containers.yml
diff --git a/roles/atomic_proxy/tasks/setup_containers.yml b/roles/atomic_proxy/tasks/setup_containers.yml
new file mode 100644
index 000000000..63c385afe
--- /dev/null
+++ b/roles/atomic_proxy/tasks/setup_containers.yml
@@ -0,0 +1,57 @@
+---
+- name: get output of: docker images
+ command: docker images
+ changed_when: False # don't report as changed
+ register: docker_images
+
+- name: docker pull busybox ONLY if it's not present
+ command: "docker pull busybox:latest"
+ when: "not docker_images.stdout | search('busybox.*latest')"
+
+- name: docker pull containers ONLY if they're not present (needed otherwise systemd will timeout pulling the containers)
+ command: "docker pull docker-registry.ops.rhcloud.com/{{ item }}:{{ oo_env }}"
+ with_items:
+ - oso-v2-proxy
+ - oso-v2-puppet
+ - oso-v2-monitoring
+ when: "not docker_images.stdout | search('docker-registry.ops.rhcloud.com/{{ item }}.*{{ oo_env }}')"
+
+- name: get output of: docker ps -a
+ command: docker ps -a
+ changed_when: False # don't report as changed
+ register: docker_ps
+
+- name: run proxy-shared-data-1
+ command: /usr/bin/docker run --name "proxy-shared-data-1" \
+ -v /shared/etc/haproxy \
+ -v /shared/etc/httpd \
+ -v /shared/etc/openshift \
+ -v /shared/etc/pki \
+ -v /shared/var/run/ctr-ipc \
+ -v /shared/var/lib/haproxy \
+ -v /shared/usr/local \
+ "busybox:latest" true
+ when: "not docker_ps.stdout | search('proxy-shared-data-1')"
+
+- name: Deploy systemd files for containers
+ template:
+ src: "systemd/{{ item }}.j2"
+ dest: "/etc/systemd/system/{{ item }}"
+ mode: 0640
+ owner: root
+ group: root
+ with_items:
+ - ctr-proxy-1.service
+ - ctr-proxy-monitoring-1.service
+ - ctr-proxy-puppet-1.service
+ notify: reload systemd
+
+- name: start containers
+ service:
+ name: "{{ item }}"
+ state: started
+ enabled: yes
+ with_items:
+ - ctr-proxy-puppet-1
+ - ctr-proxy-1
+ - ctr-proxy-monitoring-1
diff --git a/roles/atomic_proxy/files/ctr-proxy-1.service b/roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2
index c532eb8e8..988a9f544 100644
--- a/roles/atomic_proxy/files/ctr-proxy-1.service
+++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2
@@ -1,5 +1,3 @@
-
-
[Unit]
Description=Container proxy-1
@@ -14,9 +12,8 @@ ExecStartPre=-/usr/bin/docker rm "proxy-1"
ExecStart=/usr/bin/docker run --rm --name "proxy-1" \
--volumes-from proxy-shared-data-1 \
-a stdout -a stderr -p 80:80 -p 443:443 -p 4999:4999 \
- "proxy:latest"
+ "docker-registry.ops.rhcloud.com/oso-v2-proxy:{{ oo_env }}"
-ExecStartPost=-/usr/bin/gear init --post "proxy-1" "proxy:latest"
ExecReload=-/usr/bin/docker stop "proxy-1"
ExecReload=-/usr/bin/docker rm "proxy-1"
ExecStop=-/usr/bin/docker stop "proxy-1"
@@ -26,12 +23,10 @@ WantedBy=container.target
# Container information
X-ContainerId=proxy-1
-X-ContainerImage=proxy:latest
+X-ContainerImage=docker-registry.ops.rhcloud.com/oso-v2-proxy:{{ oo_env }}
X-ContainerUserId=
X-ContainerRequestId=LwiWtYWaAvSavH6Ze53QJg
X-ContainerType=simple
X-PortMapping=80:80
X-PortMapping=443:443
X-PortMapping=4999:4999
-
-
diff --git a/roles/atomic_proxy/files/ctr-proxy-monitoring-1.service b/roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2
index 7a91ea02c..975b0061b 100644
--- a/roles/atomic_proxy/files/ctr-proxy-monitoring-1.service
+++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2
@@ -1,5 +1,3 @@
-
-
[Unit]
Description=Container proxy-monitoring-1
@@ -14,9 +12,12 @@ ExecStartPre=-/usr/bin/docker rm "proxy-monitoring-1"
ExecStart=/usr/bin/docker run --rm --name "proxy-monitoring-1" \
--volumes-from proxy-shared-data-1 \
-a stdout -a stderr \
- "monitoring:latest"
+ -e "OO_ENV={{ oo_env }}" \
+ -e "OO_CTR_TYPE=proxy" \
+ -e "OO_ZABBIX_HOSTGROUPS={{ oo_zabbix_hostgroups | join(',') }}" \
+ -e "OO_ZABBIX_TEMPLATES=Template OpenShift Proxy Ctr" \
+ "docker-registry.ops.rhcloud.com/oso-v2-monitoring:{{ oo_env }}"
-ExecStartPost=-/usr/bin/gear init --post "proxy-monitoring-1" "monitoring:latest"
ExecReload=-/usr/bin/docker stop "proxy-monitoring-1"
ExecReload=-/usr/bin/docker rm "proxy-monitoring-1"
ExecStop=-/usr/bin/docker stop "proxy-monitoring-1"
@@ -26,12 +27,10 @@ WantedBy=container.target
# Container information
X-ContainerId=proxy-monitoring-1
-X-ContainerImage=monitoring:latest
+X-ContainerImage=docker-registry.ops.rhcloud.com/oso-v2-monitoring:{{ oo_env }}
X-ContainerUserId=
X-ContainerRequestId=LwiWtYWaAvSavH6Ze53QJg
X-ContainerType=simple
X-PortMapping=80:80
X-PortMapping=443:443
X-PortMapping=4999:4999
-
-
diff --git a/roles/atomic_proxy/files/ctr-proxy-puppet-1.service b/roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2
index c1f4d9b13..c3f28f471 100644
--- a/roles/atomic_proxy/files/ctr-proxy-puppet-1.service
+++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2
@@ -1,5 +1,3 @@
-
-
[Unit]
Description=Container proxy-puppet-1
@@ -17,9 +15,9 @@ ExecStart=/usr/bin/docker run --rm --name "proxy-puppet-1"
-v /var/lib/docker/volumes/proxy_puppet/var/lib/puppet/ssl:/var/lib/puppet/ssl \
-v /var/lib/docker/volumes/proxy_puppet/etc/puppet:/etc/puppet \
-a stdout -a stderr \
- "puppet:latest"
+ "docker-registry.ops.rhcloud.com/oso-v2-puppet:{{ oo_env }}"
+
# Set links (requires container have a name)
-ExecStartPost=-/usr/bin/gear init --post "proxy-puppet-1" "puppet:latest"
ExecReload=-/usr/bin/docker stop "proxy-puppet-1"
ExecReload=-/usr/bin/docker rm "proxy-puppet-1"
ExecStop=-/usr/bin/docker stop "proxy-puppet-1"
@@ -29,9 +27,7 @@ WantedBy=container.target
# Container information
X-ContainerId=proxy-puppet-1
-X-ContainerImage=puppet:latest
+X-ContainerImage=docker-registry.ops.rhcloud.com/oso-v2-puppet:{{ oo_env }}
X-ContainerUserId=
X-ContainerRequestId=Ky0lhw0onwoSDJR4GK6t3g
X-ContainerType=simple
-
-