Externalize role
This commit is contained in:
commit
59cc9650d9
5 changed files with 69 additions and 0 deletions
3
defaults/main.yml
Normal file
3
defaults/main.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openvswitch_interface: brdefaults
|
||||
|
||||
4
handlers/main.yml
Normal file
4
handlers/main.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Restart openvswitch
|
||||
service: name="{{ openvswitch_service }}" state=restarted
|
||||
|
||||
3
tasks/RedHat.yml
Normal file
3
tasks/RedHat.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- name: Define OpenVSwitch repo packages
|
||||
package: name="centos-release-ovirt42" state=latest update_cache=yes
|
||||
46
tasks/main.yml
Normal file
46
tasks/main.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
- name: Include vars for {{ ansible_os_family }}
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: remove old packages
|
||||
package: name="{{ openvswitch_remove_packages }}" state=absent update_cache=yes
|
||||
notify: Restart openvswitch
|
||||
|
||||
- name: Include tasks for {{ ansible_os_family }}
|
||||
include_tasks: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: install packages
|
||||
package: name="{{ openvswitch_packages }}" state=latest update_cache=yes
|
||||
notify: Restart openvswitch
|
||||
|
||||
- name: Enable openvswitch
|
||||
service: name="{{ openvswitch_service }}" state=started enabled=yes
|
||||
|
||||
- name: Add Openvswitch default bridge
|
||||
openvswitch_bridge:
|
||||
bridge: '{{ openvswitch_interface }}'
|
||||
state: present
|
||||
|
||||
- name: Add Openvswitch bridges
|
||||
openvswitch_bridge:
|
||||
bridge: '{{ item.bridgename }}'
|
||||
parent: '{{ openvswitch_interface }}'
|
||||
state: present
|
||||
vlan: '{{ item.vlan[0] }}'
|
||||
with_items:
|
||||
- '{{ virtual_network }}'
|
||||
when:
|
||||
- virtual_network is defined
|
||||
- item.vlan|length < 2
|
||||
|
||||
- name: Add Openvswitch trunk bridges
|
||||
openvswitch_bridge:
|
||||
bridge: '{{ item.bridgename }}'
|
||||
parent: '{{ openvswitch_interface }}'
|
||||
state: present
|
||||
with_items:
|
||||
- '{{ virtual_network }}'
|
||||
when:
|
||||
- virtual_network is defined
|
||||
- item.vlan|length > 1
|
||||
|
||||
13
vars/RedHat.yml
Normal file
13
vars/RedHat.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
openvswitch_remove_packages:
|
||||
- centos-release-ovirt41
|
||||
# - openvswitch-selinux-policy
|
||||
openvswitch_packages:
|
||||
- openvswitch
|
||||
- openvswitch-ovn-central
|
||||
- openvswitch-ovn-docker
|
||||
- openvswitch-ovn-host
|
||||
- openvswitch-ovn-vtep
|
||||
# - python2-openvswitch # Seem not needed
|
||||
openvswitch_service: openvswitch
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue