xci: Fix network configuration
[releng.git] / prototypes / xci / playbooks / roles / configure-network / tasks / main.yml
1 ---
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2017 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 # TODO: this role needs to be adjusted for different distros
11 - block:
12     - name: configure modules
13       lineinfile:
14         dest: /etc/modules
15         state: present
16         create: yes
17         line: "8021q"
18     - name: add modules
19       modprobe:
20         name: 8021q
21         state: present
22     - name: ensure glean rules are removed
23       file:
24         path: "/etc/udev/rules.d/99-glean.rules"
25         state: absent
26     - name: ensure interfaces.d folder is empty
27       shell: "/bin/rm -rf /etc/network/interfaces.d/*"
28     - name: ensure interfaces file is updated
29       template:
30         src: "{{ src }}"
31         dest: "{{ dest }}"
32     - name: restart network service
33       shell: "/sbin/ifconfig {{ interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a"
34   when: ansible_distribution_release == "xenial"