doc
This commit is contained in:
+7
-1
@@ -1,3 +1,4 @@
|
||||
# target ansible: Fire docker-build-ansible, Call ansible ANSIBLE_ARGS ARGS or ansible-run target
|
||||
.PHONY: ansible
|
||||
ansible: docker-build-ansible
|
||||
ifneq ($(ARGS),)
|
||||
@@ -6,21 +7,26 @@ else
|
||||
$(call make,ansible-run)
|
||||
endif
|
||||
|
||||
# target ansible-playbook: Call ansible-playbook ANSIBLE_ARGS ARGS
|
||||
.PHONY: ansible-playbook
|
||||
ansible-playbook:
|
||||
$(call ansible-playbook,$(ANSIBLE_ARGS) $(ARGS))
|
||||
|
||||
# target ansible-pull: Call ansible-pull ANSIBLE_GIT_REPOSITORY ANSIBLE_PLAYBOOK
|
||||
.PHONY: ansible-pull
|
||||
ansible-pull:
|
||||
$(call ansible-pull,--url $(ANSIBLE_GIT_REPOSITORY) $(if $(ANSIBLE_GIT_KEY_FILE),--key-file $(ANSIBLE_GIT_KEY_FILE)) $(if $(ANSIBLE_GIT_VERSION),--checkout $(ANSIBLE_GIT_VERSION)) $(if $(ANSIBLE_GIT_DIRECTORY),--directory $(ANSIBLE_GIT_DIRECTORY)) $(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) $(if $(ANSIBLE_EXTRA_VARS),--extra-vars '$(ANSIBLE_EXTRA_VARS)') $(if $(findstring true,$(FORCE)),--force) $(if $(findstring true,$(DRYRUN)),--check) --full $(if $(ANSIBLE_INVENTORY),--inventory $(ANSIBLE_INVENTORY)) $(ANSIBLE_PLAYBOOK))
|
||||
|
||||
# target ansible-pull@%: Fire get-PrivateIpAddress-% for SERVER_NAME, Call ssh-exec make ansible-pull DOCKER_IMAGE_TAG
|
||||
.PHONY: ansible-pull@%
|
||||
ansible-pull@%: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
|
||||
ansible-pull@%: get-PrivateIpAddress-$(SERVER_NAME)
|
||||
$(call ssh-exec,$(AWS_INSTANCE_IP),make ansible-pull ANSIBLE_DOCKER_IMAGE_TAG=$(ANSIBLE_DOCKER_IMAGE_TAG) ANSIBLE_TAGS=$(ANSIBLE_TAGS) FORCE=$(FORCE))
|
||||
|
||||
# target ansible-run: Fire base-ssh-add docker-build-ansible ansible-run-localhost
|
||||
.PHONY: ansible-run
|
||||
ansible-run: base-ssh-add docker-build-ansible ansible-run-localhost
|
||||
|
||||
# target ansible-run-%: Call ansible-playbook ANSIBLE_PLAYBOOK
|
||||
.PHONY: ansible-run-%
|
||||
ansible-run-%:
|
||||
$(call ansible-playbook,$(if $(ANSIBLE_TAGS),--tags $(ANSIBLE_TAGS)) $(if $(ANSIBLE_EXTRA_VARS),--extra-vars '$(patsubst target=localhost,target=$*,$(ANSIBLE_EXTRA_VARS))') $(if $(findstring true,$(DRYRUN)),--check) $(if $(ANSIBLE_INVENTORY),--inventory $(ANSIBLE_INVENTORY)) $(ANSIBLE_PLAYBOOK))
|
||||
|
||||
@@ -38,12 +38,15 @@ define ansible-pull
|
||||
IFS=$$'\n'; $(ECHO) env $(foreach var,$(ENV_VARS),$(if $($(var)),$(var)='$($(var))')) $(shell printenv |awk -F '=' 'NR == FNR { if($$1 !~ /^(\#|$$)/) { A[$$1]; next } } ($$1 in A)' .env.dist - 2>/dev/null) $$(cat $(ENV_FILE) 2>/dev/null |awk -F "=" '$$1 ~! /^\(#|$$\)/') ansible-pull $(ANSIBLE_ARGS) $(ANSIBLE_VERBOSE) $(1)
|
||||
endef
|
||||
else
|
||||
# function ansible: Call run ansible ANSIBLE_ARGS with arg 1
|
||||
define ansible
|
||||
$(call run,ansible $(ANSIBLE_ARGS) $(ANSIBLE_VERBOSE) $(1))
|
||||
endef
|
||||
# function ansible-playbook: Call run ansible-playbook ANSIBLE_ARGS with arg 1
|
||||
define ansible-playbook
|
||||
$(call run,ansible-playbook $(ANSIBLE_ARGS) $(ANSIBLE_VERBOSE) $(1))
|
||||
endef
|
||||
# function ansible-pull: Call run ansible-pull ANSIBLE_ARGS with arg 1
|
||||
define ansible-pull
|
||||
$(call run,ansible-pull $(ANSIBLE_ARGS) $(ANSIBLE_VERBOSE) $(1))
|
||||
endef
|
||||
|
||||
Reference in New Issue
Block a user