Add Support back for Ubuntu as OS (#546)

Co-authored-by: Willian Paixao <willian@ufpa.br>
Co-authored-by: Devin Buhl <onedr0p@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-12-09 07:46:26 -05:00
1 parent e71ca17d2d
commit 579ce037fc
3 files changed
+71 -17

No files matched your search

+1
View File
@@ -34,6 +34,7 @@ _Additional applications include [hajimari](https://github.com/toboshii/hajimari
For provisioning the following tools will be used:
- [Fedora 36 Server](https://getfedora.org/en/server/download/) - Universal operating system that supports running all kinds of home related workloads in Kubernetes and has a faster release cycle
- [Ubuntu 22.04 Server](https://ubuntu.com/download/server) - Alternative operating system, limited community support
- [Ansible](https://www.ansible.com) - Provision Fedora Server and install k3s
- [Terraform](https://www.terraform.io) - Provision an already existing Cloudflare domain and certain DNS records to be used with your k3s cluster
@@ -5,15 +5,29 @@
# (list) Additional ssh public keys to add to the nodes
# ssh_authorized_keys:
packages:
- dnf-plugin-system-upgrade
- dnf-utils
- hdparm
- htop
- intel-gpu-tools
- ipvsadm
- lm_sensors
- nano
- nvme-cli
- socat
- python3-libselinux
fedora:
packages:
- dnf-plugin-system-upgrade
- dnf-utils
- hdparm
- htop
- intel-gpu-tools
- ipvsadm
- lm_sensors
- nano
- nvme-cli
- socat
- python3-libselinux
ubuntu:
# disable_ufw: true
# disable_swap: true
packages:
- hdparm
- htop
- intel-gpu-tools
- ipvsadm
- lm-sensors
- nano
- nvme-cli
- socat
@@ -25,16 +25,28 @@
path: /etc/hosts
block: |
127.0.1.1 {{ inventory_hostname }}
- name: Packages
- name: Packages | Fedora
block:
- name: Packages | Install required packages
ansible.builtin.dnf:
name: "{{ packages | default([]) }}"
name: "{{ fedora.packages | default([]) }}"
state: present
update_cache: true
- name: Packages | Remove leaf packages
ansible.builtin.dnf:
autoremove: true
when: ansible_facts['distribution'] == 'Fedora'
- name: Packages | Ubuntu
block:
- name: Packages | Install required packages
ansible.builtin.apt:
name: "{{ ubuntu.packages | default([]) }}"
state: present
update_cache: true
- name: Packages | Remove leaf packages
ansible.builtin.apt:
autoremove: true
when: ansible_facts['distribution'] == 'Ubuntu'
- name: User Configuration
block:
- name: User Configuration | Add additional SSH public keys
@@ -44,12 +56,22 @@
loop: "{{ public_ssh_keys | default([]) }}"
- name: System Configuration (1)
block:
- name: System Configuration (1) | Disable firewalld
- name: System Configuration (1) | Disable firewalld | Fedora
ansible.builtin.systemd:
service: firewalld.service
enabled: false
masked: true
state: stopped
when: ansible_facts['distribution'] == 'Fedora'
- name: System Configuration (1) | Disable ufw | Ubuntu
ansible.builtin.systemd:
service: ufw.service
enabled: false
masked: true
state: stopped
when:
- ansible_facts['distribution'] == 'Ubuntu'
- "{{ ubuntu.disable_ufw | default true }}" == true
- name: System Configuration (1) | Enable fstrim
ansible.builtin.systemd:
service: fstrim.timer
@@ -85,14 +107,31 @@
net.bridge.bridge-nf-call-ip6tables: 1
fs.inotify.max_user_watches: 524288
fs.inotify.max_user_instances: 512
- name: System Configuration (2) | Disable swap
- name: System Configuration (2) | Disable swap | Fedora
ansible.builtin.dnf:
name: zram-generator-defaults
state: absent
- name: System Configuration (2) | Permissive SELinux
when: ansible_facts['distribution'] == 'Fedora'
- name: System Configuration (2) | Disable swap at runtime | Ubuntu
ansible.builtin.command: swapoff -a
when:
- ansible_facts['distribution'] == 'Ubuntu'
- "{{ ubuntu.disable_swap | default true }}" == true
- ansible_swaptotal_mb > 0
- name: System Configuration (2) | Disable swap at boot | Ubuntu
ansible.posix.mount:
name: "{{ item }}"
fstype: swap
state: absent
loop: ["none", "swap"]
when:
- ansible_facts['distribution'] == 'Ubuntu'
- "{{ ubuntu.disable_swap | default true }}" == true
- name: System Configuration (2) | Permissive SELinux | Fedora
ansible.posix.selinux:
state: permissive
policy: targeted
when: ansible_facts['distribution'] == 'Fedora'
notify: Reboot
handlers: