Skip to content
Snippets Groups Projects
Commit f044c197 authored by Tomáš Sapák's avatar Tomáš Sapák
Browse files

Merge branch 'opnsense-static-networking' into 'master'

OPNsense use static networking for all interfaces

See merge request muni-kypo-crp/backend-python/ansible-networking-stage/kypo-interface!5
parents 6ddb1541 0d874a34
No related branches found
No related tags found
No related merge requests found
...@@ -10,14 +10,6 @@ ...@@ -10,14 +10,6 @@
loop: '{{ kypo_interface_interfaces }}' loop: '{{ kypo_interface_interfaces }}'
when: kypo_interface_clean is defined and kypo_interface_clean when: kypo_interface_clean is defined and kypo_interface_clean
- name: configure interfaces
include_tasks: interface-FreeBSD.yml
vars:
kypo_interface_device: '{{ kypo_interface_item.kypo_interface_device }}'
loop_control:
loop_var: kypo_interface_item
loop: '{{ kypo_interface_interfaces }}'
- name: get default gateway - name: get default gateway
set_fact: set_fact:
kypo_interface_default_gateway: '{{ kypo_interface_interfaces | selectattr("kypo_interface_default_gateway", "defined") | first }}' kypo_interface_default_gateway: '{{ kypo_interface_interfaces | selectattr("kypo_interface_default_gateway", "defined") | first }}'
...@@ -68,7 +60,7 @@ ...@@ -68,7 +60,7 @@
delegate_to: localhost delegate_to: localhost
- set_fact: - set_fact:
interfaces: "{{ ansible_interfaces | select('match', '^(vtnet)[2-9]+') | list }}" interfaces: "{{ ansible_interfaces | select('match', '^(vtnet)[0-9]+') | list }}"
- set_fact: - set_fact:
interface_configs: |- interface_configs: |-
...@@ -78,7 +70,7 @@ ...@@ -78,7 +70,7 @@
{%- endfor -%} {%- endfor -%}
] ]
- name: set static addressing on user defined networks - name: set static addressing on allnetworks
xml: xml:
path: '{{ kypo_interface_opnsense_local_config_file }}' path: '{{ kypo_interface_opnsense_local_config_file }}'
xpath: '/opnsense/interfaces/{{ item.0.if }}/{{ item.1.key }}' xpath: '/opnsense/interfaces/{{ item.0.if }}/{{ item.1.key }}'
......
- name: prepare interface configuration
set_fact:
kypo_interface_config:
if: '{{ kypo_interface_device }}'
ipaddr: dhcp
mtu: '{{ kypo_interface_mtu }}'
enable: 1
- name: configure interface
xml:
path: '{{ kypo_interface_opnsense_local_config_file }}'
xpath: '/opnsense/interfaces/{{ kypo_interface_device }}/{{ item.key }}'
value: '{{ item.value }}'
pretty_print: yes
delegate_to: localhost
loop: '{{ kypo_interface_config | dict2items }}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment