@@ -28,10 +28,18 @@ ifeq ($(shell command -v pip >/dev/null 2>&1; echo $$?), 0)
2828 export PIP := $(shell which pip3)
2929endif
3030
31+ ifeq ($(shell command -v asdf >/dev/null 2>&1; echo $$? ) , 0)
32+ export ASDF := $(shell which asdf)
33+ endif
34+
3135ifeq ($(shell command -v ansible >/dev/null 2>&1; echo $$? ) , 0)
3236 export ANSIBLE := $(shell which ansible)
3337endif
3438
39+ ifeq ($(shell command -v ansible-galaxy >/dev/null 2>&1; echo $$? ) , 0)
40+ export ANSIBLE_GALAXY := $(shell which ansible-galaxy)
41+ endif
42+
3543ifeq ($(shell command -v ansible-lint >/dev/null 2>&1; echo $$? ) , 0)
3644 export ANSIBLE_LINT := $(shell which ansible-lint)
3745endif
@@ -126,22 +134,29 @@ pip: python ## install pip
126134 fi \
127135
128136ansible : pip # # install ansible
129- @echo " Installing Ansible..."
130- if [ " ${UNAME} " = " Darwin" ]; then \
131- brew install ansible ansible-lint; \
132- else \
133- python3 -m pip install ansible ansible-lint; \
134- sudo touch /var/log/ansible.log; \
135- sudo chmod 666 /var/log/ansible.log; \
136- fi
137+ if [ -z ${ANSIBLE} ]; then \
138+ echo " Installing Ansible..." ; \
139+ if [ " ${UNAME} " = " Darwin" ]; then \
140+ brew install ansible ansible-lint; \
141+ else \
142+ python3 -m pip install ansible ansible-lint; \
143+ sudo touch /var/log/ansible.log; \
144+ sudo chmod 666 /var/log/ansible.log; \
145+ fi
146+ fi ; \
137147
138148ansible-galaxy : ansible git # # install ansible galaxy roles
139149 @echo " Installing Ansible Galaxy roles..."
140- curl https://raw.githubusercontent.com/pythoninthegrass/framework/master/requirements.yml -o /tmp/requirements.yml; \
150+ if [ ! -f /tmp/requirements.yml ]; then \
151+ curl https://raw.githubusercontent.com/pythoninthegrass/framework/master/requirements.yml -o /tmp/requirements.yml; \
152+ fi ; \
141153 if [ " ${UNAME} " = " Darwin" ]; then \
142154 ansible-galaxy install -r /tmp/requirements.yml; \
143155 elif [ " ${UNAME} " = " Linux" ]; then \
144- ~ /.local/bin/ansible-galaxy install -r /tmp/requirements.yml; \
156+ if [ ! -z " ${ASDF} " ]; then \
157+ asdf reshim python; \
158+ fi ; \
159+ " ${ANSIBLE_GALAXY} " install -r /tmp/requirements.yml; \
145160 fi
146161
147162# TODO: "/usr/bin/sh: 3: [: =: unexpected operator" `ne` and `!=` operators don't work (╯°□°)╯︵ ┻━┻
0 commit comments