mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Update credentials.yml documentation and handling
Changes include: * Update Makefile to use credentials.yml when it exists * Add details on the use of the credentials.yml file to README.md. * Update credentials.template comments
This commit is contained in:
@@ -6,20 +6,28 @@ ifndef CLOUD_RESOURCE_PREFIX
|
||||
CLOUD_RESOURCE_PREFIX := $(shell python -c "import string,random; print 'ansible-testing-' + ''.join(random.choice(string.ascii_letters + string.digits) for _ in xrange(8));")
|
||||
endif
|
||||
|
||||
CREDENTIALS_FILE = credentials.yml
|
||||
# If credentials.yml exists, use it
|
||||
ifneq ("$(wildcard $(CREDENTIALS_FILE))","")
|
||||
CREDENTIALS_ARG = -e @$(CREDENTIALS_FILE)
|
||||
else
|
||||
CREDENTIALS_ARG =
|
||||
endif
|
||||
|
||||
all: non_destructive destructive check_mode test_hash
|
||||
|
||||
non_destructive:
|
||||
ansible-playbook non_destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) -v $(TEST_FLAGS)
|
||||
ansible-playbook non_destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
destructive:
|
||||
ansible-playbook destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) -v $(TEST_FLAGS)
|
||||
ansible-playbook destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
check_mode:
|
||||
ansible-playbook check_mode.yml -i $(INVENTORY) -e @$(VARS_FILE) -v --check $(TEST_FLAGS)
|
||||
ansible-playbook check_mode.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v --check $(TEST_FLAGS)
|
||||
|
||||
test_hash:
|
||||
ANSIBLE_HASH_BEHAVIOUR=replace ansible-playbook test_hash.yml -i $(INVENTORY) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
|
||||
ANSIBLE_HASH_BEHAVIOUR=merge ansible-playbook test_hash.yml -i $(INVENTORY) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
|
||||
ANSIBLE_HASH_BEHAVIOUR=replace ansible-playbook test_hash.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
|
||||
ANSIBLE_HASH_BEHAVIOUR=merge ansible-playbook test_hash.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
|
||||
|
||||
cloud: amazon rackspace
|
||||
|
||||
@@ -32,18 +40,18 @@ rackspace_cleanup:
|
||||
@echo "FIXME - cleanup_rax.py not yet implemented"
|
||||
@# python cleanup_rax.py -y --match="^$(CLOUD_RESOURCE_PREFIX)"
|
||||
|
||||
credentials.yml:
|
||||
@echo "No credentials.yml file found. A file named 'credentials.yml' is needed to provide credentials needed to run cloud tests. See sample 'credentials.template' file."
|
||||
$(CREDENTIALS_FILE):
|
||||
@echo "No credentials file found. A file named '$(CREDENTIALS_FILE)' is needed to provide credentials needed to run cloud tests. See sample 'credentials.template' file."
|
||||
@exit 1
|
||||
|
||||
amazon: credentials.yml
|
||||
ansible-playbook amazon.yml -i $(INVENTORY) -e @$(VARS_FILE) -e @credentials.yml -e "resource_prefix=$(CLOUD_RESOURCE_PREFIX)" -v $(TEST_FLAGS) ; \
|
||||
amazon: $(CREDENTIALS_FILE)
|
||||
ansible-playbook amazon.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -e "resource_prefix=$(CLOUD_RESOURCE_PREFIX)" -v $(TEST_FLAGS) ; \
|
||||
RC=$$? ; \
|
||||
CLOUD_RESOURCE_PREFIX="$(CLOUD_RESOURCE_PREFIX)" make amazon_cleanup ; \
|
||||
exit $$RC;
|
||||
|
||||
rackspace: credentials.yml
|
||||
ansible-playbook rackspace.yml -i $(INVENTORY) -e @$(VARS_FILE) -e @credentials.yml -e "resource_prefix=$(CLOUD_RESOURCE_PREFIX)" -v $(TEST_FLAGS) ; \
|
||||
rackspace: $(CREDENTIALS_FILE)
|
||||
ansible-playbook rackspace.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -e "resource_prefix=$(CLOUD_RESOURCE_PREFIX)" -v $(TEST_FLAGS) ; \
|
||||
RC=$$? ; \
|
||||
CLOUD_RESOURCE_PREFIX="$(CLOUD_RESOURCE_PREFIX)" make rackspace_cleanup ; \
|
||||
exit $$RC;
|
||||
|
||||
Reference in New Issue
Block a user