You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/roles/bootstrap/tasks/main.yml

31 lines
601 B
YAML

# @meta author: Cian Hatton
# @meta description: >
# Role to bootstrap a target host. This role will add an ansible
# user and allow paswordless sudo.
# @end
---
- name: Update Packages
apt:
upgrade: dist
update_cache: true
- name: Create ansible user
user:
name: ansible
groups: root
- name: Add ssh key for ansible
authorized_key:
user: "ansible"
state: present
key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
- name: Add sudoers file for ansible
copy:
src: sudoer_ansible
dest: /etc/sudoers.d/ansible
owner: root
group: root
mode: 0440