From 9876a74daef7b3355e161f5ef1c1c7d96f26aeb1 Mon Sep 17 00:00:00 2001 From: Gerrit91 Date: Thu, 2 May 2024 12:46:46 +0200 Subject: [PATCH] Merge cumulus roles. --- deploy_partition.yaml | 10 ++-------- inventories/partition.yaml | 5 +++++ roles/{router => cumulus}/defaults/main.yaml | 0 .../files/99control_plane_catch_all.rules | 0 roles/{leaf => cumulus}/files/bridgemac.json | 0 roles/{router => cumulus}/files/daemons | 0 .../files/frr-validation@.service | 0 roles/{internet => cumulus}/files/frr.tpl | 0 roles/{router => cumulus}/files/ifreload.service | 0 .../files/interfaces-validation@.service | 0 .../files/lldpd.d/portsubtype.conf | 0 .../files/lldpd.d/tx-interval.conf | 0 roles/{router => cumulus}/handlers/main.yaml | 13 +++++++++++++ .../tasks/main.yaml => cumulus/tasks/internet.yaml} | 2 +- roles/{leaf => cumulus}/tasks/main.yaml | 8 +++----- roles/{router => cumulus}/tasks/mgmt_vrf.yaml | 0 .../tasks/main.yaml => cumulus/tasks/router.yaml} | 0 roles/{router => cumulus}/tasks/switch_plane.yaml | 0 roles/{leaf => cumulus}/templates/frr.conf.j2 | 0 roles/{leaf => cumulus}/templates/interfaces.j2 | 0 .../templates/internet.intf.j2 | 0 roles/{router => cumulus}/templates/ports.conf.j2 | 0 roles/{router => cumulus}/templates/resolv.conf.j2 | 0 roles/leaf/handlers/main.yaml | 13 ------------- 24 files changed, 24 insertions(+), 27 deletions(-) rename roles/{router => cumulus}/defaults/main.yaml (100%) rename roles/{router => cumulus}/files/99control_plane_catch_all.rules (100%) rename roles/{leaf => cumulus}/files/bridgemac.json (100%) rename roles/{router => cumulus}/files/daemons (100%) rename roles/{router => cumulus}/files/frr-validation@.service (100%) rename roles/{internet => cumulus}/files/frr.tpl (100%) rename roles/{router => cumulus}/files/ifreload.service (100%) rename roles/{router => cumulus}/files/interfaces-validation@.service (100%) rename roles/{router => cumulus}/files/lldpd.d/portsubtype.conf (100%) rename roles/{router => cumulus}/files/lldpd.d/tx-interval.conf (100%) rename roles/{router => cumulus}/handlers/main.yaml (77%) rename roles/{internet/tasks/main.yaml => cumulus/tasks/internet.yaml} (94%) rename roles/{leaf => cumulus}/tasks/main.yaml (86%) rename roles/{router => cumulus}/tasks/mgmt_vrf.yaml (100%) rename roles/{router/tasks/main.yaml => cumulus/tasks/router.yaml} (100%) rename roles/{router => cumulus}/tasks/switch_plane.yaml (100%) rename roles/{leaf => cumulus}/templates/frr.conf.j2 (100%) rename roles/{leaf => cumulus}/templates/interfaces.j2 (100%) rename roles/{internet => cumulus}/templates/internet.intf.j2 (100%) rename roles/{router => cumulus}/templates/ports.conf.j2 (100%) rename roles/{router => cumulus}/templates/resolv.conf.j2 (100%) delete mode 100644 roles/leaf/handlers/main.yaml diff --git a/deploy_partition.yaml b/deploy_partition.yaml index 0520d6cd..7a59227e 100644 --- a/deploy_partition.yaml +++ b/deploy_partition.yaml @@ -16,14 +16,6 @@ tags: sonic - name: Configure Cumulus switches - hosts: leaves:&cumulus - roles: - - name: leaf - tags: leaf - - name: internet - tags: internet - -- name: Deploy docker on Cumulus switches hosts: leaves:&cumulus pre_tasks: # the following task is not required as long as we do not install something from the cumulus repositories, for which all the keys are expired now @@ -38,6 +30,8 @@ - name: install apt-transport shell: dpkg -i /root/https-deps/*.deb && apt-get install -fy roles: + - name: cumulus + tags: cumulus - name: metal-roles/partition/roles/docker-on-cumulus tags: docker-on-cumulus diff --git a/inventories/partition.yaml b/inventories/partition.yaml index 23c0490e..b1734a81 100644 --- a/inventories/partition.yaml +++ b/inventories/partition.yaml @@ -38,3 +38,8 @@ leaves: ansible_python_interpreter: /usr/bin/python ansible_user: root ansible_ssh_private_key_file: "{{ playbook_dir }}/files/ssh/id_rsa" + +cumulus: + vars: + router_enable_static_route_leak: true +sonic: diff --git a/roles/router/defaults/main.yaml b/roles/cumulus/defaults/main.yaml similarity index 100% rename from roles/router/defaults/main.yaml rename to roles/cumulus/defaults/main.yaml diff --git a/roles/router/files/99control_plane_catch_all.rules b/roles/cumulus/files/99control_plane_catch_all.rules similarity index 100% rename from roles/router/files/99control_plane_catch_all.rules rename to roles/cumulus/files/99control_plane_catch_all.rules diff --git a/roles/leaf/files/bridgemac.json b/roles/cumulus/files/bridgemac.json similarity index 100% rename from roles/leaf/files/bridgemac.json rename to roles/cumulus/files/bridgemac.json diff --git a/roles/router/files/daemons b/roles/cumulus/files/daemons similarity index 100% rename from roles/router/files/daemons rename to roles/cumulus/files/daemons diff --git a/roles/router/files/frr-validation@.service b/roles/cumulus/files/frr-validation@.service similarity index 100% rename from roles/router/files/frr-validation@.service rename to roles/cumulus/files/frr-validation@.service diff --git a/roles/internet/files/frr.tpl b/roles/cumulus/files/frr.tpl similarity index 100% rename from roles/internet/files/frr.tpl rename to roles/cumulus/files/frr.tpl diff --git a/roles/router/files/ifreload.service b/roles/cumulus/files/ifreload.service similarity index 100% rename from roles/router/files/ifreload.service rename to roles/cumulus/files/ifreload.service diff --git a/roles/router/files/interfaces-validation@.service b/roles/cumulus/files/interfaces-validation@.service similarity index 100% rename from roles/router/files/interfaces-validation@.service rename to roles/cumulus/files/interfaces-validation@.service diff --git a/roles/router/files/lldpd.d/portsubtype.conf b/roles/cumulus/files/lldpd.d/portsubtype.conf similarity index 100% rename from roles/router/files/lldpd.d/portsubtype.conf rename to roles/cumulus/files/lldpd.d/portsubtype.conf diff --git a/roles/router/files/lldpd.d/tx-interval.conf b/roles/cumulus/files/lldpd.d/tx-interval.conf similarity index 100% rename from roles/router/files/lldpd.d/tx-interval.conf rename to roles/cumulus/files/lldpd.d/tx-interval.conf diff --git a/roles/router/handlers/main.yaml b/roles/cumulus/handlers/main.yaml similarity index 77% rename from roles/router/handlers/main.yaml rename to roles/cumulus/handlers/main.yaml index b4c228f3..7732c61d 100644 --- a/roles/router/handlers/main.yaml +++ b/roles/cumulus/handlers/main.yaml @@ -1,4 +1,17 @@ --- +- name: reload interfaces + shell: sleep 3; ifreload -a + async: 1 + poll: 0 + notify: wait for new connection + +- name: wait for new connection + wait_for_connection: + connect_timeout: 20 + sleep: 5 + delay: 5 + timeout: 300 + - name: reload systemd systemd: daemon_reload: yes diff --git a/roles/internet/tasks/main.yaml b/roles/cumulus/tasks/internet.yaml similarity index 94% rename from roles/internet/tasks/main.yaml rename to roles/cumulus/tasks/internet.yaml index 9503f15c..0cab4702 100644 --- a/roles/internet/tasks/main.yaml +++ b/roles/cumulus/tasks/internet.yaml @@ -12,7 +12,7 @@ src: internet.intf.j2 dest: /etc/network/interfaces.d/internet.intf -# add the vniInternet inferface to the bridge and configure the new vid at the bridge +# add the vniInternet interface to the bridge and configure the new vid at the bridge # otherwise ifreload will not work - name: add internet vni to bridge command: net add bridge bridge ports vniInternet diff --git a/roles/leaf/tasks/main.yaml b/roles/cumulus/tasks/main.yaml similarity index 86% rename from roles/leaf/tasks/main.yaml rename to roles/cumulus/tasks/main.yaml index 5fec8349..c75a9fd1 100644 --- a/roles/leaf/tasks/main.yaml +++ b/roles/cumulus/tasks/main.yaml @@ -1,9 +1,5 @@ --- -- name: configure leaf - include_role: - name: router - vars: - router_enable_static_route_leak: true +- import_tasks: router.yaml - name: flush handlers meta: flush_handlers @@ -31,3 +27,5 @@ src: bridgemac.json dest: /etc/network/ifupdown2/policy.d/bridgemac.json notify: reload interfaces + +- import_tasks: internet.yaml diff --git a/roles/router/tasks/mgmt_vrf.yaml b/roles/cumulus/tasks/mgmt_vrf.yaml similarity index 100% rename from roles/router/tasks/mgmt_vrf.yaml rename to roles/cumulus/tasks/mgmt_vrf.yaml diff --git a/roles/router/tasks/main.yaml b/roles/cumulus/tasks/router.yaml similarity index 100% rename from roles/router/tasks/main.yaml rename to roles/cumulus/tasks/router.yaml diff --git a/roles/router/tasks/switch_plane.yaml b/roles/cumulus/tasks/switch_plane.yaml similarity index 100% rename from roles/router/tasks/switch_plane.yaml rename to roles/cumulus/tasks/switch_plane.yaml diff --git a/roles/leaf/templates/frr.conf.j2 b/roles/cumulus/templates/frr.conf.j2 similarity index 100% rename from roles/leaf/templates/frr.conf.j2 rename to roles/cumulus/templates/frr.conf.j2 diff --git a/roles/leaf/templates/interfaces.j2 b/roles/cumulus/templates/interfaces.j2 similarity index 100% rename from roles/leaf/templates/interfaces.j2 rename to roles/cumulus/templates/interfaces.j2 diff --git a/roles/internet/templates/internet.intf.j2 b/roles/cumulus/templates/internet.intf.j2 similarity index 100% rename from roles/internet/templates/internet.intf.j2 rename to roles/cumulus/templates/internet.intf.j2 diff --git a/roles/router/templates/ports.conf.j2 b/roles/cumulus/templates/ports.conf.j2 similarity index 100% rename from roles/router/templates/ports.conf.j2 rename to roles/cumulus/templates/ports.conf.j2 diff --git a/roles/router/templates/resolv.conf.j2 b/roles/cumulus/templates/resolv.conf.j2 similarity index 100% rename from roles/router/templates/resolv.conf.j2 rename to roles/cumulus/templates/resolv.conf.j2 diff --git a/roles/leaf/handlers/main.yaml b/roles/leaf/handlers/main.yaml deleted file mode 100644 index 86eca2de..00000000 --- a/roles/leaf/handlers/main.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: reload interfaces - shell: sleep 3; ifreload -a - async: 1 - poll: 0 - notify: wait for new connection - -- name: wait for new connection - wait_for_connection: - connect_timeout: 20 - sleep: 5 - delay: 5 - timeout: 300