Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rhel-system-roles does not reload the network profile upon profile modification #124

Open
venkeekavtikwar opened this issue Jul 2, 2019 · 3 comments

Comments

@venkeekavtikwar
Copy link

SUMMARY

rhel-system-roles network configuration does not reload the existing network profile upon modification when the interface will be makred as a part of bond slave.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

rhel-system-roles-1.0-5.el7.noarch
rhel-system-roles.network

ANSIBLE VERSION
ansible 2.7.8
CONFIGURATION

OS / ENVIRONMENT
RHEL 7.5
kernel-3.10.0-862.14.4.el7.x86_64
NetworkManager-1.12.0-10.el7_6.x86_64

STEPS TO REPRODUCE
  • Create a playbook and use "rhel-system-roles.network" module for network configuration.
$ cat inventory
[test]
192.168.122.16

$ cat role_test_bond.yml
---

#- name: Test a network system role
- hosts: test
  vars:
#   network_providers: initscripts
   network_connections:

    - autoconnect: 'yes'
      bond:
        miimon: 100
        mode: active-backup
      interface_name: bond0
      ip:
        address:
          - 192.168.40.1/24
        auto6: 'no'
        dhcp4: 'no'
      name: bond0
      state: up
      type: bond
    - name: ens9
      interface_name: ens9
      master: bond0
      type: ethernet
      state: up

  roles:
    - rhel-system-roles.network

$ ansible-playbook role_test_bond.yml
SSH password:

PLAY [test] ********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [192.168.122.16]

TASK [rhel-system-roles.network : Check which services are running] ************
ok: [192.168.122.16]

TASK [rhel-system-roles.network : Check which packages are installed] **********
ok: [192.168.122.16]

TASK [rhel-system-roles.network : Print network provider] **********************
ok: [192.168.122.16] => {
    "msg": "Using network provider: nm"
}

TASK [rhel-system-roles.network : Install packages] ****************************
skipping: [192.168.122.16]

TASK [rhel-system-roles.network : Enable network service] **********************
ok: [192.168.122.16]

TASK [rhel-system-roles.network : Configure networking connection profiles] ****
 [WARNING]: [005] <info>  #0, state:up persistent_state:present, 'bond0': add
connection bond0, 46072568-87ae-456b-b9f9-47b9624bdd24

 [WARNING]: [006] <info>  #0, state:up persistent_state:present, 'bond0': up
connection bond0, 46072568-87ae-456b-b9f9-47b9624bdd24 (not-active)

 [WARNING]: [007] <info>  #1, state:up persistent_state:present, 'ens9': update
connection ens9, 5a8d6d84-a7d7-4aba-a378-0e6db147c008

 [WARNING]: [008] <info>  #1, state:up persistent_state:present, 'ens9': up
connection ens9, 5a8d6d84-a7d7-4aba-a378-0e6db147c008 (is-modified)

changed: [192.168.122.16]

TASK [rhel-system-roles.network : Re-test connectivity] ************************
ok: [192.168.122.16]

PLAY RECAP *********************************************************************
192.168.122.16             : ok=7    changed=1    unreachable=0    failed=0  

EXPECTED RESULTS
# ip -o a | grep -iw inet
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: ens3    inet 192.168.122.16/24 brd 192.168.122.255 scope global noprefixroute dynamic ens3\       valid_lft 3597sec preferred_lft 3597sec
10: bond0    inet 192.168.40.1/24 brd 192.168.40.255 scope global noprefixroute bond0\       valid_lft forever preferred_lft forever
ACTUAL RESULTS
  • Before the playbook execution, the managed node is having below IP configuration.
# ip -o a | grep -iw inet
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: ens3    inet 192.168.122.16/24 brd 192.168.122.255 scope global noprefixroute dynamic ens3\       valid_lft 3509sec preferred_lft 3509sec
4: ens9    inet 192.168.122.221/24 brd 192.168.122.255 scope global noprefixroute dynamic ens9\       valid_lft 3585sec preferred_lft 3585sec
  • After the playbook execution, the managed node is having below IP configuration. Actually ens9 configuration should have been modified to bond slave but it doesn't in memory.
# ip -o a | grep -iw inet
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: ens3    inet 192.168.122.16/24 brd 192.168.122.255 scope global noprefixroute dynamic ens3\       valid_lft 3108sec preferred_lft 3108sec
4: ens9    inet 192.168.122.221/24 brd 192.168.122.255 scope global noprefixroute dynamic ens9\       valid_lft 3458sec preferred_lft 3458sec
9: bond0    inet 192.168.40.1/24 brd 192.168.40.255 scope global noprefixroute bond0\       valid_lft forever preferred_lft forever
ADDITIONAL INFORMATION

A network restart resolves the issue and implements the change.

@tyll
Copy link
Member

tyll commented Jan 8, 2020

Thank you for the bug report. I tried to reproduce this on a current system with the upstream role but the role seems to work as expected.

On the target host I tried:
NetworkManager-1.18.0-5.el7_7.1

cat > 'role_test_static.yml' <<EOF
# SPDX-License-Identifier: BSD-3-Clause
---
- hosts: all
  vars:
    network_connections:
      - name: "{{ network_interface }}"
        state: up
        type: ethernet
        ip:
          address:
            - "192.0.2.42/30"
          dhcp4: no
          auto6: no
  roles:
    - linux-system-roles.network
EOF
ansible-playbook  -i rhel77-cloud, role_test_static.yml -e network_interface=eth2

as the initial configuration. On the host:

4: eth2    inet 192.0.2.42/30 brd 192.0.2.43 scope global noprefixroute eth2\       valid_lft forever preferred_lft forever

Afterwards I applied the bond config:

cat > 'role_test_bond.yml' <<EOF
---
- hosts: all
  vars:
   network_connections:
    - autoconnect: 'yes'
      bond:
        miimon: 100
        mode: active-backup
      interface_name: bond0
      ip:
        address:
          - "192.0.2.5/30"
        auto6: 'no'
        dhcp4: 'no'
      name: bond0
      state: up
      type: bond
    - name: "{{ network_interface }}"
      master: bond0
      type: ethernet
      state: up

  roles:
    - linux-system-roles.network
EOF
ansible-playbook  -i rhel77-cloud, role_test_bond.yml -e network_interface=eth2

And it looks correct:

ip -o a |grep -iw inet |grep -e eth2 -e bond0
8: bond0    inet 192.0.2.5/30 brd 192.0.2.7 scope global noprefixroute bond0\       valid_lft forever preferred_lft forever

Ansible log:

ansible-playbook  -i rhel77-cloud, role_test_bond.yml -e network_interface=eth2

PLAY [all] *************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [rhel77-cloud]

TASK [linux-system-roles.network : Check which services are running] ***************************************************************************************************************************************
ok: [rhel77-cloud]

TASK [linux-system-roles.network : Check which packages are installed] *************************************************************************************************************************************
ok: [rhel77-cloud]

TASK [linux-system-roles.network : Print network provider] *************************************************************************************************************************************************
ok: [rhel77-cloud] => {
    "msg": "Using network provider: nm"
}

TASK [linux-system-roles.network : Install packages] *******************************************************************************************************************************************************
skipping: [rhel77-cloud]

TASK [linux-system-roles.network : Enable and start NetworkManager] ****************************************************************************************************************************************
ok: [rhel77-cloud]

TASK [linux-system-roles.network : Enable network service] *************************************************************************************************************************************************
skipping: [rhel77-cloud]

TASK [linux-system-roles.network : Ensure initscripts network file dependency is present] ******************************************************************************************************************
skipping: [rhel77-cloud]

TASK [linux-system-roles.network : Configure networking connection profiles] *******************************************************************************************************************************
[WARNING]: [005] <info>  #0, state:up persistent_state:present, 'bond0': add connection bond0, fe7d0bdf-beba-4057-a9b7-a8eedcb78740

[WARNING]: [006] <info>  #0, state:up persistent_state:present, 'bond0': up connection bond0, fe7d0bdf-beba-4057-a9b7-a8eedcb78740 (not-active)

[WARNING]: [007] <info>  #1, state:up persistent_state:present, 'eth2': update connection eth2, f5b1efd7-4d71-46cd-82b0-2ae6132f37bb

[WARNING]: [008] <info>  #1, state:up persistent_state:present, 'eth2': up connection eth2, f5b1efd7-4d71-46cd-82b0-2ae6132f37bb (is-modified)

changed: [rhel77-cloud]

TASK [linux-system-roles.network : Re-test connectivity] ***************************************************************************************************************************************************
ok: [rhel77-cloud]

PLAY RECAP *************************************************************************************************************************************************************************************************
rhel77-cloud               : ok=7    changed=1    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0   

Could you please check if this is still an issue for you?

@tyll tyll changed the title rhel-system-roles does not realod the network profile upon profile modification rhel-system-roles does not reload the network profile upon profile modification Mar 10, 2020
@akash2237778
Copy link
Contributor

akash2237778 commented Mar 26, 2020

network_providers: initscripts

network_connections:

- autoconnect: 'yes'
  bond:
    miimon: 100
    mode: active-backup
  interface_name: bond0
  ip:
    address:
      - 192.168.43.1/24
    auto6: 'no'
    dhcp4: 'no'
  name: bond0
  state: up
  type: bond
- name: enp0s8
  interface_name: enp0s8
  master: bond0
  type: ethernet
  state: up

  roles:
      - rhel-system-roles.network

There is no issue!! I tried to reproduce the issue using performed steps.
Everything is working great !!

[root@localhost ~]#ip -o a \| grep -iw inet
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: enp0s3    inet 192.168.43.243/24 brd 192.168.43.255 scope global dynamic noprefixroute enp0s3\       valid_lft 3032sec preferred_lft 3032sec
4: bond0    inet 192.168.43.1/24 brd 192.168.43.255 scope global noprefixroute bond0\       valid_lft forever preferred_lft forever
[root@localhost ~]# nmcli connection show
NAME                UUID                                  TYPE      DEVICE
Wired connection 1  41719565-d70e-30e9-9da9-386175abd940  ethernet  enp0s3
bond0               18a94465-1a9d-4f64-8aa0-0a7784893784  bond      bond0
enp0s8              2515416c-b0db-49dd-977d-8ff7035607d7  ethernet  enp0s8
--



@venkeekavtikwar
Copy link
Author

Hello,

Thank you for your inputs.

I have verified with NetworkManager version "NetworkManager-1.18.4-3.el7.x86_64" and did not observed the issue. Will keep this open for some time and if I see everything okay, will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants