2023-02-07 13:02:43 +00:00
|
|
|
# code: language=ansible
|
|
|
|
|
2023-02-01 17:34:56 +00:00
|
|
|
- name: Install base packages
|
|
|
|
become: true
|
2023-02-06 09:11:03 +00:00
|
|
|
ansible.builtin.package:
|
2023-02-01 17:34:56 +00:00
|
|
|
name:
|
|
|
|
- cockpit
|
|
|
|
- cockpit-bridge
|
|
|
|
- cockpit-machines
|
|
|
|
- cockpit-packagekit
|
|
|
|
- cockpit-podman
|
|
|
|
- cockpit-storaged
|
|
|
|
- cockpit-system
|
|
|
|
- cockpit-ws
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Enable cockpit
|
|
|
|
become: true
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: cockpit.socket
|
2023-02-06 09:11:03 +00:00
|
|
|
enabled: true
|
2023-02-01 17:34:56 +00:00
|
|
|
state: started
|
|
|
|
|
2023-02-06 09:11:03 +00:00
|
|
|
- name: Copy cockpit configuration
|
2023-02-01 17:34:56 +00:00
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: cockpit.conf.j2
|
|
|
|
dest: /etc/cockpit/cockpit.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
2023-08-01 08:27:04 +00:00
|
|
|
mode: "0644"
|
2023-02-01 17:34:56 +00:00
|
|
|
|
2023-04-17 12:43:31 +00:00
|
|
|
# https://cockpit-project.org/faq.html#error-message-about-being-offline
|
|
|
|
- name: Allow NetworkManager to manage network interfaces
|
|
|
|
become_user: root
|
|
|
|
become: true
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: files/10-globally-managed-devices.conf
|
|
|
|
dest: /etc/NetworkManager/conf.d/
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
- name: Set-up a dummy network interface faking internet connection
|
|
|
|
ansible.builtin.command: "nmcli con add type dummy con-name fake ifname fake0 ip4 1.2.3.4/24 gw4 1.2.3.1"
|
|
|
|
|
2023-02-15 13:01:28 +00:00
|
|
|
- name: Permit traffic from any IP to cockpit socket
|
|
|
|
become: true
|
|
|
|
community.general.ufw:
|
|
|
|
direction: in
|
|
|
|
from_ip: any
|
|
|
|
proto: tcp
|
|
|
|
to_port: 9090
|
|
|
|
rule: allow
|
|
|
|
|
2023-02-06 09:11:03 +00:00
|
|
|
# - name: Reboot
|
|
|
|
# become: true
|
|
|
|
# ansible.builtin.reboot:
|