-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If enabled, a default route will be configured using the default gateway. If disabled, the default route will be removed. If this variable is not specified, the role will use the default behavior of the `network_provider` selected. Setting this option to `no` is equivalent to: - `DEFROUTE = no` in initscripts, or - `ipv4.never-default/ipv6.never-default yes` in nmcli Signed-off-by: Jack Adolph <jack.adolph@gmail.com>
- Loading branch information
Showing
7 changed files
with
409 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
--- | ||
- hosts: all | ||
vars: | ||
type: veth | ||
interface: veth0 | ||
tasks: | ||
- include_tasks: tasks/show_interfaces.yml | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: present | ||
- include_tasks: tasks/assert_device_present.yml | ||
- name: >- | ||
TEST: I can configure an interface with auto_gateway enabled | ||
debug: | ||
msg: "##################################################" | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
type: ethernet | ||
state: up | ||
ip: | ||
auto_gateway: yes | ||
dhcp4: no | ||
auto6: no | ||
address: | ||
- "2001:db8::2/64" | ||
- "203.0.113.2/24" | ||
gateway6: "2001:db8::1" | ||
gateway4: "203.0.113.1" | ||
- include_tasks: tasks/assert_device_present.yml | ||
- include_tasks: tasks/assert_profile_present.yml | ||
vars: | ||
profile: "{{ interface }}" | ||
- name: "Show ipv4 routes" | ||
command: "ip route" | ||
register: ipv4_routes | ||
changed_when: false | ||
- name: "Assert default ipv4 route is present" | ||
assert: | ||
that: | ||
- >- | ||
"default via 203.0.113.1 dev {{ interface }}" | ||
in ipv4_routes.stdout | ||
- name: "Get ipv6 routes" | ||
command: "ip -6 route" | ||
register: ipv6_route | ||
changed_when: false | ||
- name: "Assert default ipv6 route is present" | ||
assert: | ||
that: | ||
- >- | ||
"default via 2001:db8::1 dev {{ interface }}" | ||
in ipv6_route.stdout | ||
when: network_provider == "nm" | ||
- name: "TEARDOWN: remove profiles." | ||
debug: | ||
msg: "##################################################" | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
persistent_state: absent | ||
state: down | ||
ignore_errors: true | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: absent | ||
- name: >- | ||
TEST: I can configure an interface with auto_gateway disabled | ||
debug: | ||
msg: "##################################################" | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: present | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
type: ethernet | ||
state: up | ||
ip: | ||
auto_gateway: no | ||
dhcp4: no | ||
auto6: no | ||
address: | ||
- "2001:db8::2/64" | ||
- "203.0.113.2/24" | ||
gateway6: "2001:db8::1" | ||
gateway4: "203.0.113.1" | ||
- include_tasks: tasks/assert_device_present.yml | ||
- include_tasks: tasks/assert_profile_present.yml | ||
vars: | ||
profile: "{{ interface }}" | ||
- name: "Show ipv4 routes" | ||
command: "ip route" | ||
register: ipv4_routes | ||
changed_when: false | ||
- name: "Assert default ipv4 route is absent" | ||
assert: | ||
that: | ||
- >- | ||
"default via 203.0.113.1 dev {{ interface }}" | ||
not in ipv4_routes.stdout | ||
- name: "Get ipv6 routes" | ||
command: "ip -6 route" | ||
register: ipv6_route | ||
changed_when: false | ||
- name: "Assert default ipv6 route is absent" | ||
assert: | ||
that: | ||
- >- | ||
"default via 2001:db8::1 dev {{ interface }}" | ||
not in ipv6_route.stdout | ||
when: network_provider == "nm" | ||
- name: "TEARDOWN: remove profiles." | ||
debug: | ||
msg: "##################################################" | ||
- import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
persistent_state: absent | ||
state: down | ||
ignore_errors: true | ||
- include_tasks: tasks/manage_test_interface.yml | ||
vars: | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# This file was generated by ensure_provider_tests.py | ||
--- | ||
- hosts: all | ||
name: > | ||
Run playbook 'playbooks/tests_auto_gateway.yml' with | ||
initscripts as provider | ||
tasks: | ||
- name: Set network provider to 'initscripts' | ||
set_fact: | ||
network_provider: initscripts | ||
tags: | ||
- always | ||
|
||
- import_playbook: playbooks/tests_auto_gateway.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# This file was generated by ensure_provider_tests.py | ||
--- | ||
# set network provider and gather facts | ||
- hosts: all | ||
name: Run playbook 'playbooks/tests_auto_gateway.yml' with nm as provider | ||
tasks: | ||
- name: Set network provider to 'nm' | ||
set_fact: | ||
network_provider: nm | ||
tags: | ||
- always | ||
|
||
|
||
# The test requires or should run with NetworkManager, therefore it cannot run | ||
# on RHEL/CentOS 6 | ||
- import_playbook: playbooks/tests_auto_gateway.yml | ||
when: | ||
- ansible_distribution_major_version != '6' |
Oops, something went wrong.