ansible-webmin/roles/configure_subpath/tasks/webmin-config.yml
GregoryDosh 3596dcf04c
All checks were successful
Publish Collection / Publish Collection (push) Successful in 11s
feat: Initial Release 🌈🐻
2025-11-18 18:29:36 -06:00

51 lines
1.7 KiB
YAML

# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-FileCopyrightText: 2025 Dosh LLC
---
- name: Webmin Config
register: _webmin_subpaths_config
become: true
ansible.builtin.lineinfile:
path: "{{ WEBMIN_CONFIG_PATH }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
loop:
- { line: "referers={{ WEBMIN_HOST }}", regexp: "^referers=" }
- { line: "webprefix=/{{ WEBMIN_PREFIX }}", regexp: "^webprefix=" }
- { line: "webprefixnoredir=1", regexp: "^webprefixnoredir=" }
- { line: "relative_redir=0", regexp: "^relative_redir=" }
- name: Miniserv config
register: _webmin_subpaths_miniserv
become: true
ansible.builtin.lineinfile:
path: "{{ MINISERV_CONFIG_PATH }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
loop:
- { line: "allow={{ WEBMIN_ALLOW }}", regexp: "^allow=" }
- { line: "bind={{ WEBMIN_BIND }}", regexp: "^bind=" }
- { line: "trust_real_ip=1", regexp: "^trust_real_ip=" }
- { line: "cookiepath=/{{ WEBMIN_PREFIX }}", regexp: "^cookiepath=" }
- { line: "redirect_host={{ WEBMIN_HOST }}", regexp: "^redirect_host=" }
- {
line: "redirect_prefix=/{{ WEBMIN_PREFIX }}",
regexp: "^redirect_prefix=",
}
- name: Xterm Config
register: _webmin_subpaths_xterm
become: true
ansible.builtin.lineinfile:
path: "{{ XTERM_CONFIG_PATH }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
loop:
- { line: "host={{ WEBMIN_HOST }}/{{ WEBMIN_PREFIX }}", regexp: "^host=" }
- name: Reload Webmin
when: (_webmin_subpaths_config.changed or _webmin_subpaths_miniserv.changed or _webmin_subpaths_xterm.changed)
become: true
ansible.builtin.service:
name: "webmin"
state: restarted
enabled: true