Skip to content

Commit

Permalink
B #3080: Packet provision of CentOS 7 on c2.medium fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlastimil Holer committed Apr 4, 2019
1 parent 40f6dff commit 4bdcbc1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions share/oneprovision/ansible/roles/ddc/tasks/clean_netconfigs.yml
Expand Up @@ -5,6 +5,7 @@
shell: |
ip link >/dev/null || exit 1
CHANGED=''
for FILE in ifcfg-*; do
# skip interfaces disabled "on boot"
if grep -q -i '^ONBOOT=["'\'']no'; then
Expand All @@ -17,9 +18,21 @@
# if interface does not exist, disable configuration
if ! ip link show ${IFACE} >/dev/null 2>&1; then
CHANGED=yes
mv ${FILE} disabled-${FILE}
fi
done
# As a result of obsolete configuration, the network service
# could end up in the failed state. Restart of the networking
# might fail later, because only service start is triggered
# (without prior stop). We try to manually put the interfaces down,
# and restart the networking to fix the service state.
# https://github.com/OpenNebula/one/issues/3080
if [ -n "${CHANGED}" ] && systemctl is-failed network.service >/dev/null 2>&1; then
ifdown ifcfg-* || :
systemctl restart network.service
fi
args:
executable: /bin/bash
chdir: /etc/sysconfig/network-scripts
Expand Down

0 comments on commit 4bdcbc1

Please sign in to comment.