Modify add_cluster_ips to support new bridges

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:22 -04:00
parent 32b719cb4a
commit 42d76618e3
1 changed files with 33 additions and 23 deletions

View File

@ -1,33 +1,43 @@
--- ---
- name: bring up upstream interface - name: bring up interfaces interface
command: ifup {{ pvc_upstream_device }} command: ifup {{ item }}
with_items:
- "{{ pvc_cluster_device }}"
- "{{ pvc_storage_device }}"
- "{{ pvc_upstream_device }}"
- name: bring up cluster interface - name: create bridge interfacec
command: ifup {{ pvc_cluster_device }} command: brctl addbr {{ item }}
ignore_errors: yes
with_items:
- "brcluster"
- "brstorage"
- "brupstream"
- name: brindg up storage interface - name: add underlying interfaces to bridges
command: ifup {{ pvc_storage_device }} command: brctl addif {{ item.bridge }} {{ item.device }}
ignore_errors: yes
with_items:
- { "bridge": "brcluster", "device": "{{ pvc_cluster_device }}" }
- { "bridge": "brstorage", "device": "{{ pvc_storage_device }}" }
- { "bridge": "brupstream", "device": "{{ pvc_upstream_device }}" }
- name: create cluster bridge interface - name: set bridge interfaces up
command: brctl addbr brcluster command: ip link set {{ item }} up
ignore_errors: yes
with_items:
- "brcluster"
- "brstorage"
- "brupstream"
- name: add IP addresses to upstream bridge
command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}/{{ pvc_upstream_netmask }}{% endfor %} dev brupstream
ignore_errors: yes ignore_errors: yes
- name: add underlying interface to bridge - name: add IP addresses to cluster bridge
command: brctl addif brcluster {{ pvc_cluster_device }}
ignore_errors: yes
- name: set brcluster up
command: ip link set brcluster up
ignore_errors: yes
- name: add IP addresses to upstream interfaces
command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}/{{ pvc_upstream_netmask }}{% endfor %} dev {{ pvc_upstream_device }}
ignore_errors: yes
- name: add IP addresses to cluster interfaces
command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ pvc_cluster_netmask }}{% endfor %} dev brcluster command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ pvc_cluster_netmask }}{% endfor %} dev brcluster
ignore_errors: yes ignore_errors: yes
- name: add IP addresses to storage interfaces - name: add IP addresses to storage bridge
command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ pvc_storage_netmask }}{% endfor %} dev {{ pvc_storage_device }} command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ pvc_storage_netmask }}{% endfor %} dev brstorage
ignore_errors: yes ignore_errors: yes