polytech-ansible-2023/roles/root_user/tasks/main.yml
Thomas Maurice 93bb0b0742
All checks were successful
Master branch: build & lint / build (push) Successful in 1m0s
feat(actions): Adds actions & lint (#1)
Adds an action to perform some linting actions on ansible and the yaml files, both on push onto master and on pull requests

Reviewed-on: #1
2024-02-20 17:46:29 +00:00

28 lines
769 B
YAML

---
# Ensures the .ssh directory exists
- name: "Creates the .ssh root directory"
ansible.builtin.file:
path: "/root/.ssh"
state: directory
owner: root
group: root
mode: 0700
- name: "Install root SSH keys"
ansible.builtin.template:
src: authorized_keys.j2
dest: /root/.ssh/authorized_keys
owner: root
group: root
mode: 0600
# Delete users you don't need
# respectively you can also *add* users
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html#ansible-collections-ansible-builtin-user-module
- name: "Delete usual cloud users user" # noqa: loop-var-prefix
ansible.builtin.user:
name: "{{ item }}"
state: absent
remove: true
with_items:
- pi
- admin
- ubuntu