Skip to content

Commit 36833a9

Browse files
committed
Merge branch 'devel'
2 parents 6d56316 + 996a2d2 commit 36833a9

File tree

7 files changed

+27
-10
lines changed

7 files changed

+27
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,4 @@
101101

102102
- Fix issue in wait_for (thanks @pierrefh)
103103
- Add contributing guidelines in CONTRIBUTING.md
104+
- Fix checksum var

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The role defines variables in `defaults/main.yml`:
4747
| `vault_main_config` | `{{ vault_config_path }}/vault_main.hcl` | Main configuration file path |
4848
| `vault_consul` | `127.0.0.1:8500` | Address of Consul backend |
4949
| `vault_consul_path` | `vault` | Consul path to use |
50+
| `vault_backend` | `backend_consul.j2` | Backend template filename |
5051

5152
### OS Distribution Variables
5253

@@ -95,6 +96,16 @@ You can also pass variables in using the `--extra-vars` option to the
9596
ansible-playbook -i hosts site.yml --extra-vars "vault_datacenter=maui"
9697
```
9798

99+
Specify a template file with a different backend definition
100+
(see `templates/backend_consul.j2`):
101+
102+
```
103+
ansible-playbook -i hosts site.yml --extra-vars "vault_backed=backend_file.j2"
104+
```
105+
106+
You need to make sure that the template file `backend_file.j2` is in the
107+
role directory for this to work.
108+
98109
### Vagrant and VirtualBox
99110

100111
See `examples/README_VAGRANT.md` for details on quick Vagrant deployments

defaults/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ vault_address: "0.0.0.0"
2424
vault_port: "8200"
2525
vault_node_name: "{{ inventory_hostname_short }}"
2626
vault_main_config: "{{ vault_config_path }}/vault_main.hcl"
27-
vault_primary_node: "{{hostvars[groups['primary'][0]]['ansible_fqdn']}}"
27+
vault_primary_node: "{{hostvars[groups['primary'][0]]['ansible_fqdn']}}"
28+
vault_backend: "consul"

tasks/install.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
connection: local
4848
get_url:
4949
url: "{{ vault_zip_url }}"
50-
dest: "{{ role_path }}/files/{{ vault_pkg }} checksum=sha256:{{ vault_sha256.stdout.split(' ')|first }}"
50+
dest: "{{ role_path }}/files/{{ vault_pkg }}"
51+
checksum: "sha256:{{ vault_sha256.stdout.split(' ')|first }}"
5152
timeout: 42
5253
run_once: true
5354
tags: installation

tasks/main.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
when: ansible_distribution == "Ubuntu" and ansible_distribution_version|version_compare(13.04, '<')
2323

2424
- name: Create cluster groupings
25-
group_by: "key=os_{{ ansible_os_family }}"
25+
group_by:
26+
key: "os_{{ ansible_os_family }}"
2627

2728
- name: Create cluster groupings
28-
group_by: "key={{ vault_node_role }}"
29+
group_by:
30+
key: "{{ vault_node_role }}"
2931

3032
- name: "Add Vault user"
3133
user:

templates/backend_consul.j2

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
backend "consul" {
2+
address = "127.0.0.1:8500"
3+
redirect_addr = "http://{{ vault_address }}:{{ vault_port }}"
4+
cluster_addr = "http://{{ vault_primary_node }}:{{ vault_port }}/"
5+
path = "vault"
6+
}

templates/vault_main.hcl.j2

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
backend "consul" {
2-
address = "127.0.0.1:8500"
3-
redirect_addr = "http://{{ vault_address }}:{{ vault_port }}"
4-
cluster_addr = "http://{{ vault_primary_node }}:{{ vault_port }}/"
5-
path = "vault"
6-
}
1+
{% include backend_{{ vault_backend }}.j2 with context %}
72

83
cluster_name = "sutakku"
94

0 commit comments

Comments
 (0)