File tree Expand file tree Collapse file tree
container_kill_start/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020[api]
2121beta-api
2222
23+ [consul]
24+ beta-services
25+ beta-api
26+ beta-web
27+
28+ [vault]
29+ beta-services
30+
2331[worker]
2432beta-api
2533
Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : " {{ target }}"
3+ tasks :
4+ - name : make sure `jq` is present
5+ apt :
6+ name=jq
7+ state=present
8+
9+ - name : get versions in ansible
10+ script : getVersions {{ ansible_default_ipv4.address }}
11+ register : versions_result
12+
13+ - name : print versions to stdout
14+ debug :
15+ msg="Versions in Consul\n{{ versions_result.stdout }}"
Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : consul
3+ serial : 1
4+ vars_files :
5+ - group_vars/alpha-consul.yml
6+ roles :
7+ - { role: notify, tags: notify }
8+ - { role: database }
9+ - { role: container_kill_start, tags: deploy }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ consul=localhost:8500/v1
4+
5+ if [[ $1 != " " ]]; then
6+ consul=$1 :8500/v1
7+ fi
8+
9+ kv=$consul /kv
10+
11+ echo NODE_ENV: $( curl -s $kv /node/env | jq -r ' .[0].Value' | base64 -d)
12+
13+ echo image-builder: $( curl -s $kv /image-builder/version | jq -r ' .[0].Value' | base64 -d)
14+ echo docker-listener: $( curl -s $kv /docker-listener/version | jq -r ' .[0].Value' | base64 -d)
15+ echo filibuster: $( curl -s $kv /filibuster/version | jq -r ' .[0].Value' | base64 -d)
16+ echo krain: $( curl -s $kv /krain/version | jq -r ' .[0].Value' | base64 -d)
17+ echo sauron: $( curl -s $kv /sauron/version | jq -r ' .[0].Value' | base64 -d)
18+ echo charon: $( curl -s $kv /charon/version | jq -r ' .[0].Value' | base64 -d)
Original file line number Diff line number Diff line change 1+ name : consul
2+
3+ # for database role
4+ db_path : /etc/consul.d
5+
6+ # for container_kill_start
7+ pause_length_minutes : 3
8+
9+ container_image : progrium/consul
10+ container_tag : latest
11+
12+ container_run_opts : >
13+ -d
14+ -h {{ inventory_hostname }}
15+ -v /consul:/data
16+ -v /etc/consul.d:/etc/consul.d:ro
17+ -p {{ ansible_default_ipv4.address }}:8300:8300
18+ -p {{ ansible_default_ipv4.address }}:8301:8301
19+ -p {{ ansible_default_ipv4.address }}:8301:8301/udp
20+ -p {{ ansible_default_ipv4.address }}:8302:8302
21+ -p {{ ansible_default_ipv4.address }}:8302:8302/udp
22+ -p {{ ansible_default_ipv4.address }}:8400:8400
23+ -p {{ ansible_default_ipv4.address }}:8500:8500
24+ --restart=always
25+
26+ container_run_args : >
27+ -server
28+ -node {{ inventory_hostname }}
29+ -advertise {{ ansible_default_ipv4.address }}
30+ -config-dir /etc/consul.d
31+ {% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] == ansible_default_ipv4.address %}-bootstrap-expect {{ groups['consul'] | length }}{% endif %}
32+ -data-dir /data
33+ {% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] == ansible_default_ipv4.address %}-ui-dir /ui{% endif %}
34+ {% if hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] != ansible_default_ipv4.address %}-retry-join {{ hostvars[groups['consul'][0]]['ansible_default_ipv4']['address'] }}{% endif %}
Original file line number Diff line number Diff line change 1+ name : vault
2+
3+ # for database role
4+ db_path : /opt/runnable/vault
5+
6+ container_image : runnable/vault
7+ container_tag : v0.3.1
8+
9+ container_run_opts : >
10+ -d
11+ -h {{ inventory_hostname }}
12+ -v /opt/runnable/vault/vault.hcl:/vault.hcl:ro
13+ -p {{ ansible_default_ipv4.address }}:8200:8200
14+ --cap-add IPC_LOCK
15+ --restart=always
16+
17+ container_run_args : >
18+ server
19+ -log-level=warn
20+ -config=/vault.hcl
Original file line number Diff line number Diff line change 2626[api]
2727alpha-api
2828
29+ [consul]
30+ alpha-api-old
31+ alpha-api
32+ alpha-web
33+
34+ [vault]
35+ alpha-api-old
36+
2937[worker]
3038alpha-api
3139
Original file line number Diff line number Diff line change 4646 command : sudo docker rm {{ item }}
4747 with_items : old_containers_id.stdout_lines
4848
49+ - name : pause to allow for any odd conditions in system caching tables
50+ when : pause_length_minutes is defined and old_containers_id.changed
51+ pause : minutes={{pause_length_minutes}}
52+
4953# start our new container with options and args
5054- name : start container
5155 command : >
Original file line number Diff line number Diff line change 1+ - name : copy vault config
2+ sudo : yes
3+ template :
4+ src=vault.hcl
5+ dest=/opt/runnable/vault/vault.hcl
Original file line number Diff line number Diff line change 1+ backend "consul" {
2+ address = " {{ ansible_default_ipv4.address }}:8500"
3+ path = " vault"
4+ advertise_addr = " http://{{ ansible_default_ipv4.address }}:8200"
5+ }
6+
7+ listener "tcp" {
8+ address = " 0.0.0.0:8200"
9+ tls_disable = 1
10+ }
You can’t perform that action at this time.
0 commit comments