diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2014-12-15 16:07:19 -0500 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2014-12-15 16:07:19 -0500 |
commit | 9830202b133db241493ca3f3d914e1cb1de35963 (patch) | |
tree | 0bb33e5ee852ea533f1f808a8e86e38c97699bb4 /roles/docker_img_monitoring | |
parent | 2848232bdaed44fadb51548fe9d6c39fe89b8e11 (diff) | |
parent | 023f92f9e3eec7de6c1286549000be79189a4fde (diff) | |
download | openshift-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/docker_img_monitoring')
9 files changed, 0 insertions, 201 deletions
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 <twiest@redhat.com> - -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 |