diff --git a/inventory/inventory b/inventory/inventory index 55d40e1..4d30d29 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -7,6 +7,8 @@ doc ansible_user=pollen [local] proxmox ansible_user=root pihole ansible_user=pollen +bastion ansible_user=mango +debianV ansible_user=ansible [windows] bane ansible_user=ansible ansible_connection=winrm ansible_winrm_transport=basic ansible_port=5985 ansible_winrm_server_cert_validation=ignore diff --git a/playbooks/setup_keys.yml b/playbooks/setup_keys.yml new file mode 100644 index 0000000..ac1f317 --- /dev/null +++ b/playbooks/setup_keys.yml @@ -0,0 +1,18 @@ +--- +- name: Sets up access to managed nodes on the control node + hosts: all + become: yes + gather_facts: true + tasks: + - name: create ansible user on managed nodes + ansible.builtin.user: + name: ansible + shell: /bin/bash + groups: sudo + append: yes + + - name: set authorized key for ansible user + ansible.posix.authorized_key: + user: ansible + state: present + key: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/id_rsa.pub') }}"