michaelrigart / ansible-role-interfaces

An ansible role for configuring different network interfaces
GNU General Public License v3.0
83 stars 61 forks source link

Regression: RHEL route options #145

Closed cityofships closed 11 months ago

cityofships commented 11 months ago

These had ceased to work after conditional has been replaced by loop in 51a2e997ee1b8fa630a4e23f793a13a82be17d93 - route var can not be therefore modified. When running the sample playbook, onlink option is missing:

TASK [MichaelRigart.interfaces : RedHat | Write configuration files for rhel route configuration] ***************************************************************************************************************************************************************************************************************
task path: /home/stack/ansible-role-interfaces/tasks/ethernet_configuration.yml:26
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: stack
<localhost> EXEC /bin/sh -c 'echo ~stack && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/stack/.ansible/tmp `"&& mkdir "` echo /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155 `" && echo ansible-tmp-1690206385.0158195-57452-276322253783155="` echo /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155 `" ) && sleep 0'
redirecting (type: filter) ansible.builtin.ipaddr to ansible.netcommon.ipaddr
redirecting (type: filter) ansible.builtin.ipaddr to ansible.netcommon.ipaddr
redirecting (type: filter) ansible.builtin.ipaddr to ansible.netcommon.ipaddr
Using module file /home/stack/venv/lib64/python3.6/site-packages/ansible/modules/stat.py
<localhost> PUT /home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmp0_41jtb1 TO /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/ /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_stat.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -n  -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-sfnsqxzvzquynslmyrcyttybvgzxnviu ; /usr/libexec/platform-python /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_stat.py'"'"' && sleep 0'
Using module file /home/stack/venv/lib64/python3.6/site-packages/ansible/modules/file.py
<localhost> PUT /home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmph9251nju TO /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_file.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/ /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_file.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -n  -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-ggepugvoqetvacrclkhlcxsvhibnucfj ; /usr/libexec/platform-python /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/AnsiballZ_file.py'"'"' && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/stack/.ansible/tmp/ansible-tmp-1690206385.0158195-57452-276322253783155/ > /dev/null 2>&1 && sleep 0'
--- before
+++ after: /home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmp6_totbb6/route_RedHat.j2
@@ -0,0 +1,6 @@
+# Ansible managed
+
+ 10.6.0.0/24 via 10.1.0.2
+ 10.3.0.0/24 via 10.1.0.3 table myroutetable
+ 10.1.0.0/24 dev veth1.1001 table myroutetable
+ 10.7.0.0/24 via 10.1.0.2

changed: [localhost] => (item={'device': 'veth1.1001', 'bootproto': 'static', 'address': '10.1.0.1', 'netmask': '255.255.255.0', 'rules': ['from 10.1.0.0/24 table myroutetable', 'to 10.1.0.0/24 table myroutetable'], 'route': [{'network': '10.6.0.0', 'netmask': '255.255.255.0', 'gateway': '10.1.0.2'}, {'network': '10.3.0.0', 'netmask': '255.255.255.0', 'gateway': '10.1.0.3', 'table': 'myroutetable'}, {'network': '10.1.0.0', 'netmask': '255.255.255.0', 'table': 'myroutetable'}, {'network': '10.7.0.0', 'netmask': '255.255.255.0', 'gateway': '10.1.0.2', 'options': ['onlink']}]}) => {
    "ansible_loop_var": "item",
    "changed": true,
    "diff": [
        {
            "after": "# Ansible managed\n\n 10.6.0.0/24 via 10.1.0.2\n 10.3.0.0/24 via 10.1.0.3 table myroutetable\n 10.1.0.0/24 dev veth1.1001 table myroutetable\n 10.7.0.0/24 via 10.1.0.2\n",
            "after_header": "/home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmp6_totbb6/route_RedHat.j2",
            "before": ""
        }
    ],
    "invocation": {
        "dest": "/etc/sysconfig/network-scripts/route-veth1.1001",
        "follow": false,
        "mode": null,
        "module_args": {
            "dest": "/etc/sysconfig/network-scripts/route-veth1.1001",
            "follow": false,
            "mode": null,
            "src": "/home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmp6_totbb6/route_RedHat.j2"
        },
        "src": "/home/stack/.ansible/tmp/ansible-local-56666u8btr9ep/tmp6_totbb6/route_RedHat.j2"
    },
    "item": {
        "address": "10.1.0.1",
        "bootproto": "static",
        "device": "veth1.1001",
        "netmask": "255.255.255.0",
        "route": [
            {
                "gateway": "10.1.0.2",
                "netmask": "255.255.255.0",
                "network": "10.6.0.0"
            },
            {
                "gateway": "10.1.0.3",
                "netmask": "255.255.255.0",
                "network": "10.3.0.0",
                "table": "myroutetable"
            },
            {
                "netmask": "255.255.255.0",
                "network": "10.1.0.0",
                "table": "myroutetable"
            },
            {
                "gateway": "10.1.0.2",
                "netmask": "255.255.255.0",
                "network": "10.7.0.0",
                "options": [
                    "onlink"
                ]
            }
        ],
        "rules": [
            "from 10.1.0.0/24 table myroutetable",
            "to 10.1.0.0/24 table myroutetable"
        ]
    }
}