diff --git a/inventory/group_vars/copr_all_instances_aws b/inventory/group_vars/copr_all_instances_aws index cd669c626b..66286ebbc8 100644 --- a/inventory/group_vars/copr_all_instances_aws +++ b/inventory/group_vars/copr_all_instances_aws @@ -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 diff --git a/tasks/aws_cloud.yml b/tasks/aws_cloud.yml index 8d076e1aa3..9d0866a184 100644 --- a/tasks/aws_cloud.yml +++ b/tasks/aws_cloud.yml @@ -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