pvc-ansible/roles/pvc/tasks/common/add_cluster_ips.yml

51 lines
1.9 KiB
YAML
Raw Normal View History

2023-09-01 15:42:19 -04:00
---
- name: bring up interfaces
command: ifup {{ item }}
2023-09-01 15:42:23 -04:00
with_items: "{% for network in networks %}{{ networks[network].device }} {% endfor %}"
ignore_errors: yes
2023-09-01 15:42:23 -04:00
- name: set bridges dictionary (cluster != storage)
set_fact:
bridges:
- { "bridge": "brupstream", "device": "{{ pvc_upstream_device }}" }
- { "bridge": "brcluster", "device": "{{ pvc_cluster_device }}" }
- { "bridge": "brstorage", "device": "{{ pvc_storage_device }}" }
when: pvc_storage_device != pvc_cluster_device
- name: set bridges dictionary (cluster == storage)
set_fact:
bridges:
- { "bridge": "brupstream", "device": "{{ pvc_upstream_device }}" }
- { "bridge": "brcluster", "device": "{{ pvc_cluster_device }}" }
when: pvc_storage_device == pvc_cluster_device
2023-09-01 15:42:23 -04:00
- name: create bridge interfaces
command: brctl addbr {{ item.bridge }}
ignore_errors: yes
with_items:
2023-09-01 15:42:23 -04:00
- "{{ bridges }}"
- name: add underlying interfaces to bridges
command: brctl addif {{ item.bridge }} {{ item.device }}
ignore_errors: yes
with_items:
2023-09-01 15:42:23 -04:00
- "{{ bridges }}"
- name: set bridge interfaces up
2023-09-01 15:42:23 -04:00
command: ip link set {{ item.bridge }} up
ignore_errors: yes
with_items:
2023-09-01 15:42:23 -04:00
- "{{ bridges }}"
- name: add IP addresses to upstream bridge
command: ip address add {% for node in pvc_nodes if node.hostname == this_node %}{{ node.upstream_ip }}/{{ pvc_upstream_netmask }}{% endfor %} dev brupstream
2023-09-01 15:42:23 -04:00
ignore_errors: yes
2023-09-01 15:42:22 -04:00
- name: add IP addresses to cluster bridge
command: ip address add {% for node in pvc_nodes if node.hostname == this_node %}{{ node.cluster_ip }}/{{ pvc_cluster_netmask }}{% endfor %} dev brcluster
2023-09-01 15:42:19 -04:00
ignore_errors: yes
2023-09-01 15:42:23 -04:00
- name: add IP addresses to storage bridge (will error if storage == cluster)
command: ip address add {% for node in pvc_nodes if node.hostname == this_node %}{{ node.storage_ip }}/{{ pvc_storage_netmask }}{% endfor %} dev brstorage
2023-09-01 15:42:19 -04:00
ignore_errors: yes