Initial configuration
This commit is contained in:
0
roles/auto-updates/tasks/main.yml
Normal file
0
roles/auto-updates/tasks/main.yml
Normal file
11
roles/base-os/tasks/main.yml
Normal file
11
roles/base-os/tasks/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
- name: Install base packages
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- htop
|
||||
- tmux
|
||||
- git
|
||||
- nano
|
||||
- python3
|
||||
state: present
|
||||
|
||||
34
roles/cockpit/tasks/main.yml
Normal file
34
roles/cockpit/tasks/main.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
- name: Install base packages
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- cockpit
|
||||
- cockpit-bridge
|
||||
- cockpit-machines
|
||||
- cockpit-navigator
|
||||
- cockpit-packagekit
|
||||
- cockpit-podman
|
||||
- cockpit-storaged
|
||||
- cockpit-system
|
||||
- cockpit-ws
|
||||
state: present
|
||||
|
||||
- name: Enable cockpit
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: cockpit.socket
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: Copy cockpit configuration
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: cockpit.conf.j2
|
||||
dest: /etc/cockpit/cockpit.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Reboot
|
||||
become: true
|
||||
reboot:
|
||||
4
roles/cockpit/templates/cockpit.conf.j2
Normal file
4
roles/cockpit/templates/cockpit.conf.j2
Normal file
@@ -0,0 +1,4 @@
|
||||
[WebService]
|
||||
Origins = http://{{ inventory_hostname }} ws://{{ inventory_hostname }} https://{{ inventory_hostname }} wss://{{ inventory_hostname }} http://10.0.0.160 ws://10.0.0.160 https://10.0.0.160 wss://10.0.0.160
|
||||
ProtocolHeader = X-Forwarded-Proto
|
||||
AllowUnencrypted=true
|
||||
9
roles/enable-cgroup-v2/tasks/main.yml
Normal file
9
roles/enable-cgroup-v2/tasks/main.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- name: Check if cgroup v2 is available
|
||||
ansible.builtin.command: grep cgroup2 /proc/filesystems
|
||||
register: cgroup2_present
|
||||
|
||||
- name: Enable cgroup v2
|
||||
ansible.builtin.command: 'grubby --update-kernel=ALL --add-args="systemd.unified_cgroup_hierarchy=1"'
|
||||
become: true
|
||||
when:
|
||||
- cgroup2_present.rc != 0
|
||||
67
roles/podman/tasks/main.yml
Normal file
67
roles/podman/tasks/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
- name: Install base packages
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- podman
|
||||
- podman-docker
|
||||
state: present
|
||||
|
||||
- name: Add the 'containers' user
|
||||
become: true
|
||||
user:
|
||||
name: containers
|
||||
shell: /bin/bash
|
||||
|
||||
- name: Check if user is lingering
|
||||
stat:
|
||||
path: "/var/lib/systemd/linger/containers"
|
||||
register: user_lingering
|
||||
|
||||
- name: Enable lingering is needed
|
||||
become: true
|
||||
command: "loginctl enable-linger containers"
|
||||
when:
|
||||
- not user_lingering.stat.exists
|
||||
|
||||
- name: Allow unprivileged users to open ports
|
||||
become: true
|
||||
ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_unprivileged_port_start
|
||||
value: "80"
|
||||
sysctl_set: yes
|
||||
|
||||
- name: Enable podman socket
|
||||
become: true
|
||||
become_user: containers
|
||||
ansible.builtin.systemd:
|
||||
scope: user
|
||||
name: podman.socket
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: Enable podman auto-update timer
|
||||
become: true
|
||||
become_user: containers
|
||||
ansible.builtin.systemd:
|
||||
scope: user
|
||||
name: podman-auto-update.timer
|
||||
enabled: yes
|
||||
|
||||
- name: Copy default containers config file
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
remote_src: yes
|
||||
src: /usr/share/containers/containers.conf
|
||||
dest: /etc/containers/containers.conf
|
||||
mode: 0644
|
||||
|
||||
- name: Change podman default subnet
|
||||
become: true
|
||||
lineinfile:
|
||||
path: /etc/containers/containers.conf
|
||||
regex: "^#default_subnet*$"
|
||||
line: 'default_subnet = "172.16.0.0/24"'
|
||||
|
||||
- name: Reboot
|
||||
become: true
|
||||
reboot:
|
||||
Reference in New Issue
Block a user