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

36 lines
1.1 KiB
YAML

---
- name: bring up interfaces interface
command: ifup {{ item }}
with_items:
- "{{ pvc_cluster_device }}"
- "{{ pvc_storage_device }}"
- name: create bridge interfacec
command: brctl addbr {{ item }}
ignore_errors: yes
with_items:
- "brcluster"
- "brstorage"
- name: add underlying interfaces to bridges
command: brctl addif {{ item.bridge }} {{ item.device }}
ignore_errors: yes
with_items:
- { "bridge": "brcluster", "device": "{{ pvc_cluster_device }}" }
- { "bridge": "brstorage", "device": "{{ pvc_storage_device }}" }
- name: set bridge interfaces up
command: ip link set {{ item }} up
ignore_errors: yes
with_items:
- "brcluster"
- "brstorage"
- name: add IP addresses to cluster bridge
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
- 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 brstorage
ignore_errors: yes