linux-system-roles / network

An ansible role to configure networking
https://linux-system-roles.github.io/network/
BSD 3-Clause "New" or "Revised" License
237 stars 106 forks source link

bond creation from example does not work with initscipts #242

Closed vbenes closed 4 years ago

vbenes commented 4 years ago

I've taken the example from https://github.com/linux-system-roles/network/blob/master/examples/bond_simple.yml

modified it to eth0, or any other device present in the system and executed it via ansible-playbook -vv -i localhost, bond_simple.yml

but it failed with network.service.

it looks slave profile is never created, as if I do so I can up bond via ifup

slave ifcfg TYPE=Ethernet DEVICE=eth0 ONBOOT=yes MASTER=bond0 SLAVE=yes

vbenes commented 4 years ago

`[root@gsm-r5s6-01 examples]# ansible-playbook -vv -i localhost, bond_simple.yml
ansible-playbook 2.9.9 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible-playbook python version = 2.7.5 (default, Mar 20 2020, 17:08:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: bond_simple.yml ** 1 plays in bond_simple.yml

PLAY [all] *****

TASK [Gathering Facts] ***** task path: /mnt/tests/NetworkManager-ci/network/examples/bond_simple.yml:3 ok: [localhost] META: ran handlers

TASK [linux-system-roles.network : Check which services are running] *** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:4 ok: [localhost] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

TASK [linux-system-roles.network : Check which packages are installed] ***** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:9 ok: [localhost] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

TASK [linux-system-roles.network : Print network provider] ***** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:13 ok: [localhost] => { "msg": "Using network provider: initscripts" }

TASK [linux-system-roles.network : Install packages] *** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:20 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [linux-system-roles.network : Enable and start NetworkManager] **** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:27 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [linux-system-roles.network : Enable and start wpa_supplicant] **** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:37 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [linux-system-roles.network : Enable network service] ***** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:46 ok: [localhost] => {"changed": false, "enabled": true, "name": "network", "status": {"ActiveEnterTimestamp": "Tue 2020-06-09 06:07:10 EDT", "ActiveEnterTimestampMonotonic": "456348175", "ActiveExitTimestamp": "Tue 2020-06-09 06:29:33 EDT", "ActiveExitTimestampMonotonic": "1799508921", "ActiveState": "failed", "After": "NetworkManager-wait-online.service NetworkManager.service systemd-journald.socket ip6tables.service network-pre.target basic.target system.slice iptables.service", "AllowIsolate": "no", "AmbientCapabilities": "0", "AssertResult": "yes", "AssertTimestamp": "Tue 2020-06-09 07:30:07 EDT", "AssertTimestampMonotonic": "5433879392", "Before": "network-online.target shutdown.target multi-user.target graphical.target network.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "CollectMode": "inactive", "ConditionResult": "yes", "ConditionTimestamp": "Tue 2020-06-09 07:30:07 EDT", "ConditionTimestampMonotonic": "5433879391", "Conflicts": "shutdown.target", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "LSB: Bring up/down networking", "DevicePolicy": "auto", "Documentation": "man:systemd-sysv-generator(8)", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "0", "ExecMainStartTimestampMonotonic": "0", "ExecMainStatus": "0", "ExecStart": "{ path=/etc/rc.d/init.d/network ; argv[]=/etc/rc.d/init.d/network start ; ignore_errors=no ; start_time=[Tue 2020-06-09 07:30:07 EDT] ; stop_time=[Tue 2020-06-09 07:30:14 EDT] ; pid=6226 ; code=exited ; status=1 }", "ExecStop": "{ path=/etc/rc.d/init.d/network ; argv[]=/etc/rc.d/init.d/network stop ; ignore_errors=no ; start_time=[Tue 2020-06-09 06:29:33 EDT] ; stop_time=[Tue 2020-06-09 06:29:33 EDT] ; pid=13618 ; code=exited ; status=0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/run/systemd/generator.late/network.service", "GuessMainPID": "no", "IOScheduling": "0", "Id": "network.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "no", "InactiveEnterTimestamp": "Tue 2020-06-09 07:30:14 EDT", "InactiveEnterTimestampMonotonic": "5440607233", "InactiveExitTimestamp": "Tue 2020-06-09 07:30:07 EDT", "InactiveExitTimestampMonotonic": "5433879936", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "process", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "65536", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "4096", "LimitNPROC": "14713", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "14713", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "0", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "network.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PermissionsStartOnly": "no", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "yes", "Requires": "system.slice basic.target", "Restart": "no", "RestartUSec": "100ms", "Result": "exit-code", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "SourcePath": "/etc/rc.d/init.d/network", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "failed", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TasksAccounting": "no", "TasksCurrent": "18446744073709551615", "TasksMax": "18446744073709551615", "TimeoutStartUSec": "5min", "TimeoutStopUSec": "5min", "TimerSlackNSec": "50000", "Transient": "no", "Type": "forking", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "bad", "WantedBy": "graphical.target multi-user.target", "Wants": "network-online.target network.target", "WatchdogTimestampMonotonic": "0", "WatchdogUSec": "0"}}

TASK [linux-system-roles.network : Ensure initscripts network file dependency is present] *** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:53 ok: [localhost] => {"changed": false, "dest": "/etc/sysconfig/network", "src": "/root/.ansible/tmp/ansible-local-6530rAJEGo/tmpHnq8rT"}

TASK [linux-system-roles.network : Configure networking connection profiles] *** task path: /mnt/tests/NetworkManager-ci/network/tests/roles/linux-system-roles.network/tasks/main.yml:61 [ 5476.644138] bonding: bond0 is being created... [ 5476.781686] IPv6: ADDRCONF(NETDEV_UP): bond0: link is not ready [WARNING]: [005] #0, state:up persistent_state:present, 'bond0': add ifcfg-rh profile 'bond0' [WARNING]: [006] #0, state:up persistent_state:present, 'bond0': up connection bond0 (not-active) [WARNING]: [007] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0': rc=1, out=' Determining IP information for bond0... failed; no link present. Check cable? ', err='' [WARNING]: [008] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0' failed with exit status 1 fatal: [localhost]: FAILED! => {"changed": true, "msg": "error: call 'ifup bond0' failed with exit status 1", "stderr": "[005] #0, state:up persistent_state:present, 'bond0': add ifcfg-rh profile 'bond0'\n[006] #0, state:up persistent_state:present, 'bond0': up connection bond0 (not-active)\n[007] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0': rc=1, out='\nDetermining IP information for bond0... failed; no link present. Check cable?\n', err=''\n[008] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0' failed with exit status 1\n", "stderr_lines": ["[005] #0, state:up persistent_state:present, 'bond0': add ifcfg-rh profile 'bond0'", "[006] #0, state:up persistent_state:present, 'bond0': up connection bond0 (not-active)", "[007] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0': rc=1, out='", "Determining IP information for bond0... failed; no link present. Check cable?", "', err=''", "[008] #0, state:up persistent_state:present, 'bond0': call 'ifup bond0' failed with exit status 1"]}

PLAY RECAP ***** localhost : ok=6 changed=0 unreachable=0 failed=1 skipped=3 rescued=0 ignored=0

`

vbenes commented 4 years ago

yml looking like this:

SPDX-License-Identifier: BSD-3-Clause