Giter VIP home page Giter VIP logo

Comments (6)

pcahyna avatar pcahyna commented on August 22, 2024

I guess this is specific to RHEL6 and dhcp?
Could you please provide net_demo.yml ?

from network.

pcahyna avatar pcahyna commented on August 22, 2024

Interestingly, such issue was supposed to be fixed already (https://bugzilla.redhat.com/show_bug.cgi?id=1476053, 5deb2af). Note though that that commit message says:

Now, try to determine whether the desire "up" or "down" state is already
reached and do nothing.
For "nm" provider that is easy and quite safe. (...)
For "initscripts" this is much more fragile. There isn't really much
that can be done about it, because the role doesn't know what is currently
configured on the system.

from network.

tabowling avatar tabowling commented on August 22, 2024

Here is my playbook.

---
- hosts: all
  become: yes
  become_method: sudo
  become_user: root
  # DO NOT MODIFY ETH0!!!!
  vars:
    network_connections:

      - name: net1  # Secondary interface for mgmt or other stuff
        state: present
        type: ethernet
#        interface_name: eth4
        mac: "{{ hostvars[inventory_hostname].net1_mac }}"
        autoconnect: yes
        ip:
          dhcp4: yes
          auto6: no

from network.

tabowling avatar tabowling commented on August 22, 2024

Ansible has absolute ability to understand all of the network configuration. I had shared this info with the developers before. It simply requires more logic in the module.

Here's a simply playbook to extract facts, as well as a few other commands you can execute to see them.

ansible rhel74-test -m setup -a 'gather_subset=network'
ansible rhel74-test -m setup -a 'gather_subset=network filter=ansible_interfaces'
ansible rhel74-test -m setup -a 'gather_subset=network' |grep -e ansible_e -e macaddr -e hostname -e device

playbook example

- hosts: all
  become: yes
  become_method: sudo
  become_user: root

  tasks:
    - name: find interface facts
      debug:
        msg: "{{ hostvars[inventory_hostname]['ansible_%s' | format(item)] }}"
      with_items: "{{ ansible_interfaces }}"

from network.

xpros avatar xpros commented on August 22, 2024

I am noticing the same behavior using version 1.16.2 of rhel_system_roles via Red Hat Automation Hub. The underlying host is RHEL 8.5 (NetworkManager-1.32.10-4.el8.x86_64.); though, I have seen this with other earlier RHEL OSes.

The interfaces are configured and each execution after continues to 'change':

TASK [redhat.rhel_system_roles.network : Configure networking connection profiles] ********************************************************************************************************************
changed: [testhost.example.com]
Thursday 02 June 2022  16:50:51 -0500 (0:00:00.753)       0:00:18.336 ********* 
Thursday 02 June 2022  16:50:51 -0500 (0:00:00.753)       0:00:18.336 ********* 

TASK [redhat.rhel_system_roles.network : Show debug messages] *****************************************************************************************************************************************
ok: [testhost.example.com] => {
    "__network_connections_result": {
        "_invocation": {
            "module_args": {
                "__debug_flags": "", 
                "connections": [
                    {
                        "autoconnect": true, 
                        "bond": {
                            "mode": "active-backup"
                        }, 
                        "ip": {
                            "auto6": false, 
                            "dhcp4": false
                        }, 
                        "name": "bond0", 
                        "state": "up", 
                        "type": "bond"
                    }, 
                    {
                        "controller": "bond0", 
                        "interface_name": "em1", 
                        "name": "bond0 member 1", 
                        "state": "up", 
                        "type": "ethernet"
                    }, 
                    {
                        "controller": "bond0", 
                        "interface_name": "em2", 
                        "name": "bond0 member 2", 
                        "state": "up", 
                        "type": "ethernet"
                    }, 
                    {
                        "autoconnect": true, 
                        "ip": {
                            "address": [
                                "192.168.164.86/24"
                            ], 
                            "auto6": false, 
                            "dhcp4": false, 
                            "gateway4": "192.168.164.1"
                        }, 
                        "name": "bond0.164", 
                        "parent": "bond0", 
                        "state": "up", 
                        "type": "vlan", 
                        "vlan_id": 164
                    }, 
                    {
                        "autoconnect": true, 
                        "bond": {
                            "mode": "active-backup"
                        }, 
                        "ip": {
                            "auto6": false, 
                            "dhcp4": false
                        }, 
                        "name": "bond1", 
                        "state": "up", 
                        "type": "bond"
                    }, 
                    {
                        "controller": "bond1", 
                        "interface_name": "p1p1", 
                        "name": "bond1 member 1", 
                        "state": "up", 
                        "type": "ethernet"
                    }, 
                    {
                        "controller": "bond1", 
                        "interface_name": "p1p2", 
                        "name": "bond1 member 2", 
                        "state": "up", 
                        "type": "ethernet"
                    }, 
                    {
                        "autoconnect": true, 
                        "ip": {
                            "address": [
                                "192.168.104.47/23"
                            ], 
                            "auto6": false, 
                            "dhcp4": false
                        }, 
                        "name": "bond1.104", 
                        "parent": "bond1", 
                        "state": "up", 
                        "type": "vlan", 
                        "vlan_id": 104
                    }
                ], 
                "force_state_change": false, 
                "ignore_errors": false, 
                "provider": "nm"
            }
        }, 
        "changed": true, 
        "failed": false, 
        "stderr": "[001] <info>  #0, state:up persistent_state:present, 'bond0': update connection bond0, ad33d8b0-1f7b-cab9-9447-ba07f855b143\n[002] <info>  #1, state:up persistent_state:present, 'bond0 member 1': connection bond0 member 1, bf30350e-a9ba-4521-9397-cb835bdb6384 already up to date\n[003] <info>  #2, state:up persistent_state:present, 'bond0 member 2': connection bond0 member 2, 6b5c0e7d-7ecc-49ba-9fe8-8e2253c21360 already up to date\n[004] <info>  #3, state:up persistent_state:present, 'bond0.164': connection bond0.164, dd50e58f-f252-c4a0-e053-2f5af94fa279 already up to date\n[005] <info>  #4, state:up persistent_state:present, 'bond1': update connection bond1, 681a3df8-5bac-471a-82d2-71a832ffda56\n[006] <info>  #5, state:up persistent_state:present, 'bond1 member 1': connection bond1 member 1, f4e01981-3543-4d14-8fac-0dadbcfaa01d already up to date\n[007] <info>  #6, state:up persistent_state:present, 'bond1 member 2': connection bond1 member 2, 7862b1f7-e029-4ee1-889e-78c2e583cfae already up to date\n[008] <info>  #7, state:up persistent_state:present, 'bond1.104': connection bond1.104, b2ef71bc-3c8e-4c82-8db2-094bbce16f90 already up to date\n[009] <info>  #0, state:up persistent_state:present, 'bond0': up connection bond0, ad33d8b0-1f7b-cab9-9447-ba07f855b143 (is-modified)\n[010] <info>  #1, state:up persistent_state:present, 'bond0 member 1': up connection bond0 member 1, bf30350e-a9ba-4521-9397-cb835bdb6384 (is-modified)\n[011] <info>  #2, state:up persistent_state:present, 'bond0 member 2': up connection bond0 member 2, 6b5c0e7d-7ecc-49ba-9fe8-8e2253c21360 (is-modified)\n[012] <info>  #3, state:up persistent_state:present, 'bond0.164': up connection bond0.164, dd50e58f-f252-c4a0-e053-2f5af94fa279 (is-modified)\n[013] <info>  #4, state:up persistent_state:present, 'bond1': up connection bond1, 681a3df8-5bac-471a-82d2-71a832ffda56 (is-modified)\n[014] <info>  #5, state:up persistent_state:present, 'bond1 member 1': up connection bond1 member 1, f4e01981-3543-4d14-8fac-0dadbcfaa01d (is-modified)\n[015] <info>  #6, state:up persistent_state:present, 'bond1 member 2': up connection bond1 member 2, 7862b1f7-e029-4ee1-889e-78c2e583cfae (is-modified)\n[016] <info>  #7, state:up persistent_state:present, 'bond1.104': up connection bond1.104, b2ef71bc-3c8e-4c82-8db2-094bbce16f90 (is-modified)\n", 
        "stderr_lines": [
            "[001] <info>  #0, state:up persistent_state:present, 'bond0': update connection bond0, ad33d8b0-1f7b-cab9-9447-ba07f855b143", 
            "[002] <info>  #1, state:up persistent_state:present, 'bond0 member 1': connection bond0 member 1, bf30350e-a9ba-4521-9397-cb835bdb6384 already up to date", 
            "[003] <info>  #2, state:up persistent_state:present, 'bond0 member 2': connection bond0 member 2, 6b5c0e7d-7ecc-49ba-9fe8-8e2253c21360 already up to date", 
            "[004] <info>  #3, state:up persistent_state:present, 'bond0.164': connection bond0.164, dd50e58f-f252-c4a0-e053-2f5af94fa279 already up to date", 
            "[005] <info>  #4, state:up persistent_state:present, 'bond1': update connection bond1, 681a3df8-5bac-471a-82d2-71a832ffda56", 
            "[006] <info>  #5, state:up persistent_state:present, 'bond1 member 1': connection bond1 member 1, f4e01981-3543-4d14-8fac-0dadbcfaa01d already up to date", 
            "[007] <info>  #6, state:up persistent_state:present, 'bond1 member 2': connection bond1 member 2, 7862b1f7-e029-4ee1-889e-78c2e583cfae already up to date", 
            "[008] <info>  #7, state:up persistent_state:present, 'bond1.104': connection bond1.104, b2ef71bc-3c8e-4c82-8db2-094bbce16f90 already up to date", 
            "[009] <info>  #0, state:up persistent_state:present, 'bond0': up connection bond0, ad33d8b0-1f7b-cab9-9447-ba07f855b143 (is-modified)", 
            "[010] <info>  #1, state:up persistent_state:present, 'bond0 member 1': up connection bond0 member 1, bf30350e-a9ba-4521-9397-cb835bdb6384 (is-modified)", 
            "[011] <info>  #2, state:up persistent_state:present, 'bond0 member 2': up connection bond0 member 2, 6b5c0e7d-7ecc-49ba-9fe8-8e2253c21360 (is-modified)", 
            "[012] <info>  #3, state:up persistent_state:present, 'bond0.164': up connection bond0.164, dd50e58f-f252-c4a0-e053-2f5af94fa279 (is-modified)", 
            "[013] <info>  #4, state:up persistent_state:present, 'bond1': up connection bond1, 681a3df8-5bac-471a-82d2-71a832ffda56 (is-modified)", 
            "[014] <info>  #5, state:up persistent_state:present, 'bond1 member 1': up connection bond1 member 1, f4e01981-3543-4d14-8fac-0dadbcfaa01d (is-modified)", 
            "[015] <info>  #6, state:up persistent_state:present, 'bond1 member 2': up connection bond1 member 2, 7862b1f7-e029-4ee1-889e-78c2e583cfae (is-modified)", 
            "[016] <info>  #7, state:up persistent_state:present, 'bond1.104': up connection bond1.104, b2ef71bc-3c8e-4c82-8db2-094bbce16f90 (is-modified)"
        ]
    }
}
Thursday 02 June 2022  16:50:51 -0500 (0:00:00.198)       0:00:18.535 ********* 
Thursday 02 June 2022  16:50:51 -0500 (0:00:00.198)       0:00:18.534 ********* 

from network.

xpros avatar xpros commented on August 22, 2024

I just gave the latest tag release a try as well, v1.8.0, which I believe is later than what is included in the rhel_system_roles collection, and the 'changed' behavior exists as well.

I wish I could include more than the 'behavior exists'. I would be happy to gather additional detail; though, I would need to massage the data just a bit.

from network.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.