This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/system/tasks/essential.yml

70 lines
1.4 KiB
YAML
Raw Normal View History

2022-05-14 21:37:06 -04:00
- name: Set locale
community.general.locale_gen:
name: en_US.UTF-8
state: present
2022-03-01 17:43:44 -05:00
- name: Change hostname
hostname:
name: "{{ inventory_hostname }}"
- name: Set MOTD
template:
src: motd.j2
dest: /etc/motd
2022-04-27 17:32:11 -04:00
- name: Check if yay is installed
shell:
cmd: which yay
changed_when: false
register: yay_stat
ignore_errors: yes
2022-03-01 17:43:44 -05:00
- name: Update packages
community.general.pacman:
update_cache: yes
upgrade: yes
2022-04-27 17:32:11 -04:00
- name: Update AUR packages
kewlfft.aur.aur:
upgrade: yes
aur_only: yes
become_user: aur-build
when: not yay_stat.failed
2022-03-02 19:58:31 -05:00
- name: Determine if reboot for kernel update is needed
shell:
cmd: "if [[ $(pacman -Q linux | cut -d \" \" -f 2) > $(uname -r) ]]; then echo reboot; fi"
register: reboot_check
2022-03-04 07:30:52 -05:00
changed_when: reboot_check.stdout == "reboot"
2022-03-02 19:58:31 -05:00
- name: Reboot for kernel update
reboot:
when:
reboot_check.stdout == "reboot"
2022-03-01 17:43:44 -05:00
- name: Install utility packages
community.general.pacman:
name: "{{ util_pack }}"
state: present
- name: Disable root login
user:
name: root
password: "*"
- name: Create unpriviledged user
user:
name: "{{ username }}"
- name: Deploy SSH key to unpriviledged user
ansible.posix.authorized_key:
user: "{{ username }}"
state: present
2022-03-02 19:58:31 -05:00
key: "{{ lookup('file', '~/.ssh/keys/{{ inventory_hostname }}.pub')}}"
2022-03-01 17:43:44 -05:00
- name: Enable cron daemon
service:
name: cronie
state: started
enabled: yes