-
-
Save lzhengqc/4a22d2df0fa80b787fec1578cf6527d5 to your computer and use it in GitHub Desktop.
--- | |
# | |
# Ansible playbook: Webmin for Ubuntu v201501302302 | |
# Louis T. Getterman IV (@LTGIV) | |
# www.GotGetLLC.com / www.opensour.cc | |
# | |
# Example Usage: | |
# [user@host ~$] ansible-playbook /etc/ansible/playbooks/webmin.yml --extra-vars 'target=nameFromHostsFile' | |
# | |
- hosts: '{{ target }}' | |
sudo: yes | |
tasks: | |
- name: Add Webmin repositories | |
apt_repository: > | |
repo='{{ item }}' | |
state=present | |
with_items: | |
- 'deb http://download.webmin.com/download/repository sarge contrib' | |
- 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' | |
- name: Add Webmin key | |
apt_key: > | |
url='http://www.webmin.com/jcameron-key.asc' | |
state=present | |
- name: Install Webmin and prerequisites | |
apt: > | |
update_cache=yes | |
pkg={{ item }} | |
state=installed | |
with_items: | |
- perl | |
- libnet-ssleay-perl | |
- openssl | |
- libauthen-pam-perl | |
- libpam-runtime | |
- libio-pty-perl | |
- apt-show-versions | |
- python | |
- webmin |
Are there any prerequisites for this? It throws all sorts of errors on my Ubuntu 18.04 Ansible installation.
Examples - I had to modify 'sudo' to 'become' because I got the following error:
ERROR! 'sudo' is not a valid attribute for a Play
And then there were more struggles afterwards, the most recent being:
failed: [joshua] (item=deb http://download.webmin.com/download/repository sarge contrib) => {"ansible_loop_var": "item", "changed": false, "item": "deb http://download.webmin.com/download/repository sarge contrib", "msg": "apt cache update failed"}
failed: [joshua] (item=deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib) => {"ansible_loop_var": "item", "changed": false, "item": "deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib", "msg": "apt cache update failed"}
I'm pretty new to Ansible and am trying to learn, and I've had moderate success doing certain things up to this point, but this has me scratching my head. More likely than not I've not installed something I need to or something along those lines so I figured I'd ask.
TIA...
Are there any prerequisites for this? It throws all sorts of errors on my Ubuntu 18.04 Ansible installation.
Examples - I had to modify 'sudo' to 'become' because I got the following error:
ERROR! 'sudo' is not a valid attribute for a PlayAnd then there were more struggles afterwards, the most recent being:
failed: [joshua] (item=deb http://download.webmin.com/download/repository sarge contrib) => {"ansible_loop_var": "item", "changed": false, "item": "deb http://download.webmin.com/download/repository sarge contrib", "msg": "apt cache update failed"}
failed: [joshua] (item=deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib) => {"ansible_loop_var": "item", "changed": false, "item": "deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib", "msg": "apt cache update failed"}I'm pretty new to Ansible and am trying to learn, and I've had moderate success doing certain things up to this point, but this has me scratching my head. More likely than not I've not installed something I need to or something along those lines so I figured I'd ask.
TIA...
You can try placing:
- name: Add Webmin key
apt_key: >
url='http://www.webmin.com/jcameron-key.asc'
state=present
above the task to add the repository
I had no success with with the playbook above, and the key=value syntax is kinda weird
Ended up with this, which will install webmin on Ubuntu 22.04 LTS
---
- name: Install prerequisites
ansible.builtin.apt:
name:
- perl
- libnet-ssleay-perl
- openssl
- libauthen-pam-perl
- libpam-runtime
- libio-pty-perl
- apt-show-versions
- python3
- libwww-perl
- liblwp-protocol-https-perl
state: latest
update_cache: yes
- name: Add key Webmin repository
ansible.builtin.apt_key:
url: https://www.webmin.com/jcameron-key.asc
state: present
- name: Add Webmin repository
ansible.builtin.apt_repository:
repo: 'deb https://download.webmin.com/download/repository sarge contrib'
state: present
filename: webmin
update_cache: yes
- name: Install/Update webmin
ansible.builtin.apt:
name:
- webmin
state: latest
This is excellent and will give it a try (running a Pi Cluster with Ubuntu 20.04 64bit server).
Is there a preference for adding the repos to the /etc/apt/sources.list as opposed to creating a new file in /etc/apt/sources.list.d/webmin.list
with the content:
??