--- - name: fetch ssh host key command: cat "{{ root_target_directory }}/etc/ssh/ssh_host_{{ ssh_host_key_type }}_key.pub" register: _ssh_host_key_cat_result changed_when: false - name: set ssh_host_key_ed25519_public set_fact: ssh_host_key_ed25519_public: "{{ _ssh_host_key_cat_result.stdout.split()[1] }}" changed_when: ssh_host_key_ed25519_public != _ssh_host_key_cat_result.stdout.split()[1] when: ssh_host_key_type == "ed25519"