Skip to content

Instantly share code, notes, and snippets.

@vallard
Created January 22, 2016 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vallard/0dfefd96d5da2dce0ff6 to your computer and use it in GitHub Desktop.
Save vallard/0dfefd96d5da2dce0ff6 to your computer and use it in GitHub Desktop.
---
- name: remove old consul
sudo: yes
yum:
name: "{{ item }}"
state: absent
with_items:
- consul-0.5.2-3.el7.centos.x86_64
- consul-ui-0.5.2-3.el7.centos.x86_64
- consul-ui-0.5.2-4.el7.centos.x86_64
- consul-utils-0.1.0-1.el7.centos.x86_64
- consul-utils-0.1.0-1.el7.centos.x86_64
- consul-template-0.8.0-2.el7.centos.x86_64
- name: install consul
sudo: yes
yum:
name: "{{ item }}"
state: present
with_items:
- https://bintray.com/artifact/download/asteris/mantl-rpm/consul-0.6.0-2.centos.x86_64.rpm
- https://bintray.com/artifact/download/asteris/mantl-rpm/consul-cli-0.1.0-1.x86_64.rpm
tags:
- consul
- bootstrap
- name: configure consul
sudo: yes
template:
src: "{{ item }}.j2"
dest: /etc/consul/{{ item }}
owner: consul
group: consul
with_items:
- consul.json
- acl.json
notify:
- restart consul
tags:
- consul
- name: register docker with consul
sudo: yes
copy:
src: docker-service.json
dest: /etc/consul
owner: consul
group: consul
notify:
- reload consul
tags:
- consul
- name: deploy tls files
sudo: yes
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: consul
group: consul
with_items:
- src: ssl/cacert.pem
dest: /etc/consul/ssl/{{ consul_ca_file }}
- src: ssl/certs/consul.cert.pem
dest: /etc/consul/ssl/{{ consul_cert_file }}
- src: ssl/private/consul.key.pem
dest: /etc/consul/ssl/{{ consul_key_file }}
notify:
- restart consul
tags:
- consul
- name: install scripts
sudo: yes
copy:
src: "{{ item }}"
dest: /usr/local/bin/
mode: u=rwx,g=rx,o=rx
with_items:
- consul-wait-for-leader.sh
- consul-rolling-restart.sh
- check-service-active
tags:
- consul
- name: enable consul
sudo: yes
service:
name: consul
enabled: yes
state: started
tags:
- consul
- meta: flush_handlers
tags:
- consul
# Give consul time to elect a leader
- name: wait for leader
command: /usr/local/bin/consul-wait-for-leader.sh
tags:
- consul
- include: acl.yml
- meta: flush_handlers
tags:
- consul
- include: nginx_proxy.yml
# symlink to distributive checklist, register check with Consul
- include: distributive.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment