[CentOS] Network services start before network is up since migrating to 7.2

Mon Dec 21 15:08:48 UTC 2015
Sylvain CANOINE <sylvain.canoine at tv5monde.org>

> If you're using NetworkManager, you can "systemctl enable
> NetworkManager-wait-online.service" and you won't have to override any
> of the individual services.
Our security experts don't want me to use NetworkManager... It's even uninstalled on the models, so I understand better why all the required files are not here :

# systemctl status NetworkManager-wait-online.service
● NetworkManager-wait-online.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

So I made a crappy but easy-to-deploy script to make the services start after network is online :

for fic in $(grep -rl "After=.*network.target" /lib/systemd/system | cut -d/ -f5 | grep -v "network-online.target")
   [ ! -d "/etc/systemd/system/${fic}.d" ] && mkdir -v "/etc/systemd/system/${fic}.d"
   echo -e "[Unit]\nAfter=network-online.target" > "/etc/systemd/system/${fic}.d/local-network-online.conf" && echo "/etc/systemd/system/${fic}.d/local-network-online.conf"
systemctl daemon-reload

That's working as is, so I'll keep this workaround for now.

Pensez ENVIRONNEMENT : n'imprimer que si ncessaire