summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFatih Degirmenci <fdegir@gmail.com>2018-03-09 17:20:46 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-09 17:20:46 +0000
commit665a9e08c658e5b851416f4f282520a338cd4d49 (patch)
tree2548859aee6e744b77e56130b930db769a7bfc05
parentf06fd879a8a5f715f410456aad8d32d10a4edea0 (diff)
parenta40badcb175a6be138985ff17de06198097a5b16 (diff)
Merge "xci: roles: configure-network: Wait for connection when configuring the network"
-rw-r--r--xci/playbooks/roles/configure-network/tasks/main.yml41
1 files changed, 35 insertions, 6 deletions
diff --git a/xci/playbooks/roles/configure-network/tasks/main.yml b/xci/playbooks/roles/configure-network/tasks/main.yml
index adcb8669..21f213cb 100644
--- a/xci/playbooks/roles/configure-network/tasks/main.yml
+++ b/xci/playbooks/roles/configure-network/tasks/main.yml
@@ -12,6 +12,19 @@
path: "/etc/udev/rules.d/99-glean.rules"
state: absent
+- name: Determine required packages
+ set_fact:
+ network_packages:
+ - bridge-utils
+ - "{{ (ansible_pkg_mgr in ['zypper', 'apt']) | ternary('iproute2', 'iproute') }}"
+ - "{{ (ansible_pkg_mgr == 'apt') | ternary('vlan', '') }}"
+ - iptables
+
+- name: Ensure networking packages are present
+ package:
+ name: "{{ network_packages }}"
+ state: present
+
- block:
- name: configure modules
lineinfile:
@@ -31,6 +44,8 @@
dest: "/etc/network/interfaces"
- name: restart network service
shell: "/sbin/ifconfig {{ ansible_default_ipv4.interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a"
+ async: 15
+ poll: 0
when: ansible_os_family | lower == "debian"
- block:
@@ -68,9 +83,12 @@
dest: "/etc/sysconfig/network/ifroute-{{ item.name }}"
with_items:
- { name: "br-vlan", gateway: "192.168.122.1", route: "default" }
-
- name: restart network service
- shell: "/usr/sbin/wicked ifreload all"
+ service:
+ name: network
+ state: restarted
+ async: 15
+ poll: 0
when: ansible_os_family | lower == "suse"
- block:
@@ -96,8 +114,19 @@
lineinfile:
path: "/etc/sysconfig/network-scripts/ifcfg-br-vlan"
line: "GATEWAY=192.168.122.1"
- - name: Restart networking
- command: "systemctl restart network"
- - name: wait for the server to come back
- wait_for_connection:
+ - name: restart network service
+ service:
+ name: network
+ state: restarted
+ async: 15
+ poll: 0
when: ansible_os_family | lower == "redhat"
+
+- local_action:
+ module: wait_for
+ host: "{{ ansible_host }}"
+ delay: 15
+ state: started
+ port: 22
+ connect_timeout: 10
+ timeout: 180