#10995 ansible.git basessh role issues
Closed: Fixed with Explanation by kevin. Opened by praiskup.

Seems like there's something broken with basessh role in ansible.git:

$ sudo rbac-playbook groups/copr-hypervisor.yml
TASK [basessh : Get public keys for certs to sign] *****************************************************************************************************************************************************************************************
Friday 18 November 2022  10:14:07 +0000 (0:00:00.297)       0:01:51.093 ******* 
Friday 18 November 2022  10:14:07 +0000 (0:00:00.297)       0:01:51.093 ******* 
failed: [vmhost-x86-copr02.rdu-cc.fedoraproject.org] (item=[] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]) => {"ansible_loop_var": "item", "changed": false, "item": "[] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]", "msg": "the remote file does not exist, not transferring, ignored"}
failed: [vmhost-x86-copr03.rdu-cc.fedoraproject.org] (item=[] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]) => {"ansible_loop_var": "item", "changed": false, "item": "[] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]", "msg": "the remote file does not exist, not transferring, ignored"}
failed: [vmhost-x86-copr04.rdu-cc.fedoraproject.org] (item=[] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]) => {"ansible_loop_var": "item", "changed": false, "item": "[] + [ '/etc/ssh/ssh_host_ecdsa_key' ] + [ '/etc/ssh/ssh_host_ed25519_key' ] + [ '/etc/ssh/ssh_host_rsa_key' ]", "msg": "the remote file does not exist, not transferring, ignored"}

I did not have the time to take a closer look yet (not a blocker atm) so at least I'm reporting.


I've downgraded ansible-core for now until we can sort this out.

This is solved with some help from @gotmax23 :)

It was due to the way we were quoting the variables in the loop.

foo: []
foo: "{{ foo }} + {{['bar']}}

gave you '[ '', 'bar']

So, we changed it to:

foo: []
foo: "{{ foo + [bar] }}"

and that correctly gives just '['bar']'

Metadata Update from @kevin:
- Issue close_status updated to: Fixed with Explanation
- Issue status updated to: Closed (was: Open)

Thanks for fixing!

Metadata