This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/os_config/tasks/base.yml

64 lines
1.1 KiB
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
---
2022-12-25 18:20:23 +00:00
- name: Set hostname
hostname:
name: "{{ hostname }}"
- name: Set timezone
timezone:
name: "{{ timezone }}"
2022-12-22 19:18:27 +00:00
- name: Upgrade system packages
2022-12-22 22:34:09 +00:00
apt:
2022-12-22 19:18:27 +00:00
update_cache: true
upgrade: full
- name: Install packages via apt
apt:
name: "{{ pkgs }}"
state: present
vars:
pkgs:
- apparmor
2022-12-25 18:20:23 +00:00
- curl
- git
2022-12-22 19:18:27 +00:00
- haveged
2022-12-23 15:57:37 +00:00
- needrestart
- python3-pip
2022-12-22 19:18:27 +00:00
- ufw
2022-12-25 18:20:23 +00:00
- unattended-upgrades
- name: Check if a reboot is needed
stat:
path: /var/run/reboot-required
register: needs_reboot
tags:
- reboot
- name: Reboot host
reboot:
connect_timeout: 120
when: needs_reboot.stat.exists or
(force_reboot is defined and force_reboot)
2022-12-25 23:53:10 +00:00
register: reboot
tags:
- reboot
2022-12-25 23:26:01 +00:00
2022-12-25 23:53:10 +00:00
- name: Re-gather facts
setup:
filter:
- ansible_mounts
- ansible_swaptotal_mb
when: reboot.rebooted
2022-12-25 23:26:01 +00:00
- name: Clone apt-update-push
git:
dest: "/home/{{ ansible_user }}/apt-update-push"
repo: https://github.com/samsapti/apt-update-push.git
clone: true
update: true
single_branch: true
depth: 1
become: false
notify: Install apt-update-push