Hi all,
If someone could help me on the following:
I am trying to automate as maximum as possible the addition of authorized keys to my new remote servers by doing the below playbook, but I am getting the following error:
===============================================================
fatal: [web]: FAILED! => {"failed": true, "msg": "'list object' has no attribute 'name'"}
fatal: [db]: FAILED! => {"failed": true, "msg": "'list object' has no attribute 'name'"}
===============================================================
I've tried playing with the list of variables, tried also new loop with_item after the with_file, still no good luck, could someone please tell me how can I achieve my goal by having authorized_key module going to each file without specifying each time the full address like public_keys/web/authorized_key
- hosts: all
vars:
pcs:
- name: web
- name: db
tasks:
- name: Set up authorized_keys for the deploy user
authorized_key: user=root key="{{ item }}"
with_file:
- public_keys/{{
pcs.name }}/authorized_key