piframe/ansible/playbooks/setup-ansible.yml
2020-08-04 18:58:38 +00:00

22 lines
595 B
YAML

---
- hosts: all
become: yes
tasks:
- name: Add ansible user to PiFrame
user:
name: ansible
groups:
- sudo
shell: /bin/bash
- name: Add ansible ssh key as authorized key
authorized_key:
user: ansible
key: "{{ lookup('file', '/opt/ansible/ssh.key.pub') }}"
- name: Setup ansible with sudoers access
copy:
dest: /etc/sudoers.d/ansible
mode: '0600'
owner: root
group: root
content: ansible ALL=(ALL) NOPASSWD:ALL