diff --git a/roles/edpm_ssh_known_hosts/molecule/default/tests/test_default.py b/roles/edpm_ssh_known_hosts/molecule/default/tests/test_default.py index a595f610e..eaaeda1eb 100644 --- a/roles/edpm_ssh_known_hosts/molecule/default/tests/test_default.py +++ b/roles/edpm_ssh_known_hosts/molecule/default/tests/test_default.py @@ -25,9 +25,9 @@ def test_ssh_host_keys(host): expected = [ - '[10.0.0.1]*,[centos.ctlplane.localdomain]*,[10.0.1.1]*,[centos.internalapi.localdomain]*,[centos.localdomain]*,[instance]* ssh-rsa AAAATESTRSA', - '[10.0.0.1]*,[centos.ctlplane.localdomain]*,[10.0.1.1]*,[centos.internalapi.localdomain]*,[centos.localdomain]*,[instance]* ssh-ed25519 AAAATESTED', - '[10.0.0.1]*,[centos.ctlplane.localdomain]*,[10.0.1.1]*,[centos.internalapi.localdomain]*,[centos.localdomain]*,[instance]* ecdsa-sha2-nistp256 AAAATESTECDSA', + '10.0.0.1,centos.ctlplane.localdomain,10.0.1.1,centos.internalapi.localdomain,centos.localdomain,instance ssh-rsa AAAATESTRSA', + '10.0.0.1,centos.ctlplane.localdomain,10.0.1.1,centos.internalapi.localdomain,centos.localdomain,instance ssh-ed25519 AAAATESTED', + '10.0.0.1,centos.ctlplane.localdomain,10.0.1.1,centos.internalapi.localdomain,centos.localdomain,instance ecdsa-sha2-nistp256 AAAATESTECDSA', ] for line in expected: diff --git a/roles/edpm_ssh_known_hosts/molecule/no_networks/tests/test_no_networks.py b/roles/edpm_ssh_known_hosts/molecule/no_networks/tests/test_no_networks.py index d5682bac4..b0ab80371 100644 --- a/roles/edpm_ssh_known_hosts/molecule/no_networks/tests/test_no_networks.py +++ b/roles/edpm_ssh_known_hosts/molecule/no_networks/tests/test_no_networks.py @@ -25,7 +25,7 @@ def test_ssh_host_keys(host): expected = [ - '[instance]* ssh-rsa AAAATEST', + 'instance ssh-rsa AAAATEST', ] for line in expected: diff --git a/roles/edpm_ssh_known_hosts/tasks/main.yml b/roles/edpm_ssh_known_hosts/tasks/main.yml index 5b294b234..644907620 100644 --- a/roles/edpm_ssh_known_hosts/tasks/main.yml +++ b/roles/edpm_ssh_known_hosts/tasks/main.yml @@ -63,16 +63,16 @@ {% set enabled_host_networks = hostdata['edpm_role_networks']|default([]) %} {% for network in enabled_host_networks %} {% if (network ~ '_ip') in hostdata %} - {% set _ = entries.append('[' ~ hostdata[network ~ '_ip'] ~ ']*') %} + {% set _ = entries.append(hostdata[network ~ '_ip']) %} {% endif %} {% if (network ~ '_hostname') in hostdata %} - {% set _ = entries.append('[' ~ hostdata[network ~ '_hostname'] ~ ']*') %} + {% set _ = entries.append(hostdata[network ~ '_hostname']) %} {% endif %} {% endfor %} {% if 'canonical_hostname' in hostdata %} - {% set _ = entries.append('[' ~ hostdata['canonical_hostname'] ~ ']*') %} + {% set _ = entries.append(hostdata['canonical_hostname']) %} {% endif %} - {% set _ = entries.append('[' ~ host ~ ']*') %} + {% set _ = entries.append(host) %} {% set host = entries|unique|join(',') %} {% for key, type in key_types.items() %} {% if key in hostdata['ansible_facts'] %}