๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/tasks/gen_ssh_key.yml

24 lines
704 B

- block:
- name: ensure ansible key directory exists
file:
path: "{{ (ansible_dir, ansible_key_dir) | path_join }}"
state: directory
mode: 0400
- name: ensure ssh key for this host exists
community.crypto.openssh_keypair:
path: "{{ (ansible_dir, ansible_key_dir, inventory_hostname) | path_join }}"
comment: "{{ inventory_hostname }} ssh key for ansible management"
mode: 0400
regenerate: full_idempotence
type: ed25519
register: container_key
- name: fail if public key is missing
fail:
msg: public key is missing
when: container_key.public_key is not defined
delegate_to: localhost