From cb18e81faec82b7d95cf7036fca959575ef3fda7 Mon Sep 17 00:00:00 2001 From: Bartosz Bezak Date: Tue, 11 Aug 2026 18:02:50 +0200 Subject: [PATCH] os_networks: add tags support This is supported since openstack.cloud 2.6.0 Signed-off-by: Bartosz Bezak --- galaxy.yml | 2 +- roles/os_networks/README.md | 3 +++ roles/os_networks/tasks/networks.yml | 3 +++ roles/os_networks/tasks/router_workaround.yml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index cbd81bc..de64e5c 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -12,7 +12,7 @@ tags: - cloud - openstack dependencies: - "openstack.cloud": ">=2.5.0" + "openstack.cloud": ">=2.6.0" "community.general": ">=8.2.0" repository: https://github.com/stackhpc/ansible-collection-openstack documentation: https://github.com/stackhpc/ansible-collection-openstack/blob/main/README.md diff --git a/roles/os_networks/README.md b/roles/os_networks/README.md index 8b24021..cfd1c1b 100644 --- a/roles/os_networks/README.md +++ b/roles/os_networks/README.md @@ -51,6 +51,7 @@ dict containing the following items: Boolean, true to enable, false otherwise. Requires ansible >= 2.8. - `dns_domain`: The DNS domain value to set. Network will use Openstack defaults if this option is not provided. Requires ansible >= 2.9. +- `tags`: Optional list of tags to set on the network. - `subnets`: A list of subnets to create in this network. Each item should be a dict containing the following items: - `name`: Name of the neutron subnet. @@ -79,6 +80,7 @@ dict containing the following items: - `project`: Optionally create this subnet for a project other than the authenticating project. - `state`: Optional state of the subnet, default is `present`. + - `tags`: Optional list of tags to set on the subnet. `os_networks_routers` is a list of routers to create. Each item should be a dict containing the following items: @@ -93,6 +95,7 @@ dict containing the following items: - `project`: Optionally create this router for a project other than the authenticating project. - `state`: Optional state of the router, default is `present`. +- `tags`: Optional list of tags to set on the router. `os_networks_security_groups`: List of security groups to create. diff --git a/roles/os_networks/tasks/networks.yml b/roles/os_networks/tasks/networks.yml index 848ab2b..aafe4e7 100644 --- a/roles/os_networks/tasks/networks.yml +++ b/roles/os_networks/tasks/networks.yml @@ -32,6 +32,7 @@ mtu: "{{ item.mtu | default(omit) }}" dns_domain: "{{ item.dns_domain | default(omit) }}" port_security_enabled: "{{ item.port_security_enabled | default(omit) }}" + tags: "{{ item.tags | default(omit) }}" with_items: "{{ os_networks }}" - name: Ensure subnet is registered with neutron @@ -65,6 +66,7 @@ default(item.1.subnetpool | default(omit)) }} project: "{{ item.1.project | default(omit) }}" state: "{{ item.1.state | default(omit) }}" + tags: "{{ item.1.tags | default(omit) }}" with_subelements: - "{{ os_networks }}" - subnets @@ -87,6 +89,7 @@ # external_fixed_ips: "{{ item.external_fixed_ips | default(omit) }}" # project: "{{ item.project | default(omit) }}" # state: "{{ item.state | default(omit) }}" +# tags: "{{ item.tags | default(omit) }}" # loop: "{{ os_networks_routers }}" # when: item.state | default('present') == 'present' diff --git a/roles/os_networks/tasks/router_workaround.yml b/roles/os_networks/tasks/router_workaround.yml index 4fbf718..a94b7e1 100644 --- a/roles/os_networks/tasks/router_workaround.yml +++ b/roles/os_networks/tasks/router_workaround.yml @@ -33,3 +33,4 @@ external_fixed_ips: "{{ item.external_fixed_ips | default(omit) }}" project: "{{ item.project | default(omit) }}" state: "{{ item.state | default(omit) }}" + tags: "{{ item.tags | default(omit) }}"