From 21c9aa3e6aa44a73d3528fe73b62e3d24eaef2db Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:22 -0400 Subject: [PATCH] Move netmask to separate config --- group_vars/default/base.yml | 15 +++++++++------ group_vars/default/pvc.yml | 12 +++--------- roles/pvc/templates/pvc/pvcd.yaml.j2 | 18 +++++++++--------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/group_vars/default/base.yml b/group_vars/default/base.yml index f7a6781..2fc892d 100644 --- a/group_vars/default/base.yml +++ b/group_vars/default/base.yml @@ -53,8 +53,9 @@ networks: - "enp1s0f1" mtu: 1500 domain: "{{ local_domain }}" - subnet: "192.168.100.0/24" - floating_ip: "192.168.100.10/24" + netmask: "24" + subnet: "192.168.100.0" + floating_ip: "192.168.100.10" gateway_ip: "192.168.100.1" "cluster": device: "vlan1001" @@ -62,13 +63,15 @@ networks: raw_device: "bondU" mtu: 1500 domain: "pvc-cluster.local" - subnet: "10.0.0.0/24" - floating_ip: "10.0.0.254/24" + netmask: "24" + subnet: "10.0.0.0" + floating_ip: "10.0.0.254" "storage": device: "vlan1002" type: "vlan" raw_device: "bondU" mtu: 1500 domain: "pvc-storage.local" - subnet: "10.0.1.0/24" - floating_ip: "10.0.1.254/24" + netmask: "24" + subnet: "10.0.1.0" + floating_ip: "10.0.1.254" diff --git a/group_vars/default/pvc.yml b/group_vars/default/pvc.yml index ca1cf5f..8e046d7 100644 --- a/group_vars/default/pvc.yml +++ b/group_vars/default/pvc.yml @@ -54,11 +54,8 @@ pvc_nodes: node_id: 1 router_id: "192.168.100.11" upstream_ip: "192.168.100.11" - upstream_cidr: 24 cluster_ip: "10.0.0.1" - cluster_cidr: 24 storage_ip: "10.0.1.1" - storage_cidr: 24 ipmi_host: "pvchv1-lom.{{ local_domain }}" ipmi_user: "{{ username_ipmi_host }}" ipmi_password: "{{ passwd_ipmi_host }}" @@ -67,11 +64,8 @@ pvc_nodes: node_id: 2 router_id: "192.168.100.12" upstream_ip: "192.168.100.12" - upstream_cidr: 24 cluster_ip: "10.0.0.2" - cluster_cidr: 24 storage_ip: "10.0.1.2" - storage_cidr: 24 ipmi_host: "pvchv2-lom.{{ local_domain }}" ipmi_user: "{{ username_ipmi_host }}" ipmi_password: "{{ passwd_ipmi_host }}" @@ -80,11 +74,8 @@ pvc_nodes: node_id: 3 router_id: "192.168.100.13" upstream_ip: "192.168.100.13" - upstream_cidr: 24 cluster_ip: "10.0.0.3" - cluster_cidr: 24 storage_ip: "10.0.1.3" - storage_cidr: 24 ipmi_host: "pvchv3-lom.{{ local_domain }}" ipmi_user: "{{ username_ipmi_host }}" ipmi_password: "{{ passwd_ipmi_host }}" @@ -94,16 +85,19 @@ pvc_nodes: pvc_upstream_device: "{{ networks['upstream']['device'] }}" pvc_upstream_mtu: "{{ networks['upstream']['mtu'] }}" pvc_upstream_domain: "{{ networks['upstream']['domain'] }}" +pvc_upstream_netmask: "{{ networks['upstream']['netmask'] }}" pvc_upstream_subnet: "{{ networks['upstream']['subnet'] }}" pvc_upstream_floatingip: "{{ networks['upstream']['floating_ip'] }}" pvc_upstream_gatewayip: "{{ networks['upstream']['gateway_ip'] }}" pvc_cluster_device: "{{ networks['cluster']['device'] }}" pvc_cluster_mtu: "{{ networks['cluster']['mtu'] }}" pvc_cluster_domain: "{{ networks['cluster']['domain'] }}" +pvc_cluster_netmask: "{{ networks['cluster']['netmask'] }}" pvc_cluster_subnet: "{{ networks['cluster']['subnet'] }}" pvc_cluster_floatingip: "{{ networks['cluster']['floating_ip'] }}" pvc_storage_device: "{{ networks['storage']['device'] }}" pvc_storage_mtu: "{{ networks['storage']['mtu'] }}" pvc_storage_domain: "{{ networks['storage']['domain'] }}" +pvc_storage_netmask: "{{ networks['storage']['netmask'] }}" pvc_storage_subnet: "{{ networks['storage']['subnet'] }}" pvc_storage_floatingip: "{{ networks['storage']['floating_ip'] }}" diff --git a/roles/pvc/templates/pvc/pvcd.yaml.j2 b/roles/pvc/templates/pvc/pvcd.yaml.j2 index 452aca7..732bf07 100644 --- a/roles/pvc/templates/pvc/pvcd.yaml.j2 +++ b/roles/pvc/templates/pvc/pvcd.yaml.j2 @@ -18,17 +18,17 @@ pvc: networks: cluster: domain: {{ pvc_cluster_domain }} - network: {{ pvc_cluster_subnet }} - floating_ip: {{ pvc_cluster_floatingip }} + network: {{ pvc_cluster_subnet }}/{{ pvc_cluster_netmask }} + floating_ip: {{ pvc_cluster_floatingip }}/{{ pvc_cluster_netmask }} storage: domain: {{ pvc_storage_domain }} - network: {{ pvc_storage_subnet }} - floating_ip: {{ pvc_storage_floatingip }} + network: {{ pvc_storage_subnet }}/{{ pvc_storage_netmask }} + floating_ip: {{ pvc_storage_floatingip }}/{{ pvc_storage_netmask }} upstream: domain: {{ pvc_upstream_domain }} network: {{ pvc_upstream_subnet }} - floating_ip: {{ pvc_upstream_floatingip }} - gateway: {{ pvc_upstream_gatewayip }} + floating_ip: {{ pvc_upstream_floatingip }}/{{ pvc_upstream_netmask }} + gateway: {{ pvc_upstream_gatewayip }}/{{ pvc_upstream_netmask }} coordinator: dns: database: @@ -73,15 +73,15 @@ pvc: cluster: device: {{ pvc_cluster_device }} mtu: {{ pvc_cluster_mtu }} - address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ node.cluster_cidr }}{% endfor %} + address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ pvc_cluster_netmask }}{% endfor %} storage: device: {{ pvc_storage_device }} mtu: {{ pvc_storage_mtu }} - address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ node.storage_cidr }}{% endfor %} + address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ pvc_storage_netmask }}{% endfor %} upstream: device: {{ pvc_upstream_device }} mtu: {{ pvc_upstream_mtu }} - address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}/{{ node.upstream_cidr }}{% endfor %} + address: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}/{{ pvc_upstream_netmask }}{% endfor %}