first commit

This commit is contained in:
Khwezi Mngoma
2026-02-22 16:43:17 +02:00
commit 0410dc3950
94 changed files with 9739 additions and 0 deletions

19
webmin/commands.md Normal file
View File

@@ -0,0 +1,19 @@
# 1. Install using script
```bash
curl -o webmin-setup-repo.sh https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repo.sh
sudo sh webmin-setup-repo.sh
```
# 2. Install Webmin
```shell
sudo apt update
sudo apt install webmin
```
# 3. Open port
```bash
ufw allow 10000
```

14
webmin/config.ini Normal file
View File

@@ -0,0 +1,14 @@
[all:vars]
ansible_python_interpreter=/usr/bin/python3
ansible_user=ansible
ansible_ssh_private_key_file=~/.ssh/id_ed25519
[hosts]
sentry ansible_host=sentry.mngoma.lab
alpha ansible_host=alpha.lb.mngoma.lab
database ansible_host=database.mngoma.lab
vpn ansible_host=vpn.mngoma.lab
minecraft ansible_host=minecraft.mngoma.lab
# dns ansible_host=dns.mngoma.lab
manager ansible_host=lead.mngoma.lab
worker ansible_host=worker1.mngoma.lab

View File

@@ -0,0 +1,25 @@
---
- name: Cleanup broken Webmin repository
hosts: all
become: yes
tasks:
- name: Remove old Webmin repository file
file:
path: /etc/apt/sources.list.d/webmin.list
state: absent
- name: Remove Webmin GPG keyring (optional)
file:
path: /usr/share/keyrings/webmin.gpg
state: absent
- name: Clean apt cache
apt:
autoclean: yes
autoremove: yes
- name: Update apt cache
apt:
update_cache: yes

View File

@@ -0,0 +1,56 @@
---
- name: Install Webmin using official setup script
hosts: all
become: yes
vars:
webmin_port: 10000
webmin_script: /tmp/webmin-setup-repo.sh
tasks:
- name: Ensure required packages are installed
apt:
name:
- curl
- ufw
state: present
update_cache: yes
- name: Download Webmin setup script
get_url:
url: https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repo.sh
dest: "{{ webmin_script }}"
mode: '0755'
- name: Run Webmin setup script non-interactively
command: "sh {{ webmin_script }}"
args:
stdin: "y\n"
creates: /etc/apt/sources.list.d/webmin.list
- name: Update apt cache after script
apt:
update_cache: yes
- name: Install Webmin
apt:
name: webmin
state: latest
- name: Ensure Webmin service is running
systemd:
name: webmin
state: started
enabled: yes
- name: Allow Webmin port through UFW
ufw:
rule: allow
port: "{{ webmin_port }}"
proto: tcp
register: ufw_rule
- name: Confirm UFW rule applied
debug:
msg: "UFW rule for Webmin (port {{ webmin_port }}) is present."
when: ufw_rule.changed or ufw_rule.skipped

View File

@@ -0,0 +1,55 @@
---
- name: Safely update Webmin on all hosts
hosts: all
become: yes
vars:
webmin_repo: "deb http://download.webmin.com/download/repository sarge contrib"
webmin_key_url: "http://www.webmin.com/jcameron-key.asc"
tasks:
- name: Ensure required packages are installed for HTTPS repositories
apt:
name:
- apt-transport-https
- software-properties-common
- gnupg
state: present
update_cache: yes
- name: Add Webmin GPG key (idempotent)
ansible.builtin.apt_key:
url: "{{ webmin_key_url }}"
state: present
- name: Ensure Webmin repository is present
ansible.builtin.apt_repository:
repo: "{{ webmin_repo }}"
state: present
- name: Update apt cache
apt:
update_cache: yes
- name: Check if Webmin is installed
command: dpkg -l webmin
register: webmin_installed
ignore_errors: yes
- name: Upgrade Webmin if installed
apt:
name: webmin
state: latest
when: webmin_installed.rc == 0
- name: Install Webmin if not installed
apt:
name: webmin
state: present
when: webmin_installed.rc != 0
- name: Ensure Webmin service is running
systemd:
name: webmin
state: restarted
enabled: yes