aws_cloud: drop additional (-temp) known hosts entries

This commit is contained in:
Pavel Raiskup 2023-11-21 14:37:59 +01:00
parent 2f32aeec00
commit c28c90504b
2 changed files with 16 additions and 1 deletions

View file

@ -1,9 +1,12 @@
# Put here configuration for all copr instances (production, devel, ...)
---
postfix_group: copr
postfix_maincf: postfix/main.cf/main.cf.copr_smtp_auth_relay
#TODO: tamplatize main.cf
smtp_auth_relay_host: smtp-auth-cc-rdu01.fedoraproject.org
smtp_auth_relay_user: copr@fedoraproject.org
smtp_auth_relay_password: "{{ copr_smtp_password }}"
additional_known_hosts_cleanup:
copr-be-dev.aws.fedoraproject.org:
- copr-be-dev-temp.aws.fedoraproject.org

View file

@ -18,6 +18,18 @@
- /root/.ssh/known_hosts
when: birthday is defined
- name: birthday=on - drop other known host entries
local_action: known_hosts path={{ item.0 }}
host={{ item.1 }}
state=absent
with_nested:
- [/root/.ssh/known_hosts]
- "{{ additional_known_hosts_cleanup[inventory_hostname] }}"
when:
- additional_known_hosts_cleanup is defined
- additional_known_hosts_cleanup[inventory_hostname] is defined
- name: gather the temporary ssh host key from the new instance
local_action: command ssh-keyscan -t {{ item }} {{ inventory_hostname }}
register: hostkey