Skip to content

Commit 8c9febb

Browse files
author
Bryan Kendall
committed
add playbook to get values out of consul
1 parent a1216ed commit 8c9febb

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

ansible/consul-values.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 }}"

ansible/getVersions.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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)

0 commit comments

Comments
 (0)