As described in the ansible documentation for routeros I need to add +cet512w
to my ansible_user. But I do not want to hardcode the user in every routeros play[book] so I use {{ ansible_user }}
everywhere. Is it possible to concat that +cet512w
string to the ansible_user variable in only the routeros play[book]s by setting the variable? Or would it be somehow possible to concat it in group_vars or in inventory? If yes, then how?
following does not work:
- name: RouterOS - my playbook
hosts: routeros
vars:
- ansible_connection: ansible.netcommon.network_cli
- ansible_network_os: community.network.routeros
- ansible_user: "{{ ansible_user + '+cet512w' }}"
and gives this error msg:
FAILED! => {"msg": "An unhandled exception occurred while templating '{{ ansible_user }} + '+cet512w''. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{{ ansible_user }} + '+cet512w''. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception...