@@ -5,6 +5,22 @@
tags:
- vars
+- name: Set the pathname of the ephemeral ssh config file
+ ansible.builtin.set_fact:
+ kdevops_ssh_config: "{{ sshdir }}/config_kdevops_{{ topdir_path_sha256sum }}"
+ when:
+ - topdir_path_sha256sum is defined
+ tags:
+ - vars
+
+- name: Set the pathname of the ephemeral ssh config file
+ ansible.builtin.set_fact:
+ kdevops_ssh_config: "{{ sshdir }}/config_kdevops_{{ kdevops_host_prefix }}"
+ when:
+ - topdir_path_sha256sum is not defined
+ tags:
+ - vars
+
- name: Check that the user's ssh config file exists
delegate_to: localhost
run_once: true
@@ -104,3 +120,31 @@
Include ~/.ssh/config_kdevops_*
tags:
- deps
+
+- name: Remove saved keys for the target nodes
+ delegate_to: localhost
+ throttle: 1
+ ansible.builtin.command:
+ argv:
+ - "ssh-keygen"
+ - "-q"
+ - "-f"
+ - "{{ sshdir }}/known_hosts"
+ - "-R"
+ - "{{ inventory_hostname }}"
+ register: result
+ failed_when: false
+ changed_when:
+ - result is success
+ - not "not found in" in result.stderr
+ tags:
+ - clean
+
+- name: Remove the ephemeral ssh config file on the control host
+ delegate_to: localhost
+ run_once: true
+ ansible.builtin.file:
+ path: "{{ kdevops_ssh_config }}"
+ state: absent
+ tags:
+ - clean
@@ -23,6 +23,13 @@ endif
bringup: $(KDEVOPS_BRING_UP_DEPS)
destroy: $(KDEVOPS_DESTROY_DEPS)
+ $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
+ -i hosts \
+ playbooks/update_ssh_config.yml \
+ --extra-vars=@./extra_vars.yaml \
+ -e 'ansible_python_interpreter=/usr/bin/python3' \
+ --tags vars,clean
+ $(Q)rm -f $(KDEVOPS_PROVISIONED_SSH) $(KDEVOPS_PROVISIONED_DEVCONFIG)
bringup-help-menu:
@echo "Bringup targets:"
@@ -23,14 +23,8 @@ if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
fi
rm -rf "$GUESTFSDIR/$name"
rm -rf "$STORAGEDIR/$name"
- ssh-keygen -q -f ~/.ssh/known_hosts -R $name 1> /dev/null 2>&1
done
fi
-if [[ "$CONFIG_TOPDIR_PATH_HAS_SHA256SUM" == "y" ]]; then
- rm -f ~/.ssh/config_kdevops_$CONFIG_TOPDIR_PATH_SHA256SUM
-else
- rm -f ~/.ssh/config_kdevops_$CONFIG_KDEVOPS_HOSTS_PREFIX
-fi
rm -f $GUESTFSDIR/.provisioned_once
rm -f $GUESTFSDIR/kdevops_nodes.yaml
@@ -85,7 +85,6 @@ PHONY += bringup_guestfs
destroy_guestfs:
$(Q)$(TOPDIR)/scripts/destroy_guestfs.sh
- $(Q)rm -f $(KDEVOPS_PROVISIONED_SSH) $(KDEVOPS_PROVISIONED_DEVCONFIG)
PHONY += destroy_guestfs
@@ -166,7 +166,6 @@ bringup_terraform:
destroy_terraform:
$(Q)$(TOPDIR)/scripts/destroy_terraform.sh
- $(Q)rm -f $(KDEVOPS_PROVISIONED_DEVCONFIG)
$(KDEVOPS_TFVARS): $(KDEVOPS_TFVARS_TEMPLATE) .config
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \