Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 6a1e474

Browse files
committed
Update JJG-Ansible-Windows sub-project to latest release (1.0.3).
1 parent 7df5fb2 commit 6a1e474

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

provisioning/JJG-Ansible-Windows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Windows shell provisioning script to bootstrap Ansible from within a Vagrant VM running on Windows.
44

5-
This script is configured to use configure RHEL-based VM (Fedora, CentOS, etc.) so it can run Ansible playbooks from within the VM through Vagrant.
5+
This script is configured to use configure any Linux-based VM (Debian, Ubuntu, Fedora, RedHat, CentOS, etc.) so it can run Ansible playbooks from within the VM through Vagrant.
66

77
Read more about this script, and other techniques for using Ansible within a Windows environment, on Server Check.in: [Running Ansible within Windows](https://servercheck.in/blog/running-ansible-within-windows).
88

provisioning/JJG-Ansible-Windows/windows.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,32 @@
1010
# export {http,https,ftp}_proxy='http://username:password@proxy-host:80'
1111

1212
ANSIBLE_PLAYBOOK=$1
13+
PLAYBOOK_DIR=${ANSIBLE_PLAYBOOK%/*}
1314

1415
# Detect package management system.
15-
YUM=$(which yum)
16-
APT_GET=$(which apt-get)
16+
YUM=$(which yum 2>/dev/null)
17+
APT_GET=$(which apt-get 2>/dev/null)
1718

1819
# Make sure Ansible playbook exists.
19-
if [ ! -f /vagrant/$ANSIBLE_PLAYBOOK ]; then
20+
if [ ! -f "/vagrant/$ANSIBLE_PLAYBOOK" ]; then
2021
echo "Cannot find Ansible playbook."
2122
exit 1
2223
fi
2324

2425
# Install Ansible and its dependencies if it's not installed already.
2526
if [ ! -f /usr/bin/ansible ]; then
2627
echo "Installing Ansible dependencies and Git."
27-
if [[ ! -z $YUM ]]; then
28+
if [[ ! -z ${YUM} ]]; then
2829
yum install -y git python python-devel
29-
elif [[ ! -z $APT_GET ]]; then
30-
apt-get install -y git python python-devel
30+
elif [[ ! -z ${APT_GET} ]]; then
31+
apt-get install -y git python python-dev
3132
else
3233
echo "Neither yum nor apt-get are available."
3334
exit 1;
3435
fi
3536

3637
echo "Installing pip via easy_install."
37-
wget http://peak.telecommunity.com/dist/ez_setup.py
38+
wget https://raw.githubusercontent.com/ActiveState/ez_setup/v0.9/ez_setup.py
3839
python ez_setup.py && rm -f ez_setup.py
3940
easy_install pip
4041
# Make sure setuptools are installed crrectly.
@@ -47,13 +48,10 @@ if [ ! -f /usr/bin/ansible ]; then
4748
pip install ansible
4849
fi
4950

50-
# Install Ansible roles from requirements file, if available.
51-
if [ -f /vagrant/requirements.txt ]; then
52-
sudo ansible-galaxy install -r /vagrant/requirements.txt
53-
elif [-f /vagrant/requirements.yml ]; then
54-
sudo ansible-galaxy install -r /vagrant/requirements.yml
55-
fi
51+
# Install requirements.
52+
echo "Installing Ansible roles from requirements file, if available."
53+
find "/vagrant/$PLAYBOOK_DIR" \( -name "requirements.yml" -o -name "requirements.txt" \) -exec sudo ansible-galaxy install -r {} \;
5654

5755
# Run the playbook.
5856
echo "Running Ansible provisioner defined in Vagrantfile."
59-
ansible-playbook -i 'localhost,' /vagrant/${ANSIBLE_PLAYBOOK} --extra-vars "is_windows=true" --connection=local
57+
ansible-playbook -i 'localhost,' "/vagrant/${ANSIBLE_PLAYBOOK}" --extra-vars "is_windows=true" --connection=local

0 commit comments

Comments
 (0)