Fixed some lint suggestions

This commit is contained in:
Francesco Antognazza 2023-02-06 10:11:03 +01:00
parent 29ead64f6a
commit 3e7f5b44b3
6 changed files with 41 additions and 28 deletions

View File

@ -1,8 +1,9 @@
- hosts: chef.heaplab.deib.polimi.it
name: Base configuration of OS
pre_tasks:
- name: Update system
become: true
package:
ansible.builtin.package:
name: "*"
state: latest # noqa package-latest
- name: Set hostname
@ -12,7 +13,7 @@
use: systemd
# - name: Reboot
# become: true
# reboot:
# ansible.builtin.reboot:
roles:
- auto-updates

View File

@ -9,7 +9,7 @@
- name: Permit traffic from any IP to http port
become: true
ansible.builtin.ufw:
community.general.ufw:
direction: in
from_ip: any
proto: tcp
@ -18,7 +18,7 @@
- name: Permit traffic from any IP to https port
become: true
ansible.builtin.ufw:
community.general.ufw:
direction: in
from_ip: any
proto: tcp

View File

@ -1,6 +1,6 @@
- name: Install base packages
become: true
package:
ansible.builtin.package:
name:
- htop
- tmux
@ -9,4 +9,3 @@
- python3
- acl
state: present

View File

@ -1,6 +1,6 @@
- name: Install base packages
become: true
package:
ansible.builtin.package:
name:
- cockpit
- cockpit-bridge
@ -16,7 +16,7 @@
become: true
ansible.builtin.systemd:
name: cockpit.socket
enabled: yes
enabled: true
state: started
- name: Copy cockpit configuration
@ -30,4 +30,4 @@
# - name: Reboot
# become: true
# reboot:
# ansible.builtin.reboot:

View File

@ -1,6 +1,7 @@
- name: Check if cgroup v2 is available
ansible.builtin.command: grep cgroup2 /proc/filesystems
register: cgroup2_present
changed_when: cgroup2_present.rc != 0
- name: Enable cgroup v2
ansible.builtin.command: 'grubby --update-kernel=ALL --add-args="systemd.unified_cgroup_hierarchy=1"'

View File

@ -1,6 +1,6 @@
- name: Install base packages
become: true
package:
ansible.builtin.package:
name:
- podman
- podman-docker
@ -8,18 +8,30 @@
- name: Add the 'containers' user
become: true
user:
ansible.builtin.user:
name: containers
password: "!"
system: false
shell: /bin/bash
comment: User running unprivileged containers
state: present
- name: Add admin pub keys to authorized_keys
become: true
ansible.posix.authorized_keys:
user: containers
key: "{{ item }}"
state: present
loop: "{{ vault_containers_authorized_keys }}"
- name: Check if user is lingering
stat:
ansible.builtin.stat:
path: "/var/lib/systemd/linger/containers"
register: user_lingering
- name: Enable lingering is needed
become: true
command: "loginctl enable-linger containers"
ansible.builtin.command: "loginctl enable-linger containers"
when:
- not user_lingering.stat.exists
@ -28,7 +40,7 @@
ansible.posix.sysctl:
name: net.ipv4.ip_unprivileged_port_start
value: "80"
sysctl_set: yes
sysctl_set: true
- name: Enable podman socket
become: true
@ -36,30 +48,30 @@
ansible.builtin.systemd:
scope: user
name: podman.socket
enabled: yes
enabled: true
state: started
- name: Enable podman auto-update timer
become: true
ansible.builtin.systemd:
name: podman-auto-update.timer
enabled: yes
enabled: true
- name: Copy default containers config file
become: true
ansible.builtin.copy:
remote_src: yes
remote_src: true
src: /usr/share/containers/containers.conf
dest: /etc/containers/containers.conf
mode: 0644
- name: Change podman default subnet
become: true
lineinfile:
ansible.builtin.lineinfile:
path: /etc/containers/containers.conf
regex: "^(.*)default_subnet = (.*)$"
line: 'default_subnet = "172.16.0.0/24"'
# - name: Reboot
# become: true
# reboot:
# ansible.builtin.reboot: