Skip to content

Commit 394c5ff

Browse files
authored
Merge pull request #49 from stackhpc/docker-registry-auth
Docker registry auth
2 parents 093a358 + fef31a7 commit 394c5ff

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

roles/vault/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ Note that since version `4.6.4`, `ansible-modules-hashivault` requires
1212
Role variables
1313
--------------
1414

15+
* Common variables
16+
* Optional
17+
* `hashicorp_registry_url`: Address of the Docker registry used to authenticate (default: "")
18+
* `hashicorp_registry_username`: Username used to authenticate with the Docker registry (default: "")
19+
* `hashicorp_registry_password`: Password used to authenticate with the Docker registry (default: "")
20+
1521
* Consul
1622
* Optional
1723
* `consul_bind_interface`: Which interface should be used for Consul (default: "lo")
1824
* `consul_docker_name`: Docker - under which name to run the Consul image (default: "consul")
19-
* `consul_docker_image`: Docker image for Consul (default: "consul")
25+
* `consul_docker_image`: Docker image for Consul (default: "hashicorp/consul")
2026
* `consul_docker_tag`: Docker image tag for Consul (default: "latest")
2127
* `consul_docker_volume`: Docker volume name for Consul data (default: "consul_data")
2228
* `consul_container.etc_hosts`: Dict of `{<hostname>:<ip_address>}` to be added to container /etc/hosts (default: Omitted)
@@ -30,6 +36,9 @@ Role variables
3036
* `vault_bind_address`: Which IP address should Vault bind to (default: "127.0.0.1")
3137
* `vault_api_addr`: Vault [API addr](https://www.vaultproject.io/docs/configuration#api_addr) - Full URL including protocol and port (default: "http://127.0.0.1:8200")
3238
* `vault_init_addr`: Vault init addr (used only for initialisation purposes) - full URL including protocol and port (default: "http://127.0.0.1:8200")
39+
* `vault_docker_name`: Docker - under which name to run the Vault image (default: "vault")
40+
* `vault_docker_image`: Docker image for Vault (default: "hashicorp/vault")
41+
* `vault_docker_tag`: Docker image tag for Vault (default: "latest")
3342
* `consul_container.etc_hosts`: Dict; `{<hostname>:<ip_address>}` to be added to container /etc/host
3443
s (default: Omitted)
3544
* `vault_extra_volumes`: List of `"<host_location>:<container_mountpoint>"`

roles/vault/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
hashicorp_registry_url: ""
3+
hashicorp_registry_username: ""
4+
hashicorp_registry_password: ""
5+
26
consul_docker_name: "consul"
37
consul_docker_image: "hashicorp/consul"
48
consul_docker_tag: "latest"

roles/vault/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
- name: "Vault Prechecks"
33
import_tasks: prechecks.yml
44

5+
- name: "Vault Prerequisites"
6+
import_tasks: prereqs.yml
7+
58
- name: "Deploy Consul"
69
import_tasks: consul.yml
710

roles/vault/tasks/prereqs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Log into Docker registry
3+
docker_login:
4+
registry: "{{ hashicorp_registry_url }}"
5+
username: "{{ hashicorp_registry_username }}"
6+
password: "{{ hashicorp_registry_password }}"
7+
when: hashicorp_registry_username | length > 0
8+
become: true

0 commit comments

Comments
 (0)