From 27ed701a2fab282b514d18120759a79e3e91a9a7 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Mon, 8 Apr 2024 07:16:52 +0300 Subject: [PATCH] Update ansible.mk --- make/ansible.mk | 11 ++++------- tests/outputs/ansible-provision-tag.txt | 2 +- tests/outputs/ansible-provision.txt | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/make/ansible.mk b/make/ansible.mk index 5244b75..132f84c 100644 --- a/make/ansible.mk +++ b/make/ansible.mk @@ -1,27 +1,24 @@ -ANSIBLE_INVENTORY_PATH ?= ansible/inventory ANSIBLE_ROLES_PATH ?= ansible/roles ANSIBLE_CHECK_ROLE ?= geerlingguy.docker ANSIBLE_PLAYBOOK ?= ansible-playbook ANSIBLE_PROVISION ?= ansible/provision.yml ANSIBLE_REQUIREMENTS ?= ansible/requirements.yml +ANSIBLE_FLAGS ?= PHONY += provision -provision: INVENTORY ?= production provision: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make provisioning $(call step,Ansible: Make dry run on provisioning...\n) - @$(ANSIBLE_PLAYBOOK) -i $(ANSIBLE_INVENTORY_PATH)/$(INVENTORY) $(ANSIBLE_PROVISION) + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) $(ANSIBLE_FLAGS) PHONY += provision-% -provision-%: INVENTORY ?= production provision-%: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make provisioning by tag $(call step,Ansible: Make provisioning by tag "$*"...\n) - @$(ANSIBLE_PLAYBOOK) -i $(ANSIBLE_INVENTORY_PATH)/$(INVENTORY) $(ANSIBLE_PROVISION) --tags="$*" + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) --tags="$*" $(ANSIBLE_FLAGS) PHONY += provision-dry-run -provision-dry-run: INVENTORY ?= production provision-dry-run: $(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE) ## Make dry run on provisioning $(call step,Ansible: Make dry run on provisioning...\n) - @$(ANSIBLE_PLAYBOOK) -i $(ANSIBLE_INVENTORY_PATH)/$(INVENTORY) $(ANSIBLE_PROVISION) --check + @$(ANSIBLE_PLAYBOOK) $(ANSIBLE_PROVISION) $(ANSIBLE_FLAGS) --check PHONY += ansible-install-roles ansible-install-roles: ## Install Ansible roles diff --git a/tests/outputs/ansible-provision-tag.txt b/tests/outputs/ansible-provision-tag.txt index 4ee9ba4..342c75d 100644 --- a/tests/outputs/ansible-provision-tag.txt +++ b/tests/outputs/ansible-provision-tag.txt @@ -4,4 +4,4 @@ __MAKE__ ansible-install-roles printf "\n⭐ \033[0;33mAnsible: Install Ansible roles...\n\033[0m\n" ansible-galaxy install -r ansible/requirements.yml -p ansible/roles printf "\n⭐ \033[0;33mAnsible: Make provisioning by tag "foobar"...\n\033[0m\n" -ansible-playbook -i ansible/inventory/production ansible/provision.yml --tags="foobar" +ansible-playbook ansible/provision.yml --tags="foobar" diff --git a/tests/outputs/ansible-provision.txt b/tests/outputs/ansible-provision.txt index 895e554..bf0163e 100644 --- a/tests/outputs/ansible-provision.txt +++ b/tests/outputs/ansible-provision.txt @@ -4,4 +4,4 @@ __MAKE__ ansible-install-roles printf "\n⭐ \033[0;33mAnsible: Install Ansible roles...\n\033[0m\n" ansible-galaxy install -r ansible/requirements.yml -p ansible/roles printf "\n⭐ \033[0;33mAnsible: Make dry run on provisioning...\n\033[0m\n" -ansible-playbook -i ansible/inventory/production ansible/provision.yml +ansible-playbook ansible/provision.yml