browbeat/ansible/install/roles/graphite_docker/tasks/main.yml
jkilpatr 7e7c6230cb Refactor EPEL into a role
Fixes bug 1605228, where if the user installs epel-relase from the Centos7 default
packages rather than from the latest rpm online packages the latest epel-release
from the rpm installs on top of it but does not provide newer packages.

But that's not what you care about, the big change that comes with this bugfix is a
refactoring of every playbook that uses EPEL to all call a single role which both
installs epel and setups a handler to cleanup epel when the set of roles is done.

This unifies and cleans up what was previously two ways of installing EPEL, two
ways of disabling it all duplicating across more than half a dozen roles. Some of
of which used the epel_rpm variable some of which did not. The resulting combined
role still uses the rpm command and as such inherits some hackiness in an effort
to keep everything working as it was before just with better organization.

This has been tested with very playbook modified here against my own cloud. Don't
consider this final since trying to install every single one of these to a single
virtual undercloud generated lots of other problems, but none of them failed on EPEL
or package related issues.

Change-Id: Ic592a97875a9ec783519f618260713277589c83e
2016-07-21 15:58:37 -04:00

112 lines
3.2 KiB
YAML

---
#
# Install/run graphite-web for browbeat
#
- name: Install repo file for docker
copy:
src=docker.repo
dest=/etc/yum.repos.d/docker.repo
owner=root
group=root
mode=0644
become: true
# disable firewalld (might need to create specific firewall rules or leave it to admin to do via iptables)
- name: disable firewalld
service: name=firewalld state=stopped enabled=false
become: true
ignore_errors: true
- name: Install docker rpm
yum: name={{ item }} state=present
become: true
with_items:
- docker-engine
# Start docker service
- name: Setup docker service
service: name=docker state=started enabled=true
become: true
- name: ensure data directory exists
file: path={{ persistent_carbon_data_path }} state=directory mode=0777
- name: ensure docker overrides for carbon-cache
file: path=/etc/docker/carbon-cache state=directory mode=0755
- name: Install carbon.conf
copy:
src=carbon.conf
dest=/etc/docker/carbon-cache/carbon.conf
owner=root
group=root
mode=0644
become: true
- name: Install storage-schemas.conf
copy:
src=storage-schemas.conf
dest=/etc/docker/carbon-cache/storage-schemas.conf
owner=root
group=root
mode=0644
become: true
- name: check active containers
command: /usr/bin/docker ps -a --format '{{ "{{" }}.Names{{ "}}" }}'
register: docker_ps_a
- name: start carbon-cache docker container
command: "{{item}}"
ignore_errors: true
with_items:
- docker kill carbon-cache
- docker rm carbon-cache
- sleep 5
- docker run -d --name carbon-cache -p {{ docker_carbon_cache_port }}:2003 -v /etc/docker/carbon-cache/carbon.conf:/etc/carbon/carbon.conf -v /etc/docker/carbon-cache/storage-schemas.conf:/etc/carbon/storage-schemas.conf -v {{ persistent_carbon_data_path }}:/var/lib/carbon/whisper {{ carbon_cache_docker_image }}
when: '"carbon-cache" not in docker_ps_a.stdout'
- name: start graphite-web docker container
command: "{{item}}"
ignore_errors: true
with_items:
- docker kill graphite-web
- docker rm graphite-web
- sleep 5
- docker run -d --name graphite-web -p {{ docker_graphite_port }}:80 -v {{ persistent_carbon_data_path }}:/var/lib/carbon/whisper {{ graphite_web_docker_image }}
when: '"graphite-web" not in docker_ps_a.stdout'
- name: Setup graphite-web systemd config
template:
src=graphite-web.service.j2
dest=/etc/systemd/system/graphite-web.service
owner=root
group=root
mode=0644
become: true
register: systemd_graphite_needs_restart
- name: bounce systemd and graphite-web container
shell: /usr/bin/systemctl daemon-reload && /usr/bin/systemctl enable graphite-web && /usr/bin/systemctl restart graphite-web
become: true
when: systemd_graphite_needs_restart.changed
- name: Setup carbon-cache systemd config
template:
src=carbon-cache.service.j2
dest=/etc/systemd/system/carbon-cache.service
owner=root
group=root
mode=0644
become: true
register: systemd_carbon_needs_restart
- name: bounce systemd and carbon-cache container
shell: /usr/bin/systemctl daemon-reload && /usr/bin/systemctl enable carbon-cache && /usr/bin/systemctl restart carbon-cache
become: true
when: systemd_carbon_needs_restart.changed