Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1508614

Summary: Creating active bonded interface fails with the initscripts provider
Product: Red Hat Enterprise Linux 7 Reporter: Matt Micene <mmicene>
Component: rhel-system-rolesAssignee: Pavel Cahyna <pcahyna>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: atragler, mmicene, pcahyna, rkhan, tbowling, till, vbenes
Target Milestone: rcKeywords: Extras
Target Release: ---Flags: till: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:network
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1848472 (view as bug list) Environment:
Last Closed: 2021-02-15 07:30:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
2 log snippets from ansible playbook runs
none
Playbook used to recreate none

Description Matt Micene 2017-11-01 19:13:24 UTC
Created attachment 1346693 [details]
2 log snippets from ansible playbook runs

Description of problem:
When defining a network connection of type 'bond' and a state of 'up' on a RHEL 6 target host using init-script, the task fails as the role attempts to bring the interface online before the members are assigned to the bond.

On a RHEL 7 target host using NetworkManager, the bond succeeds.

This looks related to the order of definition of the interfaces between the two versions of RHEL.  For RHEL 6, all of the interfaces need to be created before the bond can be activated.  

Reversing the order of the variable definitions (members before the bond) fails on both systems.  Only workaround is define as 'present' instead of 'up' and activate outside of role.

Output from ansible for both scenarios attached (ansible_output.txt) and the relevant section of playbook (playbook_snippet.txt)

Version-Release number of selected component (if applicable):
rhel-system-roles-0.5-1.el7.noarch

How reproducible:
Every run against RHEL 6

Steps to Reproduce:
1. Create playbook with network_connections with vars for type 'bond' 
2. Run playbook against a RHEL 6 and a RHEL 7 system
3.

Actual results:
fatal: [appans-demo.example.com]: FAILED! => {"changed": false, "failed": true, "msg": "error: call `ifup AppBond` failed with exit status 1"}

Expected results:
Bond successfully created and up

Additional info:

Comment 2 Matt Micene 2017-11-01 19:14:31 UTC
Created attachment 1346694 [details]
Playbook used to recreate

Comment 3 Thomas Haller 2017-11-17 13:35:43 UTC
In the role, whenever you specify a slave or a VLAN, the master/parent profile must also be present. That is, you cannot just define a profile for a bond-slave, without also specifying a profile for the bond-master (same for VLAN and its parent).


The role allows for convenience to combine 'state=present' and 'state=up' in one. You can shorten:

  - name: "Wired Profile"
    state: "present"
    type: "ethernet"
    ...
  - name: "Wired Profile"
    state: "up"

to:

  - name: "Wired Profile"
    state: "up"
    type: "ethernet"
    ...

but this is really just a shortcut for covenience.


'state=up' and 'state=down' with initscripts are anyway problematic. The role does not know in which state the system is, when it issues `ifup`. And initscripts don't know it either. They just execute a series of commands, which may or may not work (e.g. it may not properly stop a previously running dhclient instance).
Especially with initscripts, the role leaves the burden of getting it right to the user who implements the playbook.

It's not clear to me what to do about this.


the workaround is also the solution: with initscripts, the user must get the order of 'state=up' and 'state=down' right.
Maybe, 'state=up' and 'state=down' doesn't really make sense with initscripts at all, and you would rather call service `service network restart`?
Maybe the role could get a new setting to call `service network restart`. It would safe the user from 
  - service:
      name: network
      state: restarted
      args: eth0



Matt, what do you think?

Comment 4 Matt Micene 2017-11-17 16:18:22 UTC
I have been using the workaround you listed at the end in the demo playbook (although with a completely poorly written task now that I look at it).

> Especially with initscripts, the role leaves the burden of getting it right to > the user who implements the playbook.

To me, this what we need to solve.  If these are meant to act the same across different versions, then the user shouldn't have to worry about understanding the differences.

> Maybe, 'state=up' and 'state=down' doesn't really make sense with initscripts > at all, and you would rather call service `service network restart`?
> Maybe the role could get a new setting to call `service network restart`.

If I'm reading right, you're suggesting to change the 'up' and 'down' behavior for these interfaces and put the service restart with the "right" interface name in the role?  

So if state is 'up' and handler is 'initscripts', the real state is 'present' and we always restart the interface for an 'up' state?  If you think that could work dynamically that seems reasonable.  It also matches the "sysadmin" behavior for initscripts: edit a bunch of files, restart the interface with the service.  

An alternate thought:

Since VLANs, bridges, bonds, and teams (anything than normal eth really) all have needs for similar changes, maybe there's a need to change the way args work in the types?  So, instead of defining members separately, there could be a 'members' var?  I'm thinking of a sequence of mappings if we need complex settings on a member, like:

members:
  - eth0
  - eth1

or a mapping if needed

members:
  - {interface_name: eth0, mac: "aa:bb:cc:dd:ee:ff"}
  - {interface_name: eth1, mac: "a1:b1:c1:d1:e1:f1"}

Nested interfaces (a bond attached to a bridge) could be complicated I think.

Do either of these options seem realistic?

Comment 5 Terry Bowling 2018-03-12 12:31:46 UTC
(In reply to Thomas Haller from comment #3)
> In the role, whenever you specify a slave or a VLAN, the master/parent
> profile must also be present. That is, you cannot just define a profile for
> a bond-slave, without also specifying a profile for the bond-master (same
> for VLAN and its parent).
> 
> ...  snip
> 
> 
> 'state=up' and 'state=down' with initscripts are anyway problematic. The
> role does not know in which state the system is, when it issues `ifup`. And
> initscripts don't know it either. They just execute a series of commands,
> which may or may not work (e.g. it may not properly stop a previously
> running dhclient instance).
> Especially with initscripts, the role leaves the burden of getting it right
> to the user who implements the playbook.
> 
> It's not clear to me what to do about this.

Is this not the power of Ansible Facts, to know the state of things and enable idempotency?  We have a wealth of knowledge about the network and interfaces easily accessible via the facts variables available during the role execution.  Here's how you can see what is available to you.

  ansible <HOST> -m setup -a 'gather_subset=network'
  ansible <HOST> -m setup -a 'gather_subset=network filter=ansible_interfaces' 

Considering this, is it possible to have a resolution to this BZ in the near future?  It breaks our RHEL 6 compatibility story for a very common networking configuration scenario.

Comment 6 Marcelo Ricardo Leitner 2019-07-03 15:11:17 UTC
Mass-moving bugs RHEL <= 7.6.0 to 7.7.0.
As we are past RFE deadline for 7.7.0 and we should have no new features on 7.8.0, please evaluate if it's still wanted on RHEL7 and contact PM for exception. You may also move it to RHEL8 if that's wanted. Thanks!

Comment 8 Till Maas 2020-06-17 16:32:48 UTC
Matt, if possible, please take a look at the upstream system role pull request: https://github.com/linux-system-roles/network/pull/250 - it should address the problem with creating the playbook that you specified.

Comment 9 Matt Micene 2020-10-15 13:26:51 UTC
Till, I don't have access the environment any more and won't be able to test the scenario I initially reported.

Comment 12 RHEL Program Management 2021-02-15 07:30:51 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.