Hi All,
Could someone please give me a hand in refactoring the below task as I’m getting the below warning message, and I can’t figure this out (and the provide (simplified) example doesn’t really help (me - brain went “duuurrr”))
The task:
- name: Install User Public Key
ansible.posix.authorized_key:
exclusive: true
key: "{{lookup('file','public_keys/{{ USER_NAME }}_ssh_key.public')}}"
The warning:
[WARNING]: Jinja constant strings should not contain embedded templates. This feature will be disabled by default in ansible-core 2.23.
Use inline expressions, for example: `msg: "{{ lookup('env', '{{ a_var }}') }}"` becomes `msg:"{{ lookup('env', a_var) }}"`
Can you, for example, use the below, because if so then that (to me) is really un-intuitive?
key: "{{lookup('file','public_keys/USER_NAME_ssh_key.public')}}"
Thank you in advance
Cheers
Dulux-Oz