From 023f92f9e3eec7de6c1286549000be79189a4fde Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Mon, 15 Dec 2014 16:00:47 -0500 Subject: changed atomic proxy to use pre-built container images --- playbooks/aws/os2-atomic-proxy/config.yml | 5 -- roles/atomic_proxy/files/ctr-proxy-1.service | 37 ---------- .../files/ctr-proxy-monitoring-1.service | 37 ---------- .../atomic_proxy/files/ctr-proxy-puppet-1.service | 37 ---------- roles/atomic_proxy/handlers/main.yml | 3 +- roles/atomic_proxy/tasks/main.yml | 20 +---- roles/atomic_proxy/tasks/setup_containers.yml | 57 ++++++++++++++ .../templates/systemd/ctr-proxy-1.service.j2 | 32 ++++++++ .../systemd/ctr-proxy-monitoring-1.service.j2 | 36 +++++++++ .../systemd/ctr-proxy-puppet-1.service.j2 | 33 +++++++++ roles/docker_img_build/README.md | 36 --------- roles/docker_img_build/defaults/main.yml | 2 - .../docker_img_build/files/ops-build-container.sh | 56 -------------- roles/docker_img_build/handlers/main.yml | 2 - roles/docker_img_build/meta/main.yml | 14 ---- roles/docker_img_build/tasks/main.yml | 6 -- roles/docker_img_build/vars/main.yml | 2 - roles/docker_img_monitoring/README.md | 36 --------- roles/docker_img_monitoring/defaults/main.yml | 2 - .../files/monitoring_container/Dockerfile | 22 ------ .../monitoring_container/register-with-zabbix.rb | 36 --------- roles/docker_img_monitoring/handlers/main.yml | 2 - roles/docker_img_monitoring/meta/main.yml | 14 ---- roles/docker_img_monitoring/tasks/main.yml | 14 ---- .../templates/monitoring_container/start.rb.j2 | 73 ------------------ roles/docker_img_monitoring/vars/main.yml | 2 - roles/docker_img_proxy/README.md | 36 --------- roles/docker_img_proxy/defaults/main.yml | 2 - .../files/proxy_container/Dockerfile | 33 --------- .../files/proxy_container/ipc-watcher.rb | 67 ----------------- .../files/proxy_container/start.sh | 35 --------- .../files/proxy_container/supervisord.conf | 19 ----- roles/docker_img_proxy/handlers/main.yml | 2 - roles/docker_img_proxy/meta/main.yml | 14 ---- roles/docker_img_proxy/tasks/main.yml | 11 --- roles/docker_img_proxy/vars/main.yml | 2 - roles/docker_img_puppet/README.md | 36 --------- roles/docker_img_puppet/defaults/main.yml | 2 - .../files/puppet_container/Dockerfile | 38 ---------- .../files/puppet_container/service.rb | 18 ----- .../files/puppet_container/start.rb | 86 ---------------------- roles/docker_img_puppet/handlers/main.yml | 2 - roles/docker_img_puppet/meta/main.yml | 14 ---- roles/docker_img_puppet/tasks/main.yml | 10 --- roles/docker_img_puppet/vars/main.yml | 2 - roles/docker_img_rhel6ops/README.md | 36 --------- roles/docker_img_rhel6ops/defaults/main.yml | 2 - .../files/rhel6ops_container/Dockerfile | 29 -------- .../files/rhel6ops_container/bashrc | 14 ---- .../rhel6ops_container/etc/yum.repos.d/epel.repo | 16 ---- .../etc/yum.repos.d/li-rhscl.repo | 15 ---- .../etc/yum.repos.d/li-staging.repo | 15 ---- .../rhel6ops_container/etc/yum.repos.d/li.repo | 15 ---- .../oso-rhui-rhel-server-releases-optional.repo | 16 ---- .../yum.repos.d/oso-rhui-rhel-server-releases.repo | 16 ---- .../yum.repos.d/oso-rhui-rhel-server-rhscl.repo | 15 ---- .../rhel6ops_container/etc/yum.repos.d/zabbix.repo | 14 ---- roles/docker_img_rhel6ops/handlers/main.yml | 2 - roles/docker_img_rhel6ops/meta/main.yml | 14 ---- roles/docker_img_rhel6ops/tasks/main.yml | 20 ----- roles/docker_img_rhel6ops/vars/main.yml | 2 - 61 files changed, 161 insertions(+), 1125 deletions(-) delete mode 100644 roles/atomic_proxy/files/ctr-proxy-1.service delete mode 100644 roles/atomic_proxy/files/ctr-proxy-monitoring-1.service delete mode 100644 roles/atomic_proxy/files/ctr-proxy-puppet-1.service create mode 100644 roles/atomic_proxy/tasks/setup_containers.yml create mode 100644 roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2 create mode 100644 roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2 create mode 100644 roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2 delete mode 100644 roles/docker_img_build/README.md delete mode 100644 roles/docker_img_build/defaults/main.yml delete mode 100755 roles/docker_img_build/files/ops-build-container.sh delete mode 100644 roles/docker_img_build/handlers/main.yml delete mode 100644 roles/docker_img_build/meta/main.yml delete mode 100644 roles/docker_img_build/tasks/main.yml delete mode 100644 roles/docker_img_build/vars/main.yml delete mode 100644 roles/docker_img_monitoring/README.md delete mode 100644 roles/docker_img_monitoring/defaults/main.yml delete mode 100644 roles/docker_img_monitoring/files/monitoring_container/Dockerfile delete mode 100755 roles/docker_img_monitoring/files/monitoring_container/register-with-zabbix.rb delete mode 100644 roles/docker_img_monitoring/handlers/main.yml delete mode 100644 roles/docker_img_monitoring/meta/main.yml delete mode 100644 roles/docker_img_monitoring/tasks/main.yml delete mode 100755 roles/docker_img_monitoring/templates/monitoring_container/start.rb.j2 delete mode 100644 roles/docker_img_monitoring/vars/main.yml delete mode 100644 roles/docker_img_proxy/README.md delete mode 100644 roles/docker_img_proxy/defaults/main.yml delete mode 100644 roles/docker_img_proxy/files/proxy_container/Dockerfile delete mode 100755 roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb delete mode 100755 roles/docker_img_proxy/files/proxy_container/start.sh delete mode 100644 roles/docker_img_proxy/files/proxy_container/supervisord.conf delete mode 100644 roles/docker_img_proxy/handlers/main.yml delete mode 100644 roles/docker_img_proxy/meta/main.yml delete mode 100644 roles/docker_img_proxy/tasks/main.yml delete mode 100644 roles/docker_img_proxy/vars/main.yml delete mode 100644 roles/docker_img_puppet/README.md delete mode 100644 roles/docker_img_puppet/defaults/main.yml delete mode 100644 roles/docker_img_puppet/files/puppet_container/Dockerfile delete mode 100755 roles/docker_img_puppet/files/puppet_container/service.rb delete mode 100755 roles/docker_img_puppet/files/puppet_container/start.rb delete mode 100644 roles/docker_img_puppet/handlers/main.yml delete mode 100644 roles/docker_img_puppet/meta/main.yml delete mode 100644 roles/docker_img_puppet/tasks/main.yml delete mode 100644 roles/docker_img_puppet/vars/main.yml delete mode 100644 roles/docker_img_rhel6ops/README.md delete mode 100644 roles/docker_img_rhel6ops/defaults/main.yml delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/Dockerfile delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/bashrc delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/epel.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-rhscl.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-staging.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases-optional.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-rhscl.repo delete mode 100644 roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/zabbix.repo delete mode 100644 roles/docker_img_rhel6ops/handlers/main.yml delete mode 100644 roles/docker_img_rhel6ops/meta/main.yml delete mode 100644 roles/docker_img_rhel6ops/tasks/main.yml delete mode 100644 roles/docker_img_rhel6ops/vars/main.yml diff --git a/playbooks/aws/os2-atomic-proxy/config.yml b/playbooks/aws/os2-atomic-proxy/config.yml index 5ee512bfd..0124156a9 100644 --- a/playbooks/aws/os2-atomic-proxy/config.yml +++ b/playbooks/aws/os2-atomic-proxy/config.yml @@ -18,8 +18,3 @@ roles: - ../../../roles/atomic_base - ../../../roles/atomic_proxy - - ../../../roles/docker_img_build - - ../../../roles/docker_img_rhel6ops - - ../../../roles/docker_img_puppet - - ../../../roles/docker_img_proxy - - ../../../roles/docker_img_monitoring diff --git a/roles/atomic_proxy/files/ctr-proxy-1.service b/roles/atomic_proxy/files/ctr-proxy-1.service deleted file mode 100644 index c532eb8e8..000000000 --- a/roles/atomic_proxy/files/ctr-proxy-1.service +++ /dev/null @@ -1,37 +0,0 @@ - - -[Unit] -Description=Container proxy-1 - - -[Service] -Type=simple -TimeoutStartSec=5m -Slice=container-small.slice - -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" - -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" - -[Install] -WantedBy=container.target - -# Container information -X-ContainerId=proxy-1 -X-ContainerImage=proxy:latest -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/files/ctr-proxy-monitoring-1.service deleted file mode 100644 index 7a91ea02c..000000000 --- a/roles/atomic_proxy/files/ctr-proxy-monitoring-1.service +++ /dev/null @@ -1,37 +0,0 @@ - - -[Unit] -Description=Container proxy-monitoring-1 - - -[Service] -Type=simple -TimeoutStartSec=5m -Slice=container-small.slice - -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" - -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" - -[Install] -WantedBy=container.target - -# Container information -X-ContainerId=proxy-monitoring-1 -X-ContainerImage=monitoring:latest -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/files/ctr-proxy-puppet-1.service deleted file mode 100644 index c1f4d9b13..000000000 --- a/roles/atomic_proxy/files/ctr-proxy-puppet-1.service +++ /dev/null @@ -1,37 +0,0 @@ - - -[Unit] -Description=Container proxy-puppet-1 - - -[Service] -Type=simple -TimeoutStartSec=5m -Slice=container-small.slice - - -ExecStartPre=-/usr/bin/docker rm "proxy-puppet-1" - -ExecStart=/usr/bin/docker run --rm --name "proxy-puppet-1" \ - --volumes-from proxy-shared-data-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" -# 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" - -[Install] -WantedBy=container.target - -# Container information -X-ContainerId=proxy-puppet-1 -X-ContainerImage=puppet:latest -X-ContainerUserId= -X-ContainerRequestId=Ky0lhw0onwoSDJR4GK6t3g -X-ContainerType=simple - - 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/templates/systemd/ctr-proxy-1.service.j2 b/roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2 new file mode 100644 index 000000000..988a9f544 --- /dev/null +++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-1.service.j2 @@ -0,0 +1,32 @@ +[Unit] +Description=Container proxy-1 + + +[Service] +Type=simple +TimeoutStartSec=5m +Slice=container-small.slice + +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 \ + "docker-registry.ops.rhcloud.com/oso-v2-proxy:{{ oo_env }}" + +ExecReload=-/usr/bin/docker stop "proxy-1" +ExecReload=-/usr/bin/docker rm "proxy-1" +ExecStop=-/usr/bin/docker stop "proxy-1" + +[Install] +WantedBy=container.target + +# Container information +X-ContainerId=proxy-1 +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/templates/systemd/ctr-proxy-monitoring-1.service.j2 b/roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2 new file mode 100644 index 000000000..975b0061b --- /dev/null +++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-monitoring-1.service.j2 @@ -0,0 +1,36 @@ +[Unit] +Description=Container proxy-monitoring-1 + + +[Service] +Type=simple +TimeoutStartSec=5m +Slice=container-small.slice + +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 \ + -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 }}" + +ExecReload=-/usr/bin/docker stop "proxy-monitoring-1" +ExecReload=-/usr/bin/docker rm "proxy-monitoring-1" +ExecStop=-/usr/bin/docker stop "proxy-monitoring-1" + +[Install] +WantedBy=container.target + +# Container information +X-ContainerId=proxy-monitoring-1 +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/templates/systemd/ctr-proxy-puppet-1.service.j2 b/roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2 new file mode 100644 index 000000000..c3f28f471 --- /dev/null +++ b/roles/atomic_proxy/templates/systemd/ctr-proxy-puppet-1.service.j2 @@ -0,0 +1,33 @@ +[Unit] +Description=Container proxy-puppet-1 + + +[Service] +Type=simple +TimeoutStartSec=5m +Slice=container-small.slice + + +ExecStartPre=-/usr/bin/docker rm "proxy-puppet-1" + +ExecStart=/usr/bin/docker run --rm --name "proxy-puppet-1" \ + --volumes-from proxy-shared-data-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 \ + "docker-registry.ops.rhcloud.com/oso-v2-puppet:{{ oo_env }}" + +# Set links (requires container have a name) +ExecReload=-/usr/bin/docker stop "proxy-puppet-1" +ExecReload=-/usr/bin/docker rm "proxy-puppet-1" +ExecStop=-/usr/bin/docker stop "proxy-puppet-1" + +[Install] +WantedBy=container.target + +# Container information +X-ContainerId=proxy-puppet-1 +X-ContainerImage=docker-registry.ops.rhcloud.com/oso-v2-puppet:{{ oo_env }} +X-ContainerUserId= +X-ContainerRequestId=Ky0lhw0onwoSDJR4GK6t3g +X-ContainerType=simple diff --git a/roles/docker_img_build/README.md b/roles/docker_img_build/README.md deleted file mode 100644 index cf332cde7..000000000 --- a/roles/docker_img_build/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -The purpose of this role is to setup tools to do docker image builds - -Requirements ------------- - -Docker - -Role Variables --------------- - -None - -Dependencies ------------- - -None - -Example Playbook ----------------- - - - hosts: servers - roles: - - docker_img_build - -License -------- - -ASL 2.0 - -Author Information ------------------- - -Thomas Wiest diff --git a/roles/docker_img_build/defaults/main.yml b/roles/docker_img_build/defaults/main.yml deleted file mode 100644 index 087287db1..000000000 --- a/roles/docker_img_build/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for docker_img_build diff --git a/roles/docker_img_build/files/ops-build-container.sh b/roles/docker_img_build/files/ops-build-container.sh deleted file mode 100755 index 308fbd58c..000000000 --- a/roles/docker_img_build/files/ops-build-container.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -RED=$(echo -e "\e[31m") -GREEN=$(echo -e "\e[32m") -YELLOW=$(echo -e "\e[33m") -BLUE=$(echo -e "\e[34m") -NORM=$(echo -e "\e[0m") - -CTR_DIR='/usr/local/etc/containers' - -EXIT_CODE=0 - -function main() -{ - # Make sure we're in the directory we expect to be in - cd $CTR_DIR - - TAG=$(echo $1 | sed 's/_container[\/]*//') - if [ -z "$TAG" ] - then - echo "FAILED parsing tag from \$1 [$1]" - exit 10 - fi - - docker build --rm -t $TAG $1 - EXIT_CODE=$? -} - -if [ $# -ne 1 ] -then - echo - echo " Usage: $(basename $0) container" - echo "Example: $(basename $0) monitoring_container" - echo - exit -fi - -if ! [ -d "$CTR_DIR/$1" ] -then - echo "Error: directory not found [$CTR_DIR/$1]" - exit 10 -fi - -time main $@ -echo -echo - -if [ $EXIT_CODE -eq 0 ] -then - echo "${GREEN}$1 build succeeded.${NORM}" -else - echo "${RED}$1 build FAILED!${NORM}" -fi - -echo -exit $EXIT_CODE diff --git a/roles/docker_img_build/handlers/main.yml b/roles/docker_img_build/handlers/main.yml deleted file mode 100644 index 9b5fe2b3d..000000000 --- a/roles/docker_img_build/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for docker_img_build diff --git a/roles/docker_img_build/meta/main.yml b/roles/docker_img_build/meta/main.yml deleted file mode 100644 index 40f83bf2f..000000000 --- a/roles/docker_img_build/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -galaxy_info: - author: Thomas Wiest - description: Tools to do docker image builds - company: Red Hat - license: ASL 2.0 - min_ansible_version: 1.6 - platforms: - - name: EL - versions: - - 7 - categories: - - docker -dependencies: [] diff --git a/roles/docker_img_build/tasks/main.yml b/roles/docker_img_build/tasks/main.yml deleted file mode 100644 index aaa2fae25..000000000 --- a/roles/docker_img_build/tasks/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: mkdir -p /usr/local/etc/containers - file: dest=/usr/local/etc/containers state=directory - -- name: deploy ops-build-container.sh - copy: src=ops-build-container.sh dest=/usr/local/bin/ops-build-container.sh mode=755 diff --git a/roles/docker_img_build/vars/main.yml b/roles/docker_img_build/vars/main.yml deleted file mode 100644 index ddb684fda..000000000 --- a/roles/docker_img_build/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker_img_build diff --git a/roles/docker_img_monitoring/README.md b/roles/docker_img_monitoring/README.md deleted file mode 100644 index 103df4b19..000000000 --- a/roles/docker_img_monitoring/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -The purpose of this role is to setup files to do the monitoring docker image build - -Requirements ------------- - -Docker - -Role Variables --------------- - -None - -Dependencies ------------- - -None - -Example Playbook ----------------- - - - hosts: servers - roles: - - docker_img_monitoring - -License -------- - -ASL 2.0 - -Author Information ------------------- - -Thomas Wiest diff --git a/roles/docker_img_monitoring/defaults/main.yml b/roles/docker_img_monitoring/defaults/main.yml deleted file mode 100644 index 1f563defd..000000000 --- a/roles/docker_img_monitoring/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for docker_img_puppet diff --git a/roles/docker_img_monitoring/files/monitoring_container/Dockerfile b/roles/docker_img_monitoring/files/monitoring_container/Dockerfile deleted file mode 100644 index 14e7f8650..000000000 --- a/roles/docker_img_monitoring/files/monitoring_container/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# This FROM gives us the proper oo-rhui certs, basic runtime env vars, basic repos, etc. -# Otherwise we can't install anything -FROM rhel6ops - -MAINTAINER Thomas Wiest - -RUN yum -y update ; yum clean all - -# Container Specific RPMs -RUN yum -y install ruby193-rubygem-zbxapi cronie zabbix-sender ruby openshift-origin-util-scl ruby193-facter socat ; yum clean all - -# Setup ctr-ipc dir -RUN ln -s /shared/var/run/ctr-ipc /var/run/ctr-ipc - -# Container specific files -ADD start.rb /start.rb -ADD register-with-zabbix.rb /register-with-zabbix.rb - -# TEMP WORKAROUND: until cron-send-haproxy-status.rb doesn't check service to see if haproxy is running -RUN ln -sf /bin/true /etc/init.d/haproxy - -CMD ["/start.rb"] diff --git a/roles/docker_img_monitoring/files/monitoring_container/register-with-zabbix.rb b/roles/docker_img_monitoring/files/monitoring_container/register-with-zabbix.rb deleted file mode 100755 index 02659228f..000000000 --- a/roles/docker_img_monitoring/files/monitoring_container/register-with-zabbix.rb +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env oo-ruby - -require 'optparse' -require '/usr/local/lib/zabbix_helper' - - -if __FILE__ == $0 - $stdout.sync = true - $stderr.sync = true - - opt_name = nil - opt_hostgroup = [] - opt_template = [] - - optparse = OptionParser.new do |opts| - opts.banner = "\nUsage: #{File.basename $0}\n\n" - - opts.on('--name NAME', '[REQUIRED] The host name to register') { |value| opt_name = value } - opts.on('--hostgroup GROUP', '[REQUIRED] The hostgroup(s) with which to register') { |value| opt_hostgroup << value } - opts.on('--template TEMPLATE', '[REQUIRED] The template with which to register') { |value| opt_template << value } - end - - optparse.parse! - - abort optparse.help if opt_name.nil? || opt_hostgroup.empty? || opt_template.empty? - - puts "Adding host [#{opt_name}] to zabbix..." - - zh = ZabbixHelper.new() - result = zh.create_agentless_host(opt_name, opt_hostgroup, opt_template) - if result['hostids'].nil? - raise "failed to add #{opt_name}" - else - puts "Successfully registered host with hostid [#{result['hostids'].first}]" - end -end diff --git a/roles/docker_img_monitoring/handlers/main.yml b/roles/docker_img_monitoring/handlers/main.yml deleted file mode 100644 index 9b5fe2b3d..000000000 --- a/roles/docker_img_monitoring/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for docker_img_build diff --git a/roles/docker_img_monitoring/meta/main.yml b/roles/docker_img_monitoring/meta/main.yml deleted file mode 100644 index 40f83bf2f..000000000 --- a/roles/docker_img_monitoring/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -galaxy_info: - author: Thomas Wiest - description: Tools to do docker image builds - company: Red Hat - license: ASL 2.0 - min_ansible_version: 1.6 - platforms: - - name: EL - versions: - - 7 - categories: - - docker -dependencies: [] diff --git a/roles/docker_img_monitoring/tasks/main.yml b/roles/docker_img_monitoring/tasks/main.yml deleted file mode 100644 index dce918cb6..000000000 --- a/roles/docker_img_monitoring/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: deploy monitoring image build files - file: dest=/usr/local/etc/containers/monitoring_container mode=755 state=directory - -- name: deploy monitoring image build files - copy: "src=monitoring_container/{{ item.name }} dest=/usr/local/etc/containers/monitoring_container/{{ item.name }} mode={{ item.mode }}" - with_items: - - { name: 'Dockerfile', mode: '644' } - - { name: 'register-with-zabbix.rb', mode: '755' } - -- name: deploy monitoring image build templates - template: "src=monitoring_container/{{ item.name }}.j2 dest=/usr/local/etc/containers/monitoring_container/{{ item.name }} mode={{ item.mode }}" - with_items: - - { name: 'start.rb', mode: '755' } diff --git a/roles/docker_img_monitoring/templates/monitoring_container/start.rb.j2 b/roles/docker_img_monitoring/templates/monitoring_container/start.rb.j2 deleted file mode 100755 index 70d60f87b..000000000 --- a/roles/docker_img_monitoring/templates/monitoring_container/start.rb.j2 +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - - -# TODO: These should be passed in as env vars. When we're in a POD, make sure to do this. -# WORKAROUND: ^^ -OO_ENV = '{{ oo_env }}' -OO_CTR_TYPE = 'proxy' -HOSTGROUPS = {{ oo_zabbix_hostgroups | to_nice_json }} -TEMPLATES = ['Template OpenShift Proxy Ctr'] -CTR_NAME = "ctr-#{OO_CTR_TYPE}-#{OO_ENV}-#{ENV['container_uuid'][0..6]}" - - -CTR_CONFIG_FLAG = '/shared/var/run/ctr-ipc/flag/ctr_configured' - - -class Start - def self.wait_for_ctr_configured - while ! File.exist?(CTR_CONFIG_FLAG) - puts "Sleeping 10 seconds, waiting for #{CTR_CONFIG_FLAG}" - sleep 10 - end - end - - def self.add_to_zabbix - # Need to do this as a separate script because /usr/local gets changed after this script starts. - # FIXME: we can change this once we aren't using the puppet container anymore - cmd = "/register-with-zabbix.rb --name #{CTR_NAME}" - cmd += ' ' + HOSTGROUPS.collect() { |a| "--hostgroup '#{a}'" }.join(' ') - cmd += ' ' + TEMPLATES.collect() { |a| "--template '#{a}'" }.join(' ') - puts "Running: #{cmd}" - system(cmd) - raise "failed" unless $?.exitstatus == 0 - end - - def self.setup_shared_dirs - puts '_' - ['/usr/local', '/etc/openshift', '/var/lib/haproxy', '/etc/haproxy'].each do |shared_dir| - puts "Setting up /shared#{shared_dir}..." - FileUtils.rm_rf(shared_dir) - FileUtils.ln_s("/shared#{shared_dir}", shared_dir) - end - puts '_' - end - - def self.setup_cron() - File.open('/etc/crontab', 'a') do |f| - # FIXME: on failure, this should e-mail, not log to a file. Not sure how best to do that in a 1 service per container way. - f.write("30 12 * * * root /usr/bin/flock -n /var/tmp/cron-send-cert-expiration.lock -c '/usr/bin/timeout -s9 30s /usr/local/bin/cron-send-cert-expiration.rb --server noc2.ops.rhcloud.com --zbx-host #{CTR_NAME}' &>> /var/log/cron-send-cert-expiration.log\n") - f.write("*/2 * * * * root /usr/local/bin/cron-send-haproxy-status.rb --server noc2.ops.rhcloud.com --zbx-host #{CTR_NAME} &>> /var/log/cron-send-haproxy-status.log\n") - end - end - - def self.exec_cron() - puts '_' - puts 'Exec-ing cron' - puts '-------------' - puts "Starting cron..." - exec("/usr/sbin/crond -n") - end -end - -if __FILE__ == $0 - $stdout.sync = true - $stderr.sync = true - - Start.setup_shared_dirs() - Start.wait_for_ctr_configured - Start.add_to_zabbix() - Start.setup_cron() - Start.exec_cron() -end diff --git a/roles/docker_img_monitoring/vars/main.yml b/roles/docker_img_monitoring/vars/main.yml deleted file mode 100644 index 3abe3ae6a..000000000 --- a/roles/docker_img_monitoring/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker_img_puppet diff --git a/roles/docker_img_proxy/README.md b/roles/docker_img_proxy/README.md deleted file mode 100644 index 40e14821b..000000000 --- a/roles/docker_img_proxy/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -The purpose of this role is to setup files to do the proxy docker image build - -Requirements ------------- - -Docker - -Role Variables --------------- - -None - -Dependencies ------------- - -None - -Example Playbook ----------------- - - - hosts: servers - roles: - - docker_img_proxy - -License -------- - -ASL 2.0 - -Author Information ------------------- - -Thomas Wiest diff --git a/roles/docker_img_proxy/defaults/main.yml b/roles/docker_img_proxy/defaults/main.yml deleted file mode 100644 index 56526bf1b..000000000 --- a/roles/docker_img_proxy/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for docker_img_proxy diff --git a/roles/docker_img_proxy/files/proxy_container/Dockerfile b/roles/docker_img_proxy/files/proxy_container/Dockerfile deleted file mode 100644 index 7b5378bb9..000000000 --- a/roles/docker_img_proxy/files/proxy_container/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# This FROM gives us the proper oo-rhui certs, basic runtime env vars, basic repos, etc. -# Otherwise we can't install anything -FROM rhel6ops - -MAINTAINER Thomas Wiest - -RUN yum -y update ; yum clean all - -# Container Specific RPMs -RUN yum -y install rsyslog rhc-server-common httpd mod_security mod_ssl haproxy15 supervisor ruby ruby193-ruby openshift-origin-util-scl ; yum clean all -# this needs to be on it's own line, otherwise the libra_user group isn't setup properly yet -RUN yum -y install rhc-site-static ; yum clean all - -# WORKKAROUND: for a bug in supervisor that causes it to use 100% cpu -RUN yum -y install https://kojipkgs.fedoraproject.org//work/tasks/8506/7818506/supervisor-2.1-9.el6.noarch.rpm ; yum clean all - -# Setup libra_user group with correct members -RUN usermod -a -G libra_user apache - -# Setup libra_ops group for compatibility with host puppet -RUN groupadd libra_ops - -# Setup ctr-ipc dir -RUN ln -s /shared/var/run/ctr-ipc /var/run/ctr-ipc - -# common -ADD supervisord.conf /etc/supervisord.conf -ADD start.sh /usr/local/sbin/start.sh -ADD ipc-watcher.rb /usr/local/sbin/ipc-watcher.rb - -EXPOSE 80 443 4999 - -CMD ["/usr/local/sbin/start.sh"] diff --git a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb b/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb deleted file mode 100755 index 202a58124..000000000 --- a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -module OpenShift - module Ops - class Notify - def self.puts(msg) - $stdout.puts "#{Time.now}: #{msg}" - end - end - - class WatchForIpcs - IPC_DIR = '/var/run/ctr-ipc' - POLL_INTERVAL = 10 # second - HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' - HAPROXY_PID_FILE = '/var/run/haproxy.pid' - - def self.wait_for_service() - loop do - Dir.glob("#{IPC_DIR}/service/*").each do |svc_file| - svc = File.basename(svc_file) - action = File.read(svc_file) - Notify.puts "Found IPC service file: #{svc}" - Notify.puts " Action requested: #{action}" - - # Make sure we don't handle this multiple times - FileUtils.rm(svc_file) - - handle_service_ipc(svc, action) - end - - sleep POLL_INTERVAL - end - end - - def self.handle_service_ipc(svc, action) - cmd = nil - case svc - when 'httpd' - case action - when 'restart', 'reload' - cmd = "/usr/sbin/apachectl -k graceful" - end - when 'haproxy' - case action - when 'restart' - cmd = "/usr/sbin/haproxy -f #{HAPROXY_CONF} -p #{HAPROXY_PID_FILE} -sf $(/bin/cat #{HAPROXY_PID_FILE})" - end - end - - if cmd.nil? - Notify.puts " Warning: Not handling #{svc} #{action}" - return - end - - Notify.puts " Running: #{cmd}" - output = %x[#{cmd} 2>&1] - Notify.puts " Output: #{output}" - end - end - end -end - -if __FILE__ == $0 - OpenShift::Ops::WatchForIpcs.wait_for_service() -end diff --git a/roles/docker_img_proxy/files/proxy_container/start.sh b/roles/docker_img_proxy/files/proxy_container/start.sh deleted file mode 100755 index 560e1c6be..000000000 --- a/roles/docker_img_proxy/files/proxy_container/start.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -echo _ -for shared_dir in /etc/haproxy /etc/pki /etc/httpd /var/lib/haproxy /usr/local/bin /usr/local/lib -do - echo "Setting up /shared${shared_dir}..." - rm -rf $shared_dir - ln -s /shared${shared_dir} $shared_dir -done -echo _ - -CTR_CONFIG_FLAG='/shared/var/run/ctr-ipc/flag/ctr_configured' -while ! [ -f "$CTR_CONFIG_FLAG" ] -do - echo "Sleeping 10 seconds, waiting for $CTR_CONFIG_FLAG" - sleep 10 -done - -# Fix broken sym links -echo "Fixing symlink /etc/httpd/logs..." -ln -sf /var/log/httpd /shared/etc/httpd/logs - -echo "Fixing symlink /etc/httpd/modules..." -ln -sf /usr/lib64/httpd/modules /shared/etc/httpd/modules - -echo "Fixing symlink /etc/httpd/run..." -ln -sf /var/run/httpd /shared/etc/httpd/run -echo _ - -echo "Starting rsyslog service..." -service rsyslog start -echo _ - -echo "Starting supervisord" -exec /usr/bin/supervisord diff --git a/roles/docker_img_proxy/files/proxy_container/supervisord.conf b/roles/docker_img_proxy/files/proxy_container/supervisord.conf deleted file mode 100644 index 3459d20db..000000000 --- a/roles/docker_img_proxy/files/proxy_container/supervisord.conf +++ /dev/null @@ -1,19 +0,0 @@ -[supervisord] -http_port = 127.0.0.1:9001 -nodaemon=true -pidfile = /var/run/supervisord.pid - -[supervisorctl] -serverurl = http://127.0.0.1:9001 - -[program:haproxy] -command=/bin/bash -c "echo $$ > /var/run/haproxy.pid && exec /usr/sbin/haproxy -db -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid" -priority=1 - -[program:httpd] -command=/bin/bash -c "source /etc/sysconfig/httpd && exec /usr/sbin/httpd -DFOREGROUND" -priority=500 - -[program:ipc-watcher.rb] -command=/bin/bash -c "/usr/local/sbin/ipc-watcher.rb" -priority=999 diff --git a/roles/docker_img_proxy/handlers/main.yml b/roles/docker_img_proxy/handlers/main.yml deleted file mode 100644 index 9b5fe2b3d..000000000 --- a/roles/docker_img_proxy/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for docker_img_build diff --git a/roles/docker_img_proxy/meta/main.yml b/roles/docker_img_proxy/meta/main.yml deleted file mode 100644 index 40f83bf2f..000000000 --- a/roles/docker_img_proxy/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -galaxy_info: - author: Thomas Wiest - description: Tools to do docker image builds - company: Red Hat - license: ASL 2.0 - min_ansible_version: 1.6 - platforms: - - name: EL - versions: - - 7 - categories: - - docker -dependencies: [] diff --git a/roles/docker_img_proxy/tasks/main.yml b/roles/docker_img_proxy/tasks/main.yml deleted file mode 100644 index af1238c20..000000000 --- a/roles/docker_img_proxy/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: deploy proxy image build files - file: dest=/usr/local/etc/containers/proxy_container mode=755 state=directory - -- name: deploy proxy image build files - copy: "src=proxy_container/{{ item.name }} dest=/usr/local/etc/containers/proxy_container/{{ item.name }} mode={{ item.mode }}" - with_items: - - { name: 'Dockerfile', mode: '644' } - - { name: 'ipc-watcher.rb', mode: '755' } - - { name: 'start.sh', mode: '755' } - - { name: 'supervisord.conf', mode: '644' } diff --git a/roles/docker_img_proxy/vars/main.yml b/roles/docker_img_proxy/vars/main.yml deleted file mode 100644 index a662f86e9..000000000 --- a/roles/docker_img_proxy/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker_img_proxy diff --git a/roles/docker_img_puppet/README.md b/roles/docker_img_puppet/README.md deleted file mode 100644 index 57ff5b6b4..000000000 --- a/roles/docker_img_puppet/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -The purpose of this role is to setup files to do the puppet docker image build - -Requirements ------------- - -Docker - -Role Variables --------------- - -None - -Dependencies ------------- - -None - -Example Playbook ----------------- - - - hosts: servers - roles: - - docker_img_puppet - -License -------- - -ASL 2.0 - -Author Information ------------------- - -Thomas Wiest diff --git a/roles/docker_img_puppet/defaults/main.yml b/roles/docker_img_puppet/defaults/main.yml deleted file mode 100644 index 1f563defd..000000000 --- a/roles/docker_img_puppet/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for docker_img_puppet diff --git a/roles/docker_img_puppet/files/puppet_container/Dockerfile b/roles/docker_img_puppet/files/puppet_container/Dockerfile deleted file mode 100644 index e16536c03..000000000 --- a/roles/docker_img_puppet/files/puppet_container/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# This FROM gives us the proper oo-rhui certs, basic runtime env vars, basic repos, etc. -# Otherwise we can't install anything -FROM rhel6ops - -MAINTAINER Thomas Wiest - -RUN yum -y update ; yum clean all - -# Container Specific RPMs -RUN yum -y install puppet3 crontabs cronie-anacron cronie system-config-firewall-base httpd mod_ssl ruby193-rubygem-zbxapi mod_security rhc-site-static; yum clean all - -# BEGIN: These are to fake out puppet - -RUN rm /usr/sbin/lokkit ; ln -s /bin/true /usr/sbin/lokkit - -# this is needed so that we can run puppet without running the start script -RUN mkdir -p /etc/haproxy - -# Setup libra_ops group for compatibility with host puppet -RUN groupadd libra_ops - -# END: These are to fake out puppet - -# Container specific files -ADD start.rb /usr/local/sbin/start.rb -ADD service.rb /sbin/service - -# Ensure the scripts are executable -RUN chmod 755 /sbin/service /usr/local/sbin/start.rb - -RUN yum -y install strace ; yum clean all - -# Get rid of puppet deprecation warnings -RUN sed -i 's/^.*manifest =.*$//' /etc/puppet/puppet.conf ; \ - sed -i 's/^.*manifestdir =.*$//' /etc/puppet/puppet.conf ; \ - sed -i 's/^.*modulepath =.*$//' /etc/puppet/puppet.conf - -CMD ["/usr/local/sbin/start.rb"] diff --git a/roles/docker_img_puppet/files/puppet_container/service.rb b/roles/docker_img_puppet/files/puppet_container/service.rb deleted file mode 100755 index 40779c270..000000000 --- a/roles/docker_img_puppet/files/puppet_container/service.rb +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -if __FILE__ == $0 - abort "\nUsage: #{File.basename($0)} \n\n" unless ARGV.size == 2 - - name = ARGV[0] - action = ARGV[1] - - SERVICE_IPC_DIR = '/var/run/ctr-ipc/service' - - FileUtils.mkdir_p(SERVICE_IPC_DIR) - - File.open("#{SERVICE_IPC_DIR}/#{name}", 'w') do |f| - f.print action - end -end diff --git a/roles/docker_img_puppet/files/puppet_container/start.rb b/roles/docker_img_puppet/files/puppet_container/start.rb deleted file mode 100755 index f1dd940ba..000000000 --- a/roles/docker_img_puppet/files/puppet_container/start.rb +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -CTR_CONFIG_FLAG = '/shared/var/run/ctr-ipc/flag/ctr_configured' - - -class Start - def self.setup_shared_dirs() - puts '_' - puts 'Setting up dirs in shared volume' - puts '--------------------------------' - mtab = File.read('/etc/mtab') - - shared_dirs = mtab.grep(/ \/shared\//).collect { |line| line.split(' ')[1] } - - shared_dirs.each do |sh_dir| - orig_dir = sh_dir.gsub(/^\/shared/,'') - - next if File.symlink?(orig_dir) - - if File.exist?(orig_dir) - cmd = "cp -vaf #{orig_dir} #{File.dirname(sh_dir)}" - puts "Running: #{cmd}" - system(cmd) - - cmd = "rm -vrf #{orig_dir}" - puts "Running: #{cmd}" - system(cmd) - end - - FileUtils.ln_s(sh_dir, orig_dir, {:verbose => true}) - end - puts 'Done.' - puts '_' - end - - def self.run_puppet_agent() - puts '_' - puts 'Running Puppet Agent' - puts '--------------------' - exitcode = nil - 1.upto(3) do |ctr| - unless ctr == 1 - puts '_' - puts "Previous puppet run failed with exit code [#{exitcode}], running again..." - puts '_' - end - - system("bash -c 'time /usr/bin/puppet agent -t'") - exitcode = $?.exitstatus - puts "Exit Code [#{exitcode}]" - - break if exitcode == 0 || exitcode == 2 - end - - raise "Puppet run failed, retries exhausted." if exitcode != 0 && exitcode != 2 - - puts 'Done.' - puts '_' - - puts '_' - puts 'Creating ctr_configured flag' - FileUtils.mkdir_p(File.dirname(CTR_CONFIG_FLAG)) - FileUtils.touch(CTR_CONFIG_FLAG) - puts 'Done.' - puts '_' - end - - def self.exec_puppetd() - puts '_' - puts 'Exec-ing puppet daemon' - puts '---------------------' - puts "Starting puppet agent..." - exec("bash -c '/usr/bin/puppet agent --no-daemonize --detailed-exitcodes --verbose'") - end -end - -if __FILE__ == $0 - $stdout.sync = true - $stderr.sync = true - - Start.setup_shared_dirs() - Start.run_puppet_agent() - Start.exec_puppetd() -end diff --git a/roles/docker_img_puppet/handlers/main.yml b/roles/docker_img_puppet/handlers/main.yml deleted file mode 100644 index 9b5fe2b3d..000000000 --- a/roles/docker_img_puppet/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for docker_img_build diff --git a/roles/docker_img_puppet/meta/main.yml b/roles/docker_img_puppet/meta/main.yml deleted file mode 100644 index 40f83bf2f..000000000 --- a/roles/docker_img_puppet/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -galaxy_info: - author: Thomas Wiest - description: Tools to do docker image builds - company: Red Hat - license: ASL 2.0 - min_ansible_version: 1.6 - platforms: - - name: EL - versions: - - 7 - categories: - - docker -dependencies: [] diff --git a/roles/docker_img_puppet/tasks/main.yml b/roles/docker_img_puppet/tasks/main.yml deleted file mode 100644 index 87741b6c1..000000000 --- a/roles/docker_img_puppet/tasks/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: deploy puppet image build files - file: dest=/usr/local/etc/containers/puppet_container mode=755 state=directory - -- name: deploy puppet image build files - copy: "src=puppet_container/{{ item.name }} dest=/usr/local/etc/containers/puppet_container/{{ item.name }} mode={{ item.mode }}" - with_items: - - { name: 'Dockerfile', mode: '644' } - - { name: 'service.rb', mode: '755' } - - { name: 'start.rb', mode: '755' } diff --git a/roles/docker_img_puppet/vars/main.yml b/roles/docker_img_puppet/vars/main.yml deleted file mode 100644 index 3abe3ae6a..000000000 --- a/roles/docker_img_puppet/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker_img_puppet diff --git a/roles/docker_img_rhel6ops/README.md b/roles/docker_img_rhel6ops/README.md deleted file mode 100644 index 2055cd599..000000000 --- a/roles/docker_img_rhel6ops/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -The purpose of this role is to setup files to do the rhel6ops docker image build - -Requirements ------------- - -Docker - -Role Variables --------------- - -None - -Dependencies ------------- - -None - -Example Playbook ----------------- - - - hosts: servers - roles: - - docker_img_rhel6ops - -License -------- - -ASL 2.0 - -Author Information ------------------- - -Thomas Wiest diff --git a/roles/docker_img_rhel6ops/defaults/main.yml b/roles/docker_img_rhel6ops/defaults/main.yml deleted file mode 100644 index 5bd68eae2..000000000 --- a/roles/docker_img_rhel6ops/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for docker_img_rhel6ops diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/Dockerfile b/roles/docker_img_rhel6ops/files/rhel6ops_container/Dockerfile deleted file mode 100644 index 86783f96d..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM rhel6 -MAINTAINER Thomas Wiest - -ENV CONTAINER docker -ENV USER root -ENV HOME /root -ENV TERM xterm -WORKDIR /root - -# creature comforts -ADD bashrc /root/.bashrc - -# Add the yum repos -ADD etc/yum.repos.d/ /etc/yum.repos.d - -# Add yum vars -RUN echo -n 6 > /etc/yum/vars/majorrelease - -# setup links for the yum mirror certs -RUN ln -s /run/secrets/etc-pki-entitlement/yum/client-cert.pem /var/lib/yum/client-cert.pem ; \ - ln -s /run/secrets/etc-pki-entitlement/yum/client-key.pem /var/lib/yum/client-key.pem - - -RUN rpm --import /etc/pki/rpm-gpg/* && \ -yum clean metadata && \ -yum -y remove subscription-manager && \ -yum -y install vim-enhanced telnet && \ -yum -y update && \ -yum clean all diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/bashrc b/roles/docker_img_rhel6ops/files/rhel6ops_container/bashrc deleted file mode 100644 index 343051d19..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/bashrc +++ /dev/null @@ -1,14 +0,0 @@ -# .bashrc - -# User specific aliases and functions - -alias ls='ls --color' -alias rm='rm -i' -alias cp='cp -i' -alias mv='mv -i' -alias vi=vim - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/epel.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/epel.repo deleted file mode 100644 index 583ca72c9..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/epel.repo +++ /dev/null @@ -1,16 +0,0 @@ -[epel] -name=Extra Packages for Enterprise Linux 6 - $basearch -baseurl=http://mirror.ops.rhcloud.com/mirror/epel/6/$basearch/ -failovermethod=priority -enabled=1 -gpgcheck=0 -exclude=libmongodb mongodb* nodejs* - -[epel-testing] -name=Extra Packages for Enterprise Linux 6 - Testing - $basearch -baseurl=http://mirror.ops.rhcloud.com/mirror/epel/testing/6/$basearch/ -failovermethod=priority -enabled=0 -gpgcheck=0 -exclude=libmongodb mongodb* nodejs* - diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-rhscl.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-rhscl.repo deleted file mode 100644 index 4f3bf1a00..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-rhscl.repo +++ /dev/null @@ -1,15 +0,0 @@ -[li-rhscl] -name=Li RHSCL repo for Enterprise Linux $majorrelease - $basearch -baseurl=https://mirror.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ - https://use-mirror1.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ - https://use-mirror2.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ - https://euw-mirror1.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ - https://gce-mirror1.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ - https://gce-mirror2.ops.rhcloud.com/libra/rhscl-rhel-$majorrelease-libra/$basearch/ -enabled=1 -gpgcheck=1 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -failovermethod=priority -sslverify=0 -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-staging.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-staging.repo deleted file mode 100644 index 35a8babe1..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li-staging.repo +++ /dev/null @@ -1,15 +0,0 @@ -[li-staging] -name=Staging Li repo for Enterprise Linux $majorrelease - $basearch -baseurl=https://mirror.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ - https://use-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ - https://use-mirror2.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ - https://euw-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ - https://gce-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ - https://gce-mirror2.ops.rhcloud.com/libra/rhel-$majorrelease-libra-stage/$basearch/ -enabled=1 -gpgcheck=0 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -failovermethod=priority -sslverify=0 -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li.repo deleted file mode 100644 index be2cf66b5..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/li.repo +++ /dev/null @@ -1,15 +0,0 @@ -[li] -name=Li repo for Enterprise Linux $majorrelease - $basearch -baseurl=https://mirror.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ - https://use-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ - https://use-mirror2.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ - https://euw-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ - https://gce-mirror1.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ - https://gce-mirror2.ops.rhcloud.com/libra/rhel-$majorrelease-libra/$basearch/ -enabled=1 -gpgcheck=1 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -failovermethod=priority -sslverify=0 -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases-optional.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases-optional.repo deleted file mode 100644 index eea68789e..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases-optional.repo +++ /dev/null @@ -1,16 +0,0 @@ -[oso-rhui-rhel-server-releases-optional] -name=OpenShift Online RHUI Mirror RH Enterprise Linux $majorrelease - Optional -baseurl=https://mirror.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ - https://use-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ - https://use-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ - https://euw-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ - https://gce-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ - https://gce-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases-optional/ -enabled=1 -gpgcheck=1 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -exclude=libcgroup* gluster* -failovermethod=priority -sslverify=False -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases.repo deleted file mode 100644 index 5b11139c7..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-releases.repo +++ /dev/null @@ -1,16 +0,0 @@ -[oso-rhui-rhel-server-releases] -name=OpenShift Online RHUI Mirror RH Enterprise Linux $majorrelease -baseurl=https://mirror.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ - https://use-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ - https://use-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ - https://euw-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ - https://gce-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ - https://gce-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-releases/ -enabled=1 -gpgcheck=1 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -exclude=libcgroup* gluster* -failovermethod=priority -sslverify=False -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-rhscl.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-rhscl.repo deleted file mode 100644 index e62d7ad18..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/oso-rhui-rhel-server-rhscl.repo +++ /dev/null @@ -1,15 +0,0 @@ -[oso-rhui-rhel-server-rhscl] -name=OpenShift Online RHUI Mirror RH Enterprise Linux $majorrelease - RHSCL -baseurl=https://mirror.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ - https://use-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ - https://use-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ - https://euw-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ - https://gce-mirror1.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ - https://gce-mirror2.ops.rhcloud.com/libra/rhui-rhel-server-$majorrelease-rhscl/ -enabled=1 -gpgcheck=1 -gpgkey=https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-release https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-beta https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted -failovermethod=priority -sslverify=False -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem diff --git a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/zabbix.repo b/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/zabbix.repo deleted file mode 100644 index 68a6ede8c..000000000 --- a/roles/docker_img_rhel6ops/files/rhel6ops_container/etc/yum.repos.d/zabbix.repo +++ /dev/null @@ -1,14 +0,0 @@ -[zabbix] -name=Zend Server -baseurl=http://mirror.ops.rhcloud.com/mirror/zabbix/$majorrelease/$basearch - http://use-mirror1.ops.rhcloud.com/mirror/zabbix/$majorrelease/$basearch - http://use-mirror2.ops.rhcloud.com/mirror/zabbix/$majorrelease/$basearch - http://euw-mirror1.ops.rhcloud.com/mirror/zabbix/$majorrelease/$basearch -enabled=1 -gpgcheck=1 -gpgkey=http://mirror.ops.rhcloud.com/mirror/zabbix/keys/RPM-GPG-KEY-ZABBIX -failovermethod=priority -sslverify=0 -sslclientcert=/var/lib/yum/client-cert.pem -sslclientkey=/var/lib/yum/client-key.pem - diff --git a/roles/docker_img_rhel6ops/handlers/main.yml b/roles/docker_img_rhel6ops/handlers/main.yml deleted file mode 100644 index 9b5fe2b3d..000000000 --- a/roles/docker_img_rhel6ops/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for docker_img_build diff --git a/roles/docker_img_rhel6ops/meta/main.yml b/roles/docker_img_rhel6ops/meta/main.yml deleted file mode 100644 index 40f83bf2f..000000000 --- a/roles/docker_img_rhel6ops/meta/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -galaxy_info: - author: Thomas Wiest - description: Tools to do docker image builds - company: Red Hat - license: ASL 2.0 - min_ansible_version: 1.6 - platforms: - - name: EL - versions: - - 7 - categories: - - docker -dependencies: [] diff --git a/roles/docker_img_rhel6ops/tasks/main.yml b/roles/docker_img_rhel6ops/tasks/main.yml deleted file mode 100644 index 486ba6d5a..000000000 --- a/roles/docker_img_rhel6ops/tasks/main.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: deploy rhel6ops image build files - file: "dest=/usr/local/etc/containers/{{ item }} mode=755 state=directory" - with_items: - - rhel6ops_container - - rhel6ops_container/etc/yum.repos.d - -- name: deploy rhel6ops image build files - copy: "src=rhel6ops_container/{{ item.name }} dest=/usr/local/etc/containers/rhel6ops_container/{{ item.name }} mode={{ item.mode }}" - with_items: - - { name: 'bashrc', mode: '644' } - - { name: 'Dockerfile', mode: '644' } - - { name: 'etc/yum.repos.d/li.repo', mode: '644' } - - { name: 'etc/yum.repos.d/li-rhscl.repo', mode: '644' } - - { name: 'etc/yum.repos.d/li-staging.repo', mode: '644' } - - { name: 'etc/yum.repos.d/epel.repo', mode: '644' } - - { name: 'etc/yum.repos.d/oso-rhui-rhel-server-releases-optional.repo', mode: '644' } - - { name: 'etc/yum.repos.d/oso-rhui-rhel-server-releases.repo', mode: '644' } - - { name: 'etc/yum.repos.d/oso-rhui-rhel-server-rhscl.repo', mode: '644' } - - { name: 'etc/yum.repos.d/zabbix.repo', mode: '644' } diff --git a/roles/docker_img_rhel6ops/vars/main.yml b/roles/docker_img_rhel6ops/vars/main.yml deleted file mode 100644 index febd12ead..000000000 --- a/roles/docker_img_rhel6ops/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for docker_img_rhel6ops -- cgit v1.2.3