Error while executing my PB

Hi all, I’m facing this error while I’m executing my PB:

TASK [Exchange intersec keys between servers] ***********************************************************************************************************************************************

fatal: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘ansible.vars.hostvars.HostVarsVars object’ has no attribute ‘ssh_keys’\n\nThe error appears to have been in ‘/home/intersec/dev/project/one/orange-jo-georeach-one/ansible/plays/ansible-bootstrap.yml’: line 50, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Exchange {{ user }} keys between servers\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - "{{ foo }}"\n”}
to retry, use: --limit @/home/intersec/dev/project/one/orange-jo-georeach-one/ansible/plays/ansible-bootstrap.retry

My PB

  • name: Exchange {{ user }} keys between servers
    authorized_key:
    user: “{{ user }}”
    key: “{{ hostvars[item][‘ssh_keys’][‘content’] | b64decode }}”
    with_items: “{{ groups[‘all’] }}”
    tags:
  • ssh_keys

Could you please help me
Thanks in advance !

Where is your authorized_key module? Have you provided correct module path in ansible.cfg file?

If you have not provided proper path, provide it in ansible.cfg file in library section.

Sample

#library = /var/lib/awx/projects/test-ansible/modules/

Thanks,
Rajas

Also try giving “{{ user }}” in name section.

Thanks,
Rajas