summaryrefslogtreecommitdiffstats
path: root/roles/atomic_proxy/tasks
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2014-12-15 16:07:19 -0500
committerThomas Wiest <twiest@users.noreply.github.com>2014-12-15 16:07:19 -0500
commit9830202b133db241493ca3f3d914e1cb1de35963 (patch)
tree0bb33e5ee852ea533f1f808a8e86e38c97699bb4 /roles/atomic_proxy/tasks
parent2848232bdaed44fadb51548fe9d6c39fe89b8e11 (diff)
parent023f92f9e3eec7de6c1286549000be79189a4fde (diff)
downloadopenshift-9830202b133db241493ca3f3d914e1cb1de35963.tar.gz
openshift-9830202b133db241493ca3f3d914e1cb1de35963.tar.bz2
openshift-9830202b133db241493ca3f3d914e1cb1de35963.tar.xz
openshift-9830202b133db241493ca3f3d914e1cb1de35963.zip
Merge pull request #36 from twiest/pr
changed atomic proxy to use pre-built container images
Diffstat (limited to 'roles/atomic_proxy/tasks')
-rw-r--r--roles/atomic_proxy/tasks/main.yml20
-rw-r--r--roles/atomic_proxy/tasks/setup_containers.yml57
2 files changed, 58 insertions, 19 deletions
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