The beginnings of a backup solution

This commit is contained in:
Bradley committed 2025-08-17 21:01:27 -04:00
1 parent d9262852c8
commit 686543a1b9
14 files changed
+501 -251

No files matched your search

+31 -31
View File
@@ -1,31 +1,31 @@
---
- hosts: all
become: true
become_method: su
become_user: root
tasks:
- name: Create the ansible user
ansible.builtin.user:
name: ansible
append: true
state: present
createhome: true
shell: /bin/bash
- name: Make sure the sudoers dropin directory exists
ansible.builtin.file:
path: "/etc/sudoers.d"
state: directory
- name: Create a sudoers file for the ansible user
ansible.builtin.lineinfile:
path: "/etc/sudoers.d/50-ansible"
line: "ansible ALL=(ALL) NOPASSWD: ALL"
create: true
validate: "visudo -cf %s"
- name: Add authorized key for ansible user
ansible.builtin.authorized_key:
user: ansible
key: "{{ lookup('ansible.builtin.file', '/home/ansible/.ssh/id_rsa.pub') }}"
---
- hosts: all
become: true
become_method: su
become_user: root
tasks:
- name: Create the ansible user
ansible.builtin.user:
name: ansible
append: true
state: present
createhome: true
shell: /bin/bash
- name: Make sure the sudoers dropin directory exists
ansible.builtin.file:
path: "/etc/sudoers.d"
state: directory
- name: Create a sudoers file for the ansible user
ansible.builtin.lineinfile:
path: "/etc/sudoers.d/50-ansible"
line: "ansible ALL=(ALL) NOPASSWD: ALL"
create: true
validate: "visudo -cf %s"
- name: Add authorized key for ansible user
ansible.builtin.authorized_key:
user: ansible
key: "{{ lookup('ansible.builtin.file', '/home/ansible/.ssh/id_rsa.pub') }}"