Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianshumate committed Feb 23, 2017
2 parents 6d56316 + 996a2d2 commit 36833a9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@

- Fix issue in wait_for (thanks @pierrefh)
- Add contributing guidelines in CONTRIBUTING.md
- Fix checksum var
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The role defines variables in `defaults/main.yml`:
| `vault_main_config` | `{{ vault_config_path }}/vault_main.hcl` | Main configuration file path |
| `vault_consul` | `127.0.0.1:8500` | Address of Consul backend |
| `vault_consul_path` | `vault` | Consul path to use |
| `vault_backend` | `backend_consul.j2` | Backend template filename |

### OS Distribution Variables

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

Specify a template file with a different backend definition
(see `templates/backend_consul.j2`):

```
ansible-playbook -i hosts site.yml --extra-vars "vault_backed=backend_file.j2"
```

You need to make sure that the template file `backend_file.j2` is in the
role directory for this to work.

### Vagrant and VirtualBox

See `examples/README_VAGRANT.md` for details on quick Vagrant deployments
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ vault_address: "0.0.0.0"
vault_port: "8200"
vault_node_name: "{{ inventory_hostname_short }}"
vault_main_config: "{{ vault_config_path }}/vault_main.hcl"
vault_primary_node: "{{hostvars[groups['primary'][0]]['ansible_fqdn']}}"
vault_primary_node: "{{hostvars[groups['primary'][0]]['ansible_fqdn']}}"
vault_backend: "consul"
3 changes: 2 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
connection: local
get_url:
url: "{{ vault_zip_url }}"
dest: "{{ role_path }}/files/{{ vault_pkg }} checksum=sha256:{{ vault_sha256.stdout.split(' ')|first }}"
dest: "{{ role_path }}/files/{{ vault_pkg }}"
checksum: "sha256:{{ vault_sha256.stdout.split(' ')|first }}"
timeout: 42
run_once: true
tags: installation
Expand Down
6 changes: 4 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
when: ansible_distribution == "Ubuntu" and ansible_distribution_version|version_compare(13.04, '<')

- name: Create cluster groupings
group_by: "key=os_{{ ansible_os_family }}"
group_by:
key: "os_{{ ansible_os_family }}"

- name: Create cluster groupings
group_by: "key={{ vault_node_role }}"
group_by:
key: "{{ vault_node_role }}"

- name: "Add Vault user"
user:
Expand Down
6 changes: 6 additions & 0 deletions templates/backend_consul.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
backend "consul" {
address = "127.0.0.1:8500"
redirect_addr = "http://{{ vault_address }}:{{ vault_port }}"
cluster_addr = "http://{{ vault_primary_node }}:{{ vault_port }}/"
path = "vault"
}
7 changes: 1 addition & 6 deletions templates/vault_main.hcl.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
backend "consul" {
address = "127.0.0.1:8500"
redirect_addr = "http://{{ vault_address }}:{{ vault_port }}"
cluster_addr = "http://{{ vault_primary_node }}:{{ vault_port }}/"
path = "vault"
}
{% include backend_{{ vault_backend }}.j2 with context %}

cluster_name = "sutakku"

Expand Down

0 comments on commit 36833a9

Please sign in to comment.