Add userpass login to Vault
This commit is contained in:
parent
7356b8d407
commit
c21ed2fa3f
8
acls/vault_login.tf
Normal file
8
acls/vault_login.tf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
resource "vault_auth_backend" "userpass" {
|
||||||
|
type = "userpass"
|
||||||
|
|
||||||
|
tune {
|
||||||
|
max_lease_ttl = "1h"
|
||||||
|
listing_visibility = "unauth"
|
||||||
|
}
|
||||||
|
}
|
9
acls/vault_policies.tf
Normal file
9
acls/vault_policies.tf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
resource "vault_policy" "admin" {
|
||||||
|
name = "admin"
|
||||||
|
|
||||||
|
policy = <<EOF
|
||||||
|
path "*" {
|
||||||
|
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
@ -57,3 +57,11 @@
|
|||||||
data:
|
data:
|
||||||
"{{ item.value }}"
|
"{{ item.value }}"
|
||||||
loop: "{{ hashi_vault_values | default({}) | dict2items }}"
|
loop: "{{ hashi_vault_values | default({}) | dict2items }}"
|
||||||
|
|
||||||
|
- name: Write userpass
|
||||||
|
community.hashi_vault.vault_write:
|
||||||
|
url: "http://{{ inventory_hostname }}:8200"
|
||||||
|
token: "{{ root_token }}"
|
||||||
|
path: "auth/userpass/users/{{ item.name }}"
|
||||||
|
data: '{"password": "{{ item.password }}", "policies": "{{ item.policies }}"}'
|
||||||
|
loop: "{{ vault_userpass }}"
|
||||||
|
@ -16,3 +16,8 @@ hashi_vault_values:
|
|||||||
alert_email_addresses: email@example.com
|
alert_email_addresses: email@example.com
|
||||||
backups:
|
backups:
|
||||||
backup_passphrase: tellnoone
|
backup_passphrase: tellnoone
|
||||||
|
|
||||||
|
vault_userpass:
|
||||||
|
- name: admin
|
||||||
|
password: foo
|
||||||
|
policies: default
|
||||||
|
Loading…
Reference in New Issue
Block a user