Update the setup tasks

Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
2024-04-12 15:12:30 +02:00
parent f12f17658b
commit 2cdea1f6c3
12 changed files with 116 additions and 81 deletions

View File

@@ -9,12 +9,12 @@
---
- name: Add ansible group
group:
ansible.builtin.group:
name: ansible
state: present
- name: Add new ansible user
user:
ansible.builtin.user:
name: ansible
group: ansible
groups: ansible,{{ sudo_group }}
@@ -23,7 +23,7 @@
shell: /bin/bash
- name: Add ansible user to sudoers
copy:
ansible.builtin.copy:
src: ansible/ansible_sudoers
dest: /etc/sudoers.d/ansible
owner: root
@@ -31,18 +31,9 @@
mode: 0440
- name: Create .ssh directory
file:
ansible.builtin.file:
path: /home/ansible/.ssh
state: directory
owner: ansible
group: ansible
mode: 0700
with_items:
- dir: /home/ansible/.ssh
- name: Copy ssh public key
authorized_key:
user: ansible
key: "{{ item }}"
with_file:
- ansible/ansible.pub