mrlesmithjr / ansible-netplan

Ansible role to manage Netplan
MIT License
130 stars 84 forks source link

Role doesn't apply changes to "bridges" node #51

Closed felix-khlmnn closed 2 weeks ago

felix-khlmnn commented 3 months ago

Describe the bug Hello everybody, I am trying to configure a Ubuntu machine as a switch. For that purpose, I want to use Ansible with this role. From the documentation, I understand that I have to place my changes underneath the netplan_configuration node. Every setting underneath the ethernets node is applied successfully, however, no setting underneath the bridges node is applied.

To Reproduce Steps to reproduce the behavior:

  1. Create a playbook that configures settings both in the ethernets and bridges node
  2. Execute playbook
  3. Validate on the target host that the bridges node is empty
  4. Error due to missing settings

Expected behavior The bridges node should be added to the configuration just as the ethernet node.

Playbook in Question

Below is the playbook that I tried to run.

---
- hosts: switches
  any_errors_fatal: true
  vars:
    ip_mapping:
      coreswitch: "10.2.0.3/24"
      second-switch: "10.2.0.4/24"
  roles:
    - role: mrlesmithjr.netplan
      become: true
      # This role will do nothing unless netplan_enabled is true.
      netplan_enabled: true
      netplan_apply: true
      # This should point to an existing netplan configuration file 
      # on your system which this role will overwrite, 
      # or to a nonexistent file which netplan is aware of.
      #
      # The default is /etc/netplan/config.yaml.
      netplan_config_file: /etc/netplan/50-cloud-init.yaml

      # Ubuntu 18.04, for example, defaults to using networkd.
      netplan_renderer: networkd
      # Simple network configuration to add a single network interface.
      # Configuration defined bellow will be written to the file defined
      # above in `netplan_config_file`.
      netplan_configuration:
        version: 2
        network:
          ethernets:
            enp10s0:
              match:
                macaddress: 00:30:18:0a:c0:ac
              mtu: 1500
              optional: true
              set-name: enp10s0
            enp11s0:
              match:
                macaddress: 00:30:18:0a:c0:ad
              mtu: 1500
              optional: true
              set-name: enp11s0
            enp12s0:
              match:
                macaddress: 00:30:18:0a:c0:ae
              mtu: 1500
              optional: true
              set-name: enp12s0
            enp13s0:
              match:
                macaddress: 00:30:18:0a:c0:af
              mtu: 1500
              optional: true
              set-name: enp13s0
            enp16s0:
              match:
                macaddress: 00:30:18:0a:c0:a4
              mtu: 1500
              optional: true
              set-name: enp16s0
            enp17s0:
              match:
                macaddress: 00:30:18:0a:c0:a5
              mtu: 1500
              optional: true
              set-name: enp17s0
            enp18s0:
              match:
                macaddress: 00:30:18:0a:c0:a6
              mtu: 1500
              optional: true
              set-name: enp18s0
            enp19s0:
              addresses:
                - "{{ ip_mapping[inventory_hostname] }}"
              gateway4: 10.2.0.1
              match:
                macaddress: 00:30:18:0a:c0:a7
              mtu: 1500
              nameservers:
                addresses:
                  - 10.1.0.1
                  - 8.8.8.8
                search:
                  - maas
              set-name: enp19s0
            enp3s0:
              match:
                macaddress: 00:30:18:04:ad:58
              mtu: 1500
              optional: true
              set-name: enp3s0
            enp7s0:
              match:
                macaddress: 00:30:18:04:ad:59
              mtu: 1500
              optional: true
              set-name: enp7s0
        bridges:
          switch:
            addresses:
              - "{{ ip_mapping[inventory_hostname] }}"
            gateway4: 10.2.0.1
            interfaces:
              - enp10s0
              - enp11s0
              - enp12s0
              - enp13s0
              - enp16s0
              - enp17s0
              - enp18s0
              - enp19s0
              - enp3s0
              - enp7s0

System information:

Additional context The netplan configuration was carried over from a given configuration that I didn't create, so if there are any settings that don't make sense/contradict each other, please let me know.

Feel free to ask more questions if needed.

Thank you in advance, Felix Kuhlmann

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.