2020-06-16 09:34:55 -05:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
- name: Configure Ansible system user
|
|
|
|
block:
|
|
|
|
- name: Create Ansible system user
|
|
|
|
user:
|
|
|
|
name: ansible
|
|
|
|
groups: sudo
|
|
|
|
password_lock: yes
|
|
|
|
system: yes
|
2020-06-16 10:04:54 -05:00
|
|
|
become: yes
|
2020-07-08 00:45:14 -05:00
|
|
|
- name: Ensure perms on Ansible user home
|
|
|
|
file:
|
|
|
|
path: "/home/ansible"
|
|
|
|
mode: "0700"
|
2020-07-08 00:47:13 -05:00
|
|
|
- name: Ensure ownership of Ansible user home
|
|
|
|
file:
|
|
|
|
path: "/home/ansible"
|
2020-07-08 00:45:14 -05:00
|
|
|
owner: ansible
|
|
|
|
group: ansible
|
2020-07-08 00:47:13 -05:00
|
|
|
recurse: yes
|
2020-06-16 09:34:55 -05:00
|
|
|
- name: Add Ansible key to user
|
|
|
|
authorized_key:
|
|
|
|
user: ansible
|
|
|
|
manage_dir: yes
|
|
|
|
key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8pjK7Z6V9IjxRtLB9Xwt5Rujj0iMQqOVExRkmkIzjEcblV/cqtwx4fOijoN9eQlmrjQg05rBWoHJoUiLH5LimU2HPQt9vSDSt/tTXNafhvi3St3nz+GA9yCwAkJfvz2QL/vnU7sfveYC2xmWZC0xjcG4bl8pL2GJgfyh4OnfS9vNRTpn1kAJ/Fl4vRLtRaFx1WzF3/RJUOkesYLegawSRJsaIamJFI5YxHe5VeTnFefVtssgbGrOj19uRDIZkBW/5uWsnNPVwbGUT089qioS11QFJaVOQCgU/E+4lxCHlRfLQ+gnXvaQV3j0JFk/I1bZNlCcNLHc0ZasXIqV+BUaR4au35QkDBjh38DCxesZ775tudXUp7KP6OHCC9i9ncIkum3mE+4K+0KAlS0oevUQdfguXkRQ6q3vydxEgWbBOx3jHi7i5AwvOnJqZRmUnfFp0qfhGfcS2pLEZhUcd0bOM6qAyK1XD5XRzXoVLS9bdHNUwCaIWie0tOYMLLmNooTU= ansible"
|
2020-06-16 10:04:54 -05:00
|
|
|
- name: Add Ansible user sudoers rule
|
|
|
|
template:
|
2020-06-16 10:08:12 -05:00
|
|
|
src: 90-ansible
|
|
|
|
dest: "/etc/sudoers.d/90-ansible"
|
2020-06-16 10:04:54 -05:00
|
|
|
mode: "0440"
|
|
|
|
become: yes
|