summaryrefslogtreecommitdiff
path: root/roles/nat/tasks/main.yml
diff options
context:
space:
mode:
authoromnom62 <omnom62@outlook.com>2026-10-05 20:56:05 +1000
committeromnom62 <omnom62@outlook.com>2026-10-05 20:56:05 +1000
commit8ee802e41374942965b6b93cfb4534725ef45145 (patch)
treeef3e5579bd767422caa6fe77cea6a7b5d2d8562c /roles/nat/tasks/main.yml
parent748df2bc1d35fa285dd3fe46916e1230408778c7 (diff)
downloadvyos.blueprints-main.tar.gz
vyos.blueprints-main.zip
T9393: new rolesmain
Diffstat (limited to 'roles/nat/tasks/main.yml')
-rw-r--r--roles/nat/tasks/main.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/roles/nat/tasks/main.yml b/roles/nat/tasks/main.yml
new file mode 100644
index 0000000..6f5007b
--- /dev/null
+++ b/roles/nat/tasks/main.yml
@@ -0,0 +1,15 @@
+---
+- name: Configure source and destination NAT
+ vyos.vyos.vyos_nat:
+ config:
+ nat: >-
+ {{ ({'source': {'rule': nat_source_rules}} if nat_source_rules else {})
+ | combine({'destination': {'rule': nat_destination_rules}} if nat_destination_rules else {}) }}
+ state: "{{ _nat_state }}"
+ register: _nat_r
+ when: (nat_source_rules | length > 0) or (nat_destination_rules | length > 0)
+
+- name: Collect rendered commands # noqa: var-naming[no-role-prefix] - shared across roles by design
+ ansible.builtin.set_fact:
+ vyos_blueprints_rendered: "{{ vyos_blueprints_rendered | default([]) + (_nat_r.rendered | default([])) }}"
+ when: vyos_blueprints_render_only | default(false) | bool