mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-20 17:59:00 +00:00
ansible-lint: Fix no-changed-when failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
7f26cdb8ac
commit
2b693d14c0
30 changed files with 109 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ GET_NM_VERSION = """
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
"""
|
||||
|
||||
MINIMUM_NM_VERSION_CHECK = """
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
{{ module_utils_parent_and_dir.stdout_lines[1] }}
|
||||
# noqa command-instead-of-module
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
|
||||
- name: Copy testrepo.tar to the remote system
|
||||
copy:
|
||||
|
|
@ -98,6 +99,7 @@
|
|||
if [ -d {{ _rundir.path }}/module_utils ]; then
|
||||
mv {{ _rundir.path }}/module_utils {{ _rundir.path }}/ansible
|
||||
fi
|
||||
changed_when: false
|
||||
|
||||
- name: Fake out python module directories, primarily for python2
|
||||
shell: |
|
||||
|
|
@ -106,6 +108,7 @@
|
|||
touch "$dir/__init__.py"
|
||||
fi
|
||||
done
|
||||
changed_when: false
|
||||
|
||||
- name: Set _lsr_python_path
|
||||
set_fact:
|
||||
|
|
@ -120,6 +123,7 @@
|
|||
|
||||
- name: "List the files in {{ _rundir.path }}"
|
||||
command: ls -alrtFR {{ _rundir.path }}
|
||||
changed_when: false
|
||||
|
||||
- block:
|
||||
- name: Run pytest with nm
|
||||
|
|
@ -130,6 +134,7 @@
|
|||
register: playbook_run
|
||||
environment:
|
||||
PYTHONPATH: "{{ _lsr_python_path }}"
|
||||
changed_when: false
|
||||
always:
|
||||
- debug:
|
||||
var: playbook_run.stdout_lines
|
||||
|
|
@ -147,6 +152,7 @@
|
|||
register: playbook_run
|
||||
environment:
|
||||
PYTHONPATH: "{{ _lsr_python_path }}"
|
||||
changed_when: false
|
||||
always:
|
||||
- debug:
|
||||
var: playbook_run.stdout_lines
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: original_ethtool_coalesce
|
||||
changed_when: false
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: ethtool_coalesce
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not change the ethtool coalesce"
|
||||
assert:
|
||||
that:
|
||||
|
|
@ -65,6 +67,7 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: ethtool_coalesce
|
||||
changed_when: false
|
||||
- name: Show ethtool_coalesce output
|
||||
debug:
|
||||
var: ethtool_coalesce.stdout_lines
|
||||
|
|
@ -94,6 +97,7 @@
|
|||
- name: Get current device coalesce
|
||||
command: "ethtool --show-coalesce {{ interface }}"
|
||||
register: ethtool_coalesce
|
||||
changed_when: false
|
||||
# Resetting the ethtools only works with NetworkManager
|
||||
- name: "ASSERT: The profile does not change the ethtool coalesce"
|
||||
assert:
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
ca_cert: /etc/pki/tls/cacert.pem
|
||||
- name: "TEST: I can ping the EAP server"
|
||||
command: ping -c1 203.0.113.1
|
||||
changed_when: false
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
mode: 0644
|
||||
- name: Update ca trust
|
||||
command: update-ca-trust
|
||||
changed_when: false
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
|
|
@ -82,6 +84,7 @@
|
|||
domain_suffix_match: example.com
|
||||
- name: "TEST: I can ping the EAP server"
|
||||
command: ping -c1 203.0.113.1
|
||||
changed_when: false
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
|
|
@ -126,3 +129,4 @@
|
|||
- /etc/pki/ca-trust/source/anchors/cacert.pem
|
||||
- name: Update ca trust
|
||||
command: update-ca-trust
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
command: cp -vf /etc/resolv.conf /etc/resolv.conf.bak
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- block:
|
||||
- name: "TEST Add Bond with 2 ports"
|
||||
debug:
|
||||
|
|
@ -71,18 +72,21 @@
|
|||
/proc/net/bonding/{{ controller_device }}
|
||||
register: result
|
||||
until: "'110' in result.stdout"
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv4"
|
||||
command: ip -4 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'192.0.2' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'2001' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
always:
|
||||
- tags:
|
||||
- "tests::cleanup"
|
||||
|
|
@ -104,8 +108,10 @@
|
|||
failed_when: false
|
||||
- command: ip link del {{ controller_device }}
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
||||
- name: "Restore the /etc/resolv.conf for initscript"
|
||||
command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
command: cp -vf /etc/resolv.conf /etc/resolv.conf.bak
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- block:
|
||||
- name: TEST Add Bond with 2 ports
|
||||
debug:
|
||||
|
|
@ -123,8 +124,10 @@
|
|||
failed_when: false
|
||||
- command: ip link del {{ controller_device }}
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
||||
- name: Restore the /etc/resolv.conf for initscript
|
||||
command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -67,18 +67,21 @@
|
|||
/proc/net/bonding/{{ controller_device }}
|
||||
register: result
|
||||
until: "'110' in result.stdout"
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv4"
|
||||
command: ip -4 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'192.0.2' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'2001' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
always:
|
||||
- tags:
|
||||
- "tests::cleanup"
|
||||
|
|
@ -100,4 +103,5 @@
|
|||
failed_when: false
|
||||
- command: ip link del {{ controller_device }}
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
- { key: 'updelay', value: '0'}
|
||||
- { key: 'use_carrier', value: '1'}
|
||||
- { key: 'xmit_hash_policy', value: 'encap2+3'}
|
||||
changed_when: false
|
||||
|
||||
- name: "** TEST check IPv4"
|
||||
command: ip -4 a s {{ controller_device }}
|
||||
|
|
@ -108,12 +109,14 @@
|
|||
until: "'192.0.2' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'2001' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
|
||||
- name: Reconfigure the bond options
|
||||
import_role:
|
||||
|
|
@ -156,6 +159,7 @@
|
|||
- { key: 'arp_ip_target', value: '192.0.2.128'}
|
||||
- { key: 'arp_validate', value: 'none'}
|
||||
- { key: 'primary', value: '{{ dhcp_interface1 }}'}
|
||||
changed_when: false
|
||||
|
||||
- name: "** TEST check IPv4"
|
||||
command: ip -4 a s {{ controller_device }}
|
||||
|
|
@ -163,12 +167,14 @@
|
|||
until: "'192.0.2' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'2001' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
|
||||
always:
|
||||
- tags:
|
||||
|
|
@ -191,4 +197,5 @@
|
|||
failed_when: false
|
||||
- command: ip link del {{ controller_device }}
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
command: cp -vf /etc/resolv.conf /etc/resolv.conf.bak
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- block:
|
||||
- name: "TEST Add Bond with 2 ports"
|
||||
debug:
|
||||
|
|
@ -71,18 +72,21 @@
|
|||
/proc/net/bonding/{{ controller_device }}
|
||||
register: result
|
||||
until: "'110' in result.stdout"
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv4"
|
||||
command: ip -4 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'192.0.2' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s {{ controller_device }}
|
||||
register: result
|
||||
until: "'2001' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
|
||||
- name: Deactivate and remove the bond controller profile
|
||||
"{{ controller_profile }}"
|
||||
|
|
@ -238,8 +242,10 @@
|
|||
failed_when: false
|
||||
- command: ip link del {{ controller_device }}
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
- import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
|
||||
- name: "Restore the /etc/resolv.conf for initscript"
|
||||
command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
- name: Get NM dbus objects
|
||||
command: busctl --system tree --list org.freedesktop.NetworkManager
|
||||
register: nm_dbus_objects
|
||||
changed_when: false
|
||||
- name: Show nm_dbus_objects
|
||||
debug:
|
||||
var: nm_dbus_objects
|
||||
|
|
@ -87,3 +88,4 @@
|
|||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ interface }}"
|
||||
state: absent
|
||||
- command: ip link del "{{ interface }}"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
register: no_coalesce_nm
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not contain coalescing options"
|
||||
assert:
|
||||
that: no_coalesce_nm.stdout | length == 0
|
||||
|
|
@ -58,6 +59,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not contain coalescing options"
|
||||
assert:
|
||||
that: no_coalesce_initscripts.stdout | length == 0
|
||||
|
|
@ -87,6 +89,7 @@
|
|||
register: with_coalesce_nm
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: Assert coalesce options set in profile
|
||||
assert:
|
||||
that: with_coalesce_nm.stdout == '128'
|
||||
|
|
@ -100,6 +103,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: Assert coalesce options set in profile
|
||||
assert:
|
||||
that: '"rx-frames 128" in with_coalesce_initscripts.stdout'
|
||||
|
|
@ -126,6 +130,7 @@
|
|||
when:
|
||||
- network_provider == "nm"
|
||||
register: clear_coalesce_nm
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does reset coalescing options"
|
||||
assert:
|
||||
that: clear_coalesce_nm.stdout | length == 0
|
||||
|
|
@ -138,6 +143,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does reset coalescing options"
|
||||
assert:
|
||||
that: clear_coalesce_initscripts.stdout | length == 0
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: original_ethtool_features
|
||||
changed_when: false
|
||||
- name: Import network role
|
||||
import_role:
|
||||
name: linux-system-roles.network
|
||||
|
|
@ -47,6 +48,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not change the ethtool features"
|
||||
assert:
|
||||
that:
|
||||
|
|
@ -76,6 +78,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
changed_when: false
|
||||
- name: Show ethtool_features
|
||||
debug:
|
||||
var: ethtool_features.stdout_lines
|
||||
|
|
@ -114,6 +117,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
changed_when: false
|
||||
- name: Show ethtool_features
|
||||
debug:
|
||||
var: ethtool_features.stdout_lines
|
||||
|
|
@ -183,6 +187,7 @@
|
|||
- name: Get current device features
|
||||
command: "ethtool --show-features {{ interface }}"
|
||||
register: ethtool_features
|
||||
changed_when: false
|
||||
# Resetting the ethtools only works with NetworkManager
|
||||
- name: "ASSERT: The profile does not change the ethtool features"
|
||||
assert:
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
register: no_ring_nm
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not contain ring options"
|
||||
assert:
|
||||
that: no_ring_nm.stdout | length == 0
|
||||
|
|
@ -58,6 +59,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does not contain ring options"
|
||||
assert:
|
||||
that: no_ring_initscripts.stdout | length == 0
|
||||
|
|
@ -91,6 +93,7 @@
|
|||
register: with_ring_rx
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: Assert ethtool.ring-rx option set in profile
|
||||
assert:
|
||||
that: with_ring_rx.stdout == '128'
|
||||
|
|
@ -101,6 +104,7 @@
|
|||
register: with_ring_rx_jumbo
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: Assert ethtool.ring-rx-jumbo option set in profile
|
||||
assert:
|
||||
that: with_ring_rx_jumbo.stdout == '128'
|
||||
|
|
@ -111,6 +115,7 @@
|
|||
register: with_ring_rx_mini
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: Assert ethtool.ring-rx-mini option set in profile
|
||||
assert:
|
||||
that: with_ring_rx_mini.stdout == '128'
|
||||
|
|
@ -121,6 +126,7 @@
|
|||
register: with_ring_tx
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: Assert ethtool.ring-tx option set in profile
|
||||
assert:
|
||||
that: with_ring_tx.stdout == '128'
|
||||
|
|
@ -134,6 +140,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: Assert ethtool.ring option set in profile
|
||||
assert:
|
||||
that:
|
||||
|
|
@ -164,6 +171,7 @@
|
|||
register: clear_ring_nm
|
||||
when:
|
||||
- network_provider == "nm"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does reset ring options"
|
||||
assert:
|
||||
that: clear_ring_nm.stdout | length == 0
|
||||
|
|
@ -176,6 +184,7 @@
|
|||
ignore_errors: true
|
||||
when:
|
||||
- network_provider == "initscripts"
|
||||
changed_when: false
|
||||
- name: "ASSERT: The profile does reset ring options"
|
||||
assert:
|
||||
that: clear_ring_initscripts.stdout | length == 0
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
until: "'198.51.100.133/30' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
|
||||
- name: "** TEST check IPv6"
|
||||
command: ip -6 a s ib0.000a
|
||||
|
|
@ -60,6 +61,7 @@
|
|||
until: "'2001:db8::2/32' in result.stdout"
|
||||
retries: 20
|
||||
delay: 2
|
||||
changed_when: false
|
||||
|
||||
always:
|
||||
- tags:
|
||||
|
|
@ -79,3 +81,4 @@
|
|||
failed_when: false
|
||||
- command: ip link del ib0.000a
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
when:
|
||||
# netns not available on RHEL/CentOS 6
|
||||
- ansible_distribution_major_version != '6'
|
||||
changed_when: false
|
||||
- block:
|
||||
- name: >-
|
||||
TEST: I can configure an interface with static ipv6 config
|
||||
|
|
@ -46,6 +47,7 @@
|
|||
- name: Get ip address information
|
||||
command: "ip addr show {{ interface }}"
|
||||
register: ip_addr
|
||||
changed_when: false
|
||||
- name: Show ip_addr
|
||||
debug:
|
||||
var: ip_addr.stdout
|
||||
|
|
@ -61,6 +63,7 @@
|
|||
- name: Get ipv6 routes
|
||||
command: "ip -6 route"
|
||||
register: ipv6_route
|
||||
changed_when: false
|
||||
- name: Show ipv6_route
|
||||
debug:
|
||||
var: ipv6_route.stdout
|
||||
|
|
@ -74,6 +77,7 @@
|
|||
command: ping6 -c1 2001:db8::1
|
||||
when:
|
||||
- ansible_distribution_major_version != '6'
|
||||
changed_when: false
|
||||
always:
|
||||
- name: "TEARDOWN: remove profiles."
|
||||
debug:
|
||||
|
|
@ -94,3 +98,4 @@
|
|||
command: ip netns delete ns1
|
||||
when:
|
||||
- ansible_distribution_major_version != '6'
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -69,3 +69,4 @@
|
|||
persistent_state: absent
|
||||
state: down
|
||||
- command: ip link del "{{ interface }}"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@
|
|||
- name: Enable EPEL 7
|
||||
command: yum-config-manager --enable epel
|
||||
when: ansible_distribution_major_version == '7'
|
||||
changed_when: false
|
||||
|
||||
- name: Enable EPEL 8
|
||||
command: dnf config-manager --set-enabled epel
|
||||
when: ansible_distribution_major_version == '8'
|
||||
changed_when: false
|
||||
|
||||
- name: Enable EPEL 6
|
||||
copy:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
cmd: rpm -qa --qf '%{name}-%{version}-%{release}\n' NetworkManager
|
||||
# noqa command-instead-of-module
|
||||
register: __rpm_q_networkmanager
|
||||
changed_when: false
|
||||
|
||||
- name: Store NetworkManager version
|
||||
set_fact:
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
grep "^# Ansible managed"
|
||||
/etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
||||
register: _result
|
||||
changed_when: false
|
||||
|
||||
- name: Verify the ansible_managed comment in ifcfg-{{ profile }}
|
||||
set_fact:
|
||||
|
|
|
|||
|
|
@ -26,36 +26,43 @@
|
|||
- ip link set {{ interface }} up
|
||||
when: "type == 'veth' and state == 'present' and
|
||||
interface not in current_interfaces"
|
||||
changed_when: false
|
||||
- name: Set up veth as managed by NetworkManager
|
||||
command: nmcli d set {{ interface }} managed true
|
||||
# The varible for `network_provider` is not exists yet,
|
||||
# just ignore error for initscripts
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
when: "type == 'veth' and state == 'present'"
|
||||
changed_when: false
|
||||
|
||||
- name: Delete veth interface {{ interface }}
|
||||
command: ip link del {{ interface }} type veth
|
||||
when: "type == 'veth' and state == 'absent' and
|
||||
interface in current_interfaces"
|
||||
changed_when: false
|
||||
|
||||
# dummy
|
||||
- name: Create dummy interface {{ interface }}
|
||||
command: ip link add "{{ interface }}" type dummy
|
||||
when: "type == 'dummy' and state == 'present' and
|
||||
interface not in current_interfaces"
|
||||
changed_when: false
|
||||
|
||||
- name: Delete dummy interface {{ interface }}
|
||||
command: ip link del "{{ interface }}" type dummy
|
||||
when: "type == 'dummy' and state == 'absent' and
|
||||
interface in current_interfaces"
|
||||
changed_when: false
|
||||
|
||||
# tap
|
||||
- name: Create tap interface {{ interface }}
|
||||
command: ip tuntap add dev {{ interface }} mode tap
|
||||
when: "type == 'tap' and state == 'present'
|
||||
and interface not in current_interfaces"
|
||||
changed_when: false
|
||||
|
||||
- name: Delete tap interface {{ interface }}
|
||||
command: ip tuntap del dev {{ interface }} mode tap
|
||||
when: "type == 'tap' and state == 'absent' and
|
||||
interface in current_interfaces"
|
||||
changed_when: false
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
- ansible_distribution_version | float < 8.6
|
||||
- ansible_distribution_major_version == '8'
|
||||
- ansible_distribution == 'RedHat'
|
||||
changed_when: false
|
||||
|
||||
- name: Install hostapd
|
||||
package:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
when:
|
||||
- ansible_distribution_major_version == '8'
|
||||
- ansible_distribution == 'CentOS'
|
||||
changed_when: false
|
||||
|
||||
- name: Install hostapd in Fedora
|
||||
shell: |
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
dnf -y install hostapd
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
changed_when: false
|
||||
|
||||
- name: Install mac80211_hwsim kernel modules in Fedora
|
||||
shell: |
|
||||
|
|
@ -38,6 +40,7 @@
|
|||
dnf -y install kernel-modules*.rpm
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
changed_when: false
|
||||
|
||||
- name: Create hostapd config
|
||||
copy:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
when:
|
||||
- ansible_distribution_major_version == '8'
|
||||
- ansible_distribution == 'CentOS'
|
||||
changed_when: false
|
||||
|
||||
- name: Install hostapd in Fedora
|
||||
package:
|
||||
|
|
@ -41,6 +42,7 @@
|
|||
dnf -y install kernel-modules*.rpm
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
changed_when: false
|
||||
|
||||
- name: Create hostapd config
|
||||
copy:
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
ca_path: /etc/pki/tls/my_ca_certs
|
||||
- name: "TEST: I can ping the EAP server"
|
||||
command: ping -c1 203.0.113.1
|
||||
changed_when: false
|
||||
- name: Trigger failure in case the role did not fail
|
||||
fail:
|
||||
msg: after test
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
networkmanager_version: "{{ networkmanager_info.results |
|
||||
selectattr('yumstate', 'match', '^installed$') |
|
||||
map(attribute='version') | list | first }}"
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
{{ module_utils_parent_and_dir.stdout_lines[1] }}
|
||||
# noqa command-instead-of-module
|
||||
delegate_to: localhost
|
||||
changed_when: false
|
||||
|
||||
- name: Copy testrepo.tar to the remote system
|
||||
copy:
|
||||
|
|
@ -79,6 +80,7 @@
|
|||
if [ -d {{ _rundir.path }}/module_utils ]; then
|
||||
mv {{ _rundir.path }}/module_utils {{ _rundir.path }}/ansible
|
||||
fi
|
||||
changed_when: false
|
||||
|
||||
- name: Fake out python module directories, primarily for python2
|
||||
shell: |
|
||||
|
|
@ -87,6 +89,7 @@
|
|||
touch "$dir/__init__.py"
|
||||
fi
|
||||
done
|
||||
changed_when: false
|
||||
|
||||
- name: Copy unit test to remote system
|
||||
copy:
|
||||
|
|
@ -108,6 +111,7 @@
|
|||
|
||||
- name: "List the files in {{ _rundir.path }}"
|
||||
command: ls -alrtFR {{ _rundir.path }}
|
||||
changed_when: false
|
||||
- debug:
|
||||
msg: path {{ _lsr_python_path }}
|
||||
|
||||
|
|
@ -116,6 +120,7 @@
|
|||
ignore_errors: true
|
||||
register: python2_available
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
- name: Run python2 unit tests
|
||||
command: >
|
||||
|
|
@ -125,12 +130,14 @@
|
|||
when: >
|
||||
python2_available is succeeded and ansible_distribution != 'Fedora'
|
||||
register: python2_result
|
||||
changed_when: false
|
||||
|
||||
- name: Check if python3 is available
|
||||
command: python3 --version
|
||||
ignore_errors: true
|
||||
register: python3_available
|
||||
when: true
|
||||
changed_when: false
|
||||
|
||||
- name: Run python3 unit tests
|
||||
command: >
|
||||
|
|
@ -139,6 +146,7 @@
|
|||
PYTHONPATH: "{{ _lsr_python_path }}"
|
||||
when: python3_available is succeeded
|
||||
register: python3_result
|
||||
changed_when: false
|
||||
|
||||
- name: Show python2 unit test results
|
||||
debug:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue