diff options
Diffstat (limited to 'xci/playbooks/roles/bootstrap-host/tasks/network.yml')
-rw-r--r-- | xci/playbooks/roles/bootstrap-host/tasks/network.yml | 95 |
1 files changed, 2 insertions, 93 deletions
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network.yml b/xci/playbooks/roles/bootstrap-host/tasks/network.yml index 723db48d..a4f260c4 100644 --- a/xci/playbooks/roles/bootstrap-host/tasks/network.yml +++ b/xci/playbooks/roles/bootstrap-host/tasks/network.yml @@ -50,99 +50,8 @@ - name: Run handlers meta: flush_handlers -- block: - - name: configure modules - lineinfile: - dest: /etc/modules - state: present - create: yes - line: "8021q" - - name: add modules - modprobe: - name: 8021q - state: present - - name: ensure interfaces.d folder is empty - file: - state: "{{ item }}" - path: "/etc/network/interfaces.d" - with_items: - - absent - - directory - - name: ensure interfaces file is updated - template: - src: "{{ installer_type }}/{{ ansible_os_family | lower }}/{{ ansible_hostname }}.interface.j2" - dest: "/etc/network/interfaces" - - name: restart network service - shell: "/sbin/ifconfig {{ ansible_local.xci.network.xci_interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a" - async: 15 - poll: 0 - when: ansible_os_family | lower == "debian" - -- block: - - name: Configure networking on SUSE - template: - src: "{{ installer_type }}/{{ ansible_os_family | lower }}/suse.interface.j2" - dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}" - with_items: - - { name: "{{ ansible_local.xci.network.xci_interface }}" } - - { name: "{{ ansible_local.xci.network.xci_interface }}.10", vlan_id: 10 } - - { name: "{{ ansible_local.xci.network.xci_interface }}.30", vlan_id: 30 } - - { name: "{{ ansible_local.xci.network.xci_interface }}.20", vlan_id: 20 } - - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", ip: "{{ host_info[inventory_hostname].MGMT_IP }}/22" } - - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", ip: "{{ host_info[inventory_hostname].VXLAN_IP }}/22" } - - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", ip: "{{ host_info[inventory_hostname].VLAN_IP }}/24" } - - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", ip: "{{ host_info[inventory_hostname].STORAGE_IP }}/22" } - - - name: Add postup/postdown scripts on SUSE - copy: - src: "network-config-suse" - dest: "/etc/sysconfig/network/scripts/network-config-suse" - mode: 0755 - - - name: Configure routes on SUSE - template: - src: "{{ installer_type }}/{{ ansible_os_family | lower }}/suse.routes.j2" - dest: "/etc/sysconfig/network/ifroute-{{ item.name }}" - with_items: - - { name: "br-vlan", gateway: "192.168.122.1", route: "default" } - - name: restart network service - service: - name: network - state: restarted - async: 15 - poll: 0 - when: ansible_os_family | lower == "suse" - -- block: - - name: Configure networking on CentOS for interfaces - template: - src: "{{ installer_type }}/{{ ansible_os_family | lower }}/interface.ifcfg.j2" - dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name }}" - with_items: - - { name: "{{ ansible_local.xci.network.xci_interface }}" , bridge: "br-vlan" } - - { name: "{{ ansible_local.xci.network.xci_interface }}.10", bridge: "br-mgmt" , vlan_id: 10 } - - { name: "{{ ansible_local.xci.network.xci_interface }}.20", bridge: "br-storage", vlan_id: 20 } - - { name: "{{ ansible_local.xci.network.xci_interface }}.30", bridge: "br-vxlan" , vlan_id: 30 } - - name: Configure networking on CentOS for bridges - template: - src: "{{ installer_type }}/{{ ansible_os_family | lower }}/bridge.ifcfg.j2" - dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name }}" - with_items: - - { name: "br-vlan" , ip: "{{ host_info[inventory_hostname].VLAN_IP }}", prefix: 24 } - - { name: "br-mgmt" , ip: "{{ host_info[inventory_hostname].MGMT_IP }}", prefix: 22 } - - { name: "br-storage", ip: "{{ host_info[inventory_hostname].STORAGE_IP }}", prefix: 22 } - - { name: "br-vxlan" , ip: "{{ host_info[inventory_hostname].VXLAN_IP }}", prefix: 22 } - - name: Add default route through br-vlan - lineinfile: - path: "/etc/sysconfig/network-scripts/ifcfg-br-vlan" - line: "GATEWAY=192.168.122.1" - - name: restart network service - service: - name: network - state: restarted - async: 15 - poll: 0 - when: ansible_os_family | lower == "redhat" +- name: "Configure networking on {{ ansible_os_family }}" + include_tasks: "network_{{ ansible_os_family | lower }}.yml" - name: Wait for host to come back to life local_action: |