Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B #3080: Packet provision of CentOS 7 on c2.medium fails #3186

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions share/oneprovision/ansible/roles/ddc/tasks/clean_netconfigs.yml
Original file line number Diff line number Diff line change
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