Re-add ansible network setup and split out virbr case.

This commit is contained in:
Kevin Fenzi 2016-02-05 17:59:23 +00:00
parent 5ecc096a05
commit ec285b1708

View file

@ -19,41 +19,41 @@
- resolvconf
- base
#- name: disable resolv.conf control from NM
# ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none
# notify:
# - restart NetworkManager
# when: ansible_distribution_major_version|int >=7
# tags:
# - config
# - resolvconf
# - base
#
#- name: get interface uuid
# shell: nmcli -f "DEVICE,UUID" c show --active | grep -E '^eth|^br'
# register: if_uuid
# changed_when: false
# failed_when: 'if_uuid.stdout == ""'
# always_run: yes
# when: ansible_distribution_major_version|int >=7
# tags:
# - config
# - ifcfg
# - base
#
#- name: copy ifcfg files - non virthost
# template: src=ifcfg.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{item}} mode=644
# with_items:
# - "{{ ansible_interfaces }}"
# notify:
## - restart NetworkManager
# - reload NetworkManager-connections
# - apply interface-changes
# when: (virthost is not defined) and (not item.startswith('tun','virbr')) and (hostvars[inventory_hostname]['ansible_' + item]['type'] == 'ether') and (ansible_distribution_major_version|int >=7) and hostvars[inventory_hostname]['ansible_' + item]['active']
# tags:
# - config
# - ifcfg
# - base
- name: disable resolv.conf control from NM
ini_file: dest=/etc/NetworkManager/NetworkManager.conf section=main option=dns value=none
notify:
- restart NetworkManager
when: ansible_distribution_major_version|int >=7
tags:
- config
- resolvconf
- base
- name: get interface uuid
shell: nmcli -f "DEVICE,UUID" c show --active | grep -E '^eth|^br'
register: if_uuid
changed_when: false
failed_when: 'if_uuid.stdout == ""'
always_run: yes
when: ansible_distribution_major_version|int >=7
tags:
- config
- ifcfg
- base
- name: copy ifcfg files - non virthost
template: src=ifcfg.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{item}} mode=644
with_items:
- "{{ ansible_interfaces }}"
notify:
# - restart NetworkManager
- reload NetworkManager-connections
- apply interface-changes
when: (virthost is not defined) and (not item.startswith('tun') or not item.startswith('virbr') and (hostvars[inventory_hostname]['ansible_' + item]['type'] == 'ether') and (ansible_distribution_major_version|int >=7) and hostvars[inventory_hostname]['ansible_' + item]['active']
tags:
- config
- ifcfg
- base
- name: global default packages to install (yum)
yum: state=present name={{ item }}