40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
# ===================================================================================================
|
|
# ? ABOUT
|
|
# @author : Noah Knegt
|
|
# @email : personal@noahknegt.com
|
|
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
|
|
# @createdOn : 27-02-2023
|
|
# @description : It contains the tasks to properly configure the ansible user.
|
|
# ===================================================================================================
|
|
|
|
---
|
|
- name: Add ansible group
|
|
ansible.builtin.group:
|
|
name: ansible
|
|
state: present
|
|
|
|
- name: Add new ansible user
|
|
ansible.builtin.user:
|
|
name: ansible
|
|
group: ansible
|
|
groups: ansible,{{ sudo_group }}
|
|
password: "{{ ansible_password }}"
|
|
state: present
|
|
shell: /bin/bash
|
|
|
|
- name: Add ansible user to sudoers
|
|
ansible.builtin.copy:
|
|
src: ansible/ansible_sudoers
|
|
dest: /etc/sudoers.d/ansible
|
|
owner: root
|
|
group: root
|
|
mode: 0440
|
|
|
|
- name: Create .ssh directory
|
|
ansible.builtin.file:
|
|
path: /home/ansible/.ssh
|
|
state: directory
|
|
owner: ansible
|
|
group: ansible
|
|
mode: 0700
|