-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from druidfi/ansible
Add ansible
- Loading branch information
Showing
7 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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 | ||
|
||
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) | ||
|
||
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="$*" | ||
|
||
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 | ||
|
||
PHONY += ansible-install-roles | ||
ansible-install-roles: ## Install Ansible roles | ||
$(call step,Ansible: Install Ansible roles...\n) | ||
@ansible-galaxy install -r $(ANSIBLE_REQUIREMENTS) -p $(ANSIBLE_ROLES_PATH) | ||
|
||
PHONY += ansible-update-roles | ||
ansible-update-roles: ## Update Ansible roles | ||
$(call step,Ansible: Update Ansible roles...\n) | ||
@ansible-galaxy remove --roles-path=$(ANSIBLE_ROLES_PATH) $(shell find $(ANSIBLE_ROLES_PATH) -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) || true | ||
@ansible-galaxy install --force-with-deps --role-file=$(ANSIBLE_REQUIREMENTS) --roles-path=$(ANSIBLE_ROLES_PATH) | ||
|
||
$(ANSIBLE_ROLES_PATH)/$(ANSIBLE_CHECK_ROLE): | ||
@$(MAKE) ansible-install-roles |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
provision-foobar HAS_ANSIBLE=yes | ||
--- | ||
__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" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
provision HAS_ANSIBLE=yes | ||
--- | ||
__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 |
This file contains 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
This file contains 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