Last active
August 27, 2021 18:52
-
-
Save zoredache/3808c7b1455c1c7f357c12f359fa45a0 to your computer and use it in GitHub Desktop.
Install ansible centos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# all the ansible python packages will be nicely self contained in this directory. | |
virtualenv_path=/usr/local/ansible/stable | |
mkdir -p /etc/ansible | |
mkdir -p ${virtualenv_path} | |
# Create requirements file for pip | |
# and more, or remove as needed. | |
echo " | |
ansible | |
ansible-lint | |
bcrypt | |
cryptography | |
dnspython | |
docker | |
netaddr | |
ntlm-auth | |
paramiko | |
pykerberos | |
pyOpenSSL | |
pypsrp | |
pywinrm | |
requests | |
requests-credssp | |
requests-kerberos | |
yamllint | |
" > ${virtualenv_path}/requirements.txt | |
# install OS packages | |
yum install -y gcc gcc-c++ make | |
yum install -y python3 python3-devel python3-pip python3-setuptools python3-wheel python3-virtualenv krb5-devel krb5-workstation | |
# Create virtual environment we we install ansible into | |
if test ! -x ${virtualenv_path}/bin/pip ; then | |
/usr/bin/python3 -m venv --system-site-packages ${virtualenv_path} | |
fi | |
# install/upgrade ansible in the virtual environment | |
${virtualenv_path}/bin/pip install --upgrade --requirement ${virtualenv_path}/requirements.txt | |
# create some symlinks in /usr/local/bin for the commands in our venv | |
# so we can use them without activating the venv | |
while read item; | |
do | |
if test ! -x /usr/local/bin/${item} ; then | |
ln -rs ${virtualenv_path}/bin/$item /usr/local/bin/$item | |
fi | |
done <<EOF | |
ansible | |
ansible-config | |
ansible-cmdb | |
ansible-doc | |
ansible-galaxy | |
ansible-inventory | |
ansible-lint | |
ansible-playbook | |
ansible-pull | |
ansible-test | |
ansible-vault | |
yamllint | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment