Skip to content

Commit

Permalink
ansible: add support for bastion hosts when running authorized_key
Browse files Browse the repository at this point in the history
  • Loading branch information
davidumea committed Nov 7, 2024
1 parent 3fd7dc7 commit 596c97c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion playbooks/authorized_key.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Original idea found at http://stackoverflow.com/a/39083724
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
ssh_known_hosts_file: "{{ lookup('env','HOME') + '/.ssh/known_hosts' }}"
Expand All @@ -16,6 +15,7 @@
until: ssh_known_host_results.rc == 0
tags:
- ssh
delegate_to: "{{ 'bastion' if groups['bastion'] is defined else omit }}"

- name: Remove the public key in the '{{ ssh_known_hosts_file }}'
known_hosts:
Expand Down

0 comments on commit 596c97c

Please sign in to comment.