playbooks;inventory: added variable to production.yaml and added create-ssh-key playbook
The production inventory got a new variable called host_name which we use in the newly added playbook creating an SSH key. The playbook holds the no_log tag for keeping the execution parts more secure. Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
parent
70d033bde7
commit
f691f5206c
|
|
@ -3,3 +3,4 @@ linux:
|
||||||
192.168.40.221:
|
192.168.40.221:
|
||||||
rls_info_path: /etc/os-release
|
rls_info_path: /etc/os-release
|
||||||
user_name: user
|
user_name: user
|
||||||
|
host_name: testvm
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
- name: Create SSH Keypair
|
||||||
|
hosts: linux
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
ssh_passphrase: !vault |
|
||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
61323235356163363166663139613464303262333231656236313335313133373330316431333139
|
||||||
|
3135643639363966653938663666653831393132633765340a306665393864343466376637386661
|
||||||
|
39353535616366393631333161613065356666626266396138633866346462316365663339613263
|
||||||
|
6564643935326565630a386266376230613230336564363066373730363239303763663666363462
|
||||||
|
35353634626464656436633165316336323839616463333064633363306337353534
|
||||||
|
tasks:
|
||||||
|
- name: Generate ssh keypair on host
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
ssh-keygen -t ed25519 -f "{{host_name}}_ed25519" -N "{{ssh_passphrase}}" -C "{{host_name}}@testenv"
|
||||||
|
args:
|
||||||
|
chdir: ~/.ssh
|
||||||
|
executable: /bin/bash
|
||||||
|
no_log: True
|
||||||
Loading…
Reference in New Issue