mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-07-02 15:53:06 +02:00
bitwarden
This commit is contained in:
29
playbooks/reconfigure_router.yml
Normal file
29
playbooks/reconfigure_router.yml
Normal file
@ -0,0 +1,29 @@
|
||||
- hosts: router
|
||||
name: Switch destination
|
||||
ignore_unreachable: false
|
||||
tasks:
|
||||
- name: Get ruleset
|
||||
command: nvram get vts_rulelist
|
||||
when: inventory_hostname in groups['router']
|
||||
register: ruleset
|
||||
- name: Print the gateway for each host when defined
|
||||
ansible.builtin.debug:
|
||||
msg: "var is {{ ruleset.stdout }}"
|
||||
- name: initialize variables
|
||||
set_fact:
|
||||
regexp: "\\g<1>{{ DESTINATION }}\\3"
|
||||
- set_fact:
|
||||
app_path: "{{ ruleset.stdout | regex_replace('(\\<MAIL_SERVER\\>[0-9,]{1,}\\>)([0-9.]{1,})(\\>[0-9a-zA-Z\\s-]{0,}\\>TCP\\>)', regexp) | regex_replace('(\\<WEB_SERVER\\>[0-9,]{1,}\\>)([0-9.]{1,})(\\>[0-9a-zA-Z\\s-]{0,}\\>TCP\\>)', regexp) }}"
|
||||
- name: Print the gateway for each host when defined
|
||||
ansible.builtin.debug:
|
||||
msg: "var is {{ app_path }}"
|
||||
- name: Set ruleset
|
||||
command: nvram set vts_rulelist={{ app_path }}
|
||||
when: inventory_hostname in groups['router']
|
||||
|
||||
- name: Commit ruleset
|
||||
command: nvram commit
|
||||
when: inventory_hostname in groups['router']
|
||||
- name: Commit ruleset
|
||||
command: service restart_firewall
|
||||
when: inventory_hostname in groups['router']
|
Reference in New Issue
Block a user