diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f7d541 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vars/main.yml diff --git a/defaults/main.yml b/defaults/main.yml index 7990af4..b336079 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,9 @@ --- # defaults file for bonding +# Set to true if using NetworkManager +network_manager: false + # Set to true to apply to sysconfig files apply: false diff --git a/handlers/main.yml b/handlers/main.yml index 32ebaf0..c938211 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,3 +3,6 @@ - name: restart network service: name=network state=restarted + +- name: restart networkmanager + service: name=NetworkManager state=restarted diff --git a/meta/.galaxy_install_info b/meta/.galaxy_install_info new file mode 100644 index 0000000..83333ad --- /dev/null +++ b/meta/.galaxy_install_info @@ -0,0 +1 @@ +{install_date: 'Thu May 12 08:46:44 2016', version: master} diff --git a/tasks/el.yml b/tasks/el.yml index ca646c5..3155389 100644 --- a/tasks/el.yml +++ b/tasks/el.yml @@ -23,6 +23,39 @@ - el - bond + +- name: Create the slave interfaces configuration files + template: src=el_ifcfg-slaves.j2 dest="{{ el_network_sysconfig }}/ifcfg-{{ item }}" backup=yes + with_items: + - "{{ slaves }}" + when: + - apply + - network_manager + tags: + - el + - bond + - network_manager + +- name: Create the bonding iface + template: src=el_ifcfg-bond.j2 dest="{{ el_network_sysconfig }}/ifcfg-{{ item }}" + with_items: + - "{{ bond }}" + when: + - apply + - ("{{ slaves| length }}" >=2) + - network_manager + notify: restart NetworkManager + tags: + - el + - bond + - network_manager + +- name: Apply settings NOW + service: name=NetworkManager state=restarted + when: + - apply_now + - network_manager + - name: Apply settings NOW service: name=network state=restarted when: diff --git a/templates/el_ifcfg-bond.j2 b/templates/el_ifcfg-bond.j2 index d15df0c..22ac030 100644 --- a/templates/el_ifcfg-bond.j2 +++ b/templates/el_ifcfg-bond.j2 @@ -4,6 +4,10 @@ DEVICE="{{ item }}" BONDING_OPTS="{%for bond_option in bond_options %}{{ bond_option.key }}={{ bond_option.value}} {%endfor%}" MTU="{{ mtu }}" NOZEROCONF=yes +{%if network_manager %} +TYPE=bond +BONDING_MASTER=yes +{% endif %} {%if enable_ipv4 %} {% if ip_addr and netmask %}