Install the net-tools package in scripts/env-setup.sh

A couple of playbooks use the 'netstat' utility which is present
in the net-tools package so install it if it's not already present.
It fixes the following problem on a clean CentOS installation:

fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "netstat -apn|grep
LISTEN", "delta": "0:00:00.005074", "end": "2016-08-24 17:14:48.614240",
"failed": true, "invocation": {"module_args": {"_raw_params": "netstat
-apn|grep LISTEN", "_uses_shell": true, "chdir": null, "creates": null,
"executable": null, "removes": null, "warn": true}, "module_name": "command"},
"rc": 1, "start": "2016-08-24 17:14:48.609166", "stderr": "/bin/sh: netstat:
command not found", "stdout": "", "stdout_lines": [], "warnings": []}

Change-Id: I1310f5848c7e71e8bdb91f6fcfaa26ebeeac45e7
Signed-off-by: Markos Chandras <mchandras@suse.de>
This commit is contained in:
Markos Chandras 2016-08-24 17:22:37 +03:00
parent 9cdf2fc7f0
commit 92a2d2863f

View File

@ -42,6 +42,9 @@ if [ -x '/usr/bin/zypper' ]; then
if ! zypper search --installed libffi-devel &>/dev/null; then
sudo -H zypper install -y libffi-devel
fi
if ! zypper search --installed net-tools &>/dev/null; then
sudo -H zypper install -y net-tools
fi
if ! zypper search --match-exact --installed python-pip &>/dev/null; then
sudo -H zypper install -y python-pip
fi
@ -76,6 +79,9 @@ elif [ -x '/usr/bin/apt-get' ]; then
if ! $(dpkg -l libffi-dev &>/dev/null); then
sudo -H apt-get -y install libffi-dev
fi
if ! $(dpkg -l net-tools &>/dev/null); then
sudo -H apt-get -y install net-tools
fi
elif [ -x '/usr/bin/yum' ]; then
if ! $(python --version &>/dev/null); then
sudo -H yum -y install python
@ -103,6 +109,9 @@ elif [ -x '/usr/bin/yum' ]; then
if ! $(rpm -q libffi-devel &>/dev/null); then
sudo -H yum -y install libffi-devel
fi
if ! $(rpm -q net-tools &>/dev/null); then
sudo -H yum -y install net-tools
fi
else
echo "ERROR: Supported package manager not found. Supported: apt,yum,zypper"
fi