54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
---
|
|
- name: Configure Ubuntu for user trucktrav
|
|
hosts: all
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: Ensure the system is updated
|
|
apt:
|
|
update_cache: yes
|
|
upgrade: dist
|
|
|
|
- name: Apt | Install defaults
|
|
ansible.builtin.apt:
|
|
update_cache: false
|
|
name: "{{ default_apps + (extra_apps | default([])) }}"
|
|
state: present
|
|
register: apt_defaults
|
|
retries: 3
|
|
until: apt_defaults is success
|
|
|
|
- name: Create the user trucktrav
|
|
user:
|
|
name: trucktrav
|
|
shell: /bin/bash
|
|
create_home: yes
|
|
groups: sudo
|
|
append: yes
|
|
|
|
- name: Set authorized key for trucktrav
|
|
authorized_key:
|
|
user: trucktrav
|
|
state: present
|
|
key: "{{ lookup('file', 'files/trucktrav.pub') }}"
|
|
|
|
- name: Ensure sudoers file allows passwordless sudo for trucktrav
|
|
lineinfile:
|
|
path: /etc/sudoers
|
|
line: "trucktrav ALL=(ALL) NOPASSWD: ALL"
|
|
validate: "visudo -cf %s"
|
|
|
|
- name: Ensure SSH service is enabled and running
|
|
service:
|
|
name: ssh
|
|
state: started
|
|
enabled: yes
|
|
|
|
# todo
|
|
# snap install --classic code
|
|
|
|
#dnf config-manager --enable ansible-automation-platform-2.4-for-rhel-8-x86_64-rpms
|
|
|
|
#dnf install ansible-core ansible-navigator ansible-lint ansible-builder
|
|
|
|
#python3 -m pip install ansible-lint --break-system-packages |