Change to inventory name, Fix hostname magic variable
This commit is contained in:
parent
503e6cd61a
commit
f2e219ddf4
@ -74,27 +74,27 @@ testing: # or production or any other sensible group name
|
||||
ansible_ssh_private_key_file: # ~/.ssh/id_$NEW_ANSIBLE_USER@$NEW_ANSIBLE_HOST
|
||||
----
|
||||
|
||||
. Create a directory for the host `mkdir host_vars/$NEW_ANSIBLE_HOST`
|
||||
. Create a directory for the host `mkdir host_vars/$NEW_ANSIBLE_INV_NAME`
|
||||
|
||||
. Copy the basic config file
|
||||
+
|
||||
[,bash]
|
||||
----
|
||||
cp host_vars/variables.yaml.template host_vars/$NEW_ANSIBLE_HOST/variables.yaml
|
||||
cp host_vars/variables.yaml.template host_vars/$NEW_ANSIBLE_INV_NAME/variables.yaml
|
||||
----
|
||||
|
||||
. Create the vault to store passwords needed by ansible
|
||||
+
|
||||
[,bash]
|
||||
----
|
||||
ansible-vault encrypt host_vars/secrets.yaml.template --output host_vars/$NEW_ANSIBLE_HOST/secrets.yaml
|
||||
ansible-vault encrypt host_vars/secrets.yaml.template --output host_vars/$NEW_ANSIBLE_INV_NAME/secrets.yaml
|
||||
----
|
||||
|
||||
. Edit the vault
|
||||
+
|
||||
[,bash]
|
||||
----
|
||||
ansible-vault edit host_vars/$NEW_ANSIBLE_HOST/secrets.yaml
|
||||
ansible-vault edit host_vars/$NEW_ANSIBLE_INV_NAME/secrets.yaml
|
||||
# Generate a new password for every entry (preferably A-z0-9 to avoid escape mishaps)
|
||||
----
|
||||
|
||||
@ -116,7 +116,7 @@ Host # e.g. $NEW_ANSIBLE_HOST
|
||||
|
||||
=== Run ansible (finally)
|
||||
|
||||
If you don't want to make any changes in `host_vars/$NEW_ANSIBLE_HOST/variables.yaml` you can now run the playbook with the following command:
|
||||
If you don't want to make any changes in `host_vars/$NEW_ANSIBLE_INV_NAME/variables.yaml` you can now run the playbook with the following command:
|
||||
[,bash]
|
||||
----
|
||||
ansible-playbook playbooks/main.yaml --ask-vault-pass
|
||||
|
@ -1,3 +1,3 @@
|
||||
---
|
||||
# you have to generate the SSH-keys yourself
|
||||
publisher_ssh_keys: ["~/.ssh/id_publisher@{{ ansible_hostname }}.pub"]
|
||||
publisher_ssh_keys: ["~/.ssh/id_publisher@{{ ansible_host }}.pub"] # or {{ inventory_hostname }}
|
||||
|
Loading…
Reference in New Issue
Block a user