--- # Copyright 2015, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Copy network configuration template: src: "redhat_interface_{{ item.type | default('default') }}.cfg.j2" dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt') }}" with_items: "{{ bridges }}" register: network_interfaces - name: Create alias file when required template: src: "redhat_interface_alias.cfg.j2" dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt')}}:0" with_items: "{{ bridges }}" when: - item.alias is defined - name: Put down post-up script for veth-peer interfaces template: src: "rpm_interface_{{ item[0] }}.cfg.j2" dest: "/etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}" mode: "0755" with_nested: - [ "ifup-post", "ifdown-post" ] - "{{ bridges }}" when: - item[1].veth_peer is defined - name: Ensure the postup/postdown scripts are loaded lineinfile: dest: "/etc/sysconfig/network-scripts/{{ item[0] }}" line: ". /etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}" insertbefore: "^exit 0" with_nested: - [ "ifup-post", "ifdown-post" ] - "{{ bridges }}" when: - item[1].veth_peer is defined