Skip to content

Instantly share code, notes, and snippets.

@DaveB93
Forked from mohankumargupta/install-ansible-on-msys2.sh
Last active September 20, 2023 05:33
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save DaveB93/db94a6b310e08c928c0778f766562ab0 to your computer and use it in GitHub Desktop.
Save DaveB93/db94a6b310e08c928c0778f766562ab0 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
which ansible >/dev/null 2>&1
if [ $? -ne 0 ];
then
echo "Installing Ansible..."
sleep 5
pushd .
cd ~
pacman -S libyaml-devel python2 tar libffi libffi-devel gcc pkg-config make openssl-devel openssh libcrypt-devel --noconfirm --needed
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2 get-pip.py
wget -c https://download.libsodium.org/libsodium/releases/libsodium-1.0.16-mingw.tar.gz
tar xvzf libsodium-1.0.16-mingw.tar.gz
SODIUM_INSTALL=system CFLAGS=`pkg-config --cflags libffi` LDFLAGS=`pkg-config --libs libffi` C_INCLUDE_PATH=~/libsodium-win64/include LIBRARY_PATH=~/libsodium-win64/lib python2 -m pip install cffi --no-binary :all:
SODIUM_INSTALL=system CFLAGS=`pkg-config --cflags libffi` LDFLAGS=`pkg-config --libs libffi` C_INCLUDE_PATH=~/libsodium-win64/include LIBRARY_PATH=~/libsodium-win64/lib python2 -m pip install pynacl
python2 -m pip install ansible --no-binary :all:
popd
fi
which ansible >/dev/null 2>&1
if [ $? -eq 0 ];
then
echo "Ansible installed."
else
echo "Ansible not installed."
fi
#!/usr/bin/bash
which ansible >/dev/null 2>&1
if [ $? -ne 0 ];
then
echo "Installing Ansible..."
sleep 5
pushd .
cd ~
pacman -S libyaml-devel python3 python3-pip mingw-w64-x86_64-libsodium libffi libffi-devel gcc pkg-config make openssl-devel openssh libcrypt-devel --noconfirm --needed
SODIUM_INSTALL=system CFLAGS=`pkg-config --cflags libffi` LDFLAGS=`pkg-config --libs libffi` python3 -m pip install cffi --no-binary :all:
SODIUM_INSTALL=system CFLAGS=`pkg-config --cflags libffi` LDFLAGS=`pkg-config --libs libffi` C_INCLUDE_PATH=/mingw64/include LIBRARY_PATH=/mingw64/lib python3 -m pip install pynacl
python3 -m pip install ansible --no-binary :all:
popd
fi
which ansible >/dev/null 2>&1
if [ $? -eq 0 ];
then
echo "Ansible installed."
else
echo "Ansible not installed."
fi
@getsomebread
Copy link

Works great! This was a life-saver, thanks for posting.

@alexjorgef
Copy link

MSYS2 already have ansible package support, just type pacman -S ansible on your MSYS2 terminal 😀

@DaveB93
Copy link
Author

DaveB93 commented Jul 8, 2021

@Alex1a it didn't have it or didn't work very well 2 or 3 years ago ( I'm not even sure when I wrote this gist initially )

@alexjorgef
Copy link

alexjorgef commented Jul 13, 2021

@Alex1a it didn't have it or didn't work very well 2 or 3 years ago ( I'm not even sure when I wrote this gist initially )

Build configurations are inspired by these and other instructions, I'm just leaving things documented. Thank you

@DaveB93
Copy link
Author

DaveB93 commented Jul 13, 2021

mmm.. yes fair point. sorry if I seemed snappy. would it be better for me to delete / update the gist?

@alexjorgef
Copy link

of course not, is a good reference. thank you for sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment