File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -66,3 +66,26 @@ tasks:
66
66
" host " :
67
67
help : " Host name or group name"
68
68
steps : ansible-playbook ./playbooks/encrypt-disks.yml --limit=$ARG_HOST -i inventory/hosts.cfg ${ARG_ARGS}
69
+
70
+ :node:edit:host-config :
71
+ description : Edit an encrypted host_var file
72
+ arguments :
73
+ " host " :
74
+ help : " Host name or group name"
75
+ steps : |
76
+ inventory_path=./inventory/host_vars/${ARG_HOST}.yaml
77
+
78
+ if [[ ! -f "${inventory_path}" ]]; then
79
+ echo " >> ${inventory_path} does not exist yet, creating - you will be prompted for password multiple times"
80
+ touch "${inventory_path}"
81
+ ansible-vault encrypt "${inventory_path}"
82
+
83
+ elif [[ "$(cat $inventory_path)" != *"ANSIBLE_VAULT"* ]]; then
84
+ echo " >> ${inventory_path} is not an encrypted file, encrypting - you will be prompted for password multiple times"
85
+ ansible-vault encrypt "${inventory_path}"
86
+ fi
87
+
88
+ set -x;
89
+ export EDITOR=${TEXT_EDITOR};
90
+ ansible-vault edit "${inventory_path}"
91
+ cd inventory && git add host_vars/${ARG_HOST}.yaml
Original file line number Diff line number Diff line change @@ -106,6 +106,15 @@ With this combination you can divide access to multiple admins handling administ
106
106
nano .env
107
107
```
108
108
109
+ Editing inventory per host
110
+ --------------------------
111
+
112
+ This command will automatically encrypt existing and new file using AES-256 with Ansible Vault.
113
+
114
+ ``` bash
115
+ rkd :edit:host-config my-host.org
116
+ ```
117
+
109
118
Deploying
110
119
---------
111
120
You can’t perform that action at this time.
0 commit comments