first commit
This commit is contained in:
56
webmin/install-playbook.yml
Normal file
56
webmin/install-playbook.yml
Normal 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
|
||||
Reference in New Issue
Block a user