2016-03-03 21:22:35 +01:00
TEST_DIR ?= ~/ansible_testing
2014-03-12 19:37:15 +01:00
INVENTORY ?= inventory
VARS_FILE ?= integration_config.yml
2014-03-13 14:52:36 +01:00
# Create a semi-random string for use when testing cloud-based resources
i f n d e f C L O U D _ R E S O U R C E _ P R E F I X
2015-10-16 16:41:01 +02:00
CLOUD_RESOURCE_PREFIX := $( shell python -c "import string,random; print('ansible-testing-' + ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8)));" )
2014-03-13 14:52:36 +01:00
e n d i f
2015-10-17 18:45:29 +02:00
CREDENTIALS_FILE ?= credentials.yml
2014-03-18 15:15:02 +01:00
# If credentials.yml exists, use it
i f n e q ( "$(wildcard $(CREDENTIALS_FILE))" , "" )
CREDENTIALS_ARG = -e @$( CREDENTIALS_FILE)
e l s e
CREDENTIALS_ARG =
e n d i f
2014-08-14 12:20:10 +02:00
# http://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
2015-02-03 01:17:40 +01:00
MYTMPDIR = $( shell mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir' )
2014-08-14 12:20:10 +02:00
2014-05-21 21:17:53 +02:00
VAULT_PASSWORD_FILE = vault-password
2015-01-24 02:09:03 +01:00
CONSUL_RUNNING := $( shell python consul_running.py)
2016-03-04 20:21:43 +01:00
EUID := $( shell id -u -r)
2015-01-24 02:09:03 +01:00
2016-03-21 00:24:01 +01:00
all : setup test_test_infra parsing test_var_precedence unicode test_templating_settings environment test_connection non_destructive destructive includes blocks pull check_mode test_hash test_handlers test_group_by test_vault test_tags test_lookup_paths no_log test_gathering_facts
2016-03-03 21:22:35 +01:00
2016-03-10 02:36:39 +01:00
test_test_infra :
2016-03-18 18:13:45 +01:00
# ensure fail/assert work locally and can stop execution with non-zero exit code
PB_OUT = $$ ( ansible-playbook -i inventory.local test_test_infra.yml) ; APB_RC = $$ ? ; echo " $$ PB_OUT " ; echo " rc was $$ APB_RC (must be non-zero) " ; [ $$ APB_RC -ne 0 ] ; echo "ensure playbook output shows assert/fail works (True)" ; echo " $$ PB_OUT " | grep "fail works (True)" || exit 1 ; echo " $$ PB_OUT " | fgrep "assert works (True)" || exit 1
# ensure we work using all specified test args, overridden inventory, etc
PB_OUT = $$ ( ansible-playbook -i $( INVENTORY) test_test_infra.yml -e @$( VARS_FILE) $( CREDENTIALS_ARG) $( TEST_FLAGS) ) ; APB_RC = $$ ? ; echo " $$ PB_OUT " ; echo " rc was $$ APB_RC (must be non-zero) " ; [ $$ APB_RC -ne 0 ] ; echo "ensure playbook output shows assert/fail works (True)" ; echo " $$ PB_OUT " | grep "fail works (True)" || exit 1 ; echo " $$ PB_OUT " | fgrep "assert works (True)" || exit 1
2016-03-10 02:36:39 +01:00
2016-03-10 06:29:32 +01:00
setup :
2016-03-03 21:22:35 +01:00
rm -rf $( TEST_DIR)
mkdir -p $( TEST_DIR)
2014-07-24 04:10:58 +02:00
2016-03-08 00:38:47 +01:00
parsing : setup
2016-03-03 21:22:35 +01:00
ansible-playbook bad_parsing.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -vvv $( TEST_FLAGS) --tags prepare,common,scenario5
ansible-playbook good_parsing.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-02-20 19:00:05 +01:00
2016-03-03 21:22:35 +01:00
includes : setup
ansible-playbook test_includes.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) $( TEST_FLAGS)
2014-07-26 16:37:55 +02:00
2016-03-10 06:29:32 +01:00
pull : pull_run pull_no_ 127 pull_limit_inventory
2016-02-02 12:13:23 +01:00
pull_run :
ansible-pull -d $( MYTMPDIR) -U https://github.com/ansible-test-robinro/pull-integration-test.git | grep MAGICKEYWORD; \
RC = $$ ? ; \
rm -rf $( MYTMPDIR) ; \
exit $$ RC
# test for https://github.com/ansible/ansible/issues/13681
pull_no_127 :
ansible-pull -d $( MYTMPDIR) -U https://github.com/ansible-test-robinro/pull-integration-test.git | grep -v 127\. 0\. 0\. 1; \
RC = $$ ? ; \
rm -rf $( MYTMPDIR) ; \
exit $$ RC
# test for https://github.com/ansible/ansible/issues/13688
pull_limit_inventory :
ansible-pull -d $( MYTMPDIR) -U https://github.com/ansible-test-robinro/pull-integration-test.git; \
RC = $$ ? ; \
rm -rf $( MYTMPDIR) ; \
exit $$ RC
2016-03-03 21:22:35 +01:00
unicode : setup
ansible-playbook unicode.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) -v $( TEST_FLAGS) -e 'extra_var=café'
2014-11-19 20:50:02 +01:00
# Test the start-at-task flag #9571
2016-03-03 21:22:35 +01:00
ansible-playbook unicode.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) -v --start-at-task '*¶' -e 'start_at_task=True' $( TEST_FLAGS)
2014-07-25 15:59:26 +02:00
2016-03-03 21:22:35 +01:00
test_templating_settings : setup
ansible-playbook test_templating_settings.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-12-16 20:17:29 +01:00
2016-03-14 22:50:27 +01:00
test_gathering_facts : setup
ansible-playbook test_gathering_facts.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) -v $( TEST_FLAGS)
2016-03-03 21:22:35 +01:00
environment : setup
ansible-playbook test_environment.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) $( TEST_FLAGS)
2015-08-21 06:37:17 +02:00
2016-03-03 21:22:35 +01:00
non_destructive : setup
ansible-playbook non_destructive.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-02-20 19:05:03 +01:00
2016-03-21 00:24:01 +01:00
# For our Docker images, which identify themselves with "ENV container=docker", use the test_docker inventory group.
# Otherwise use the test_default inventory group, which runs fewer tests, but should work on any system.
i f e q ( $( container ) , d o c k e r )
TEST_CONNECTION_FILTER := 'test_docker'
e l s e
TEST_CONNECTION_FILTER := 'test_default'
e n d i f
2016-03-05 03:14:52 +01:00
# Skip connection plugins which require root when not running as root.
i f n e q ( $( EUID ) , 0 )
2016-03-21 00:24:01 +01:00
TEST_CONNECTION_FILTER += !chroot
2016-03-04 20:21:43 +01:00
e n d i f
2016-03-05 03:14:52 +01:00
# Connection plugin test command to repeat with each locale setting.
2016-03-21 00:24:01 +01:00
TEST_CONNECTION_CMD = $( 1) ansible-playbook test_connection.yml -i test_connection.inventory -l '$(TEST_CONNECTION_FILTER)' $( TEST_FLAGS)
2016-03-05 03:14:52 +01:00
test_connection : setup
$( call TEST_CONNECTION_CMD)
$( call TEST_CONNECTION_CMD, LC_ALL = C LANG = C)
2016-03-03 21:22:35 +01:00
destructive : setup
ansible-playbook destructive.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-02-20 19:25:19 +01:00
2016-03-03 21:22:35 +01:00
check_mode : setup
ansible-playbook check_mode.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v --check $( TEST_FLAGS)
2014-02-20 22:10:44 +01:00
2016-03-03 21:22:35 +01:00
test_group_by : setup
ansible-playbook test_group_by.yml -i inventory.group_by -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-05-07 04:30:37 +02:00
2014-03-25 18:32:11 +01:00
test_handlers :
2015-07-20 14:11:31 +02:00
ansible-playbook test_handlers.yml --tags scenario1 -i inventory.handlers -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
[ " $$ (ansible-playbook test_handlers.yml --tags scenario2 -l A -i inventory.handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | grep -Po 'RUNNING HANDLER \[test_handlers : \K[^\]]+') " = "test handler" ]
2015-04-04 22:37:14 +02:00
# Not forcing, should only run on successful host
[ " $$ (ansible-playbook test_force_handlers.yml --tags normal -i inventory.handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_B" ]
# Forcing from command line
[ " $$ (ansible-playbook test_force_handlers.yml --tags normal -i inventory.handlers --force-handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
# Forcing from command line, should only run later tasks on unfailed hosts
[ " $$ (ansible-playbook test_force_handlers.yml --tags normal -i inventory.handlers --force-handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_TASK_. | sort | uniq | xargs) " = "CALLED_TASK_B CALLED_TASK_D CALLED_TASK_E" ]
# Forcing from command line, should call handlers even if all hosts fail
[ " $$ (ansible-playbook test_force_handlers.yml --tags normal -i inventory.handlers --force-handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v -e fail_all=yes $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
# Forcing from ansible.cfg
[ " $$ (ANSIBLE_FORCE_HANDLERS=true ansible-playbook --tags normal test_force_handlers.yml -i inventory.handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
# Forcing true in play
[ " $$ (ansible-playbook test_force_handlers.yml --tags force_true_in_play -i inventory.handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
# Forcing false in play, which overrides command line
[ " $$ (ansible-playbook test_force_handlers.yml --force-handlers --tags force_false_in_play -i inventory.handlers -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | egrep -o CALLED_HANDLER_. | sort | uniq | xargs) " = "CALLED_HANDLER_B" ]
2014-03-25 18:32:11 +01:00
2014-02-20 21:23:51 +01:00
test_hash :
2016-03-22 21:19:09 +01:00
ANSIBLE_HASH_BEHAVIOUR = replace ansible-playbook test_hash.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
ANSIBLE_HASH_BEHAVIOUR = merge ansible-playbook test_hash.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
2014-02-24 20:37:23 +01:00
2016-03-03 21:22:35 +01:00
test_var_precedence : setup
ansible-playbook test_var_precedence.yml -i $( INVENTORY) $( CREDENTIALS_ARG) $( TEST_FLAGS) -v -e outputdir = $( TEST_DIR) -e 'extra_var=extra_var' -e 'extra_var_override=extra_var_override'
2014-05-09 18:42:45 +02:00
2016-03-03 21:22:35 +01:00
test_vault : setup
ansible-playbook test_vault.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) --vault-password-file $( VAULT_PASSWORD_FILE) --list-tasks -e outputdir = $( TEST_DIR)
ansible-playbook test_vault.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) --vault-password-file $( VAULT_PASSWORD_FILE) --list-hosts -e outputdir = $( TEST_DIR)
ansible-playbook test_vault.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) --vault-password-file $( VAULT_PASSWORD_FILE) --syntax-check -e outputdir = $( TEST_DIR)
ansible-playbook test_vault.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) --vault-password-file $( VAULT_PASSWORD_FILE) -e outputdir = $( TEST_DIR)
2014-05-21 21:17:53 +02:00
2014-12-08 22:39:01 +01:00
# test_delegate_to does not work unless we have permission to ssh to localhost.
# Would take some more effort on our test systems to implement that -- probably
# the test node should create an ssh public-private key pair that allows the
# root user on a node to ssh to itself. Until then, this is not in make all.
# Have to run it manually. Ordinary users should be able to run this test as
# long as they have permissions to login to their local machine via ssh.
2016-03-03 21:22:35 +01:00
test_delegate_to : setup
ansible-playbook test_delegate_to.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-12-08 21:44:44 +01:00
2016-03-03 21:22:35 +01:00
test_winrm : setup
ansible-playbook test_winrm.yml -i inventory.winrm -e outputdir = $( TEST_DIR) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS)
2014-06-18 06:04:17 +02:00
2016-03-03 21:22:35 +01:00
test_tags : setup
2015-02-13 02:58:30 +01:00
# Run everything by default
2016-03-03 21:22:35 +01:00
[ " $$ (ansible-playbook --list-tasks test_tags.yml -i $( INVENTORY) -e outputdir= $( TEST_DIR) -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | fgrep Task_with | xargs) " = "Task_with_tag TAGS: [tag] Task_with_always_tag TAGS: [always] Task_without_tag TAGS: []" ]
2015-02-13 02:58:30 +01:00
# Run the exact tags, and always
2016-03-03 21:22:35 +01:00
[ " $$ (ansible-playbook --list-tasks --tags tag test_tags.yml -i $( INVENTORY) -e outputdir= $( TEST_DIR) -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | fgrep Task_with | xargs) " = "Task_with_tag TAGS: [tag] Task_with_always_tag TAGS: [always]" ]
2015-02-13 02:58:30 +01:00
# Skip one tag
2016-03-03 21:22:35 +01:00
[ " $$ (ansible-playbook --list-tasks --skip-tags tag test_tags.yml -i $( INVENTORY) -e outputdir= $( TEST_DIR) -e @ $( VARS_FILE) $( CREDENTIALS_ARG) -v $( TEST_FLAGS) | fgrep Task_with | xargs) " = "Task_with_always_tag TAGS: [always] Task_without_tag TAGS: []" ]
2015-02-13 02:58:30 +01:00
2016-03-03 21:22:35 +01:00
blocks : setup
2016-02-03 20:53:47 +01:00
# remove old output log
rm -f block_test.out
2016-02-04 00:42:06 +01:00
# run the test and check to make sure the right number of completions was logged
2016-03-03 21:22:35 +01:00
ansible-playbook -vv -e outputdir = $( TEST_DIR) test_blocks/main.yml | tee block_test.out
2016-03-03 18:25:12 +01:00
[ " $$ (grep 'TEST COMPLETE' block_test.out | wc -l) " = " $$ (egrep '^[0-9]+ plays in' block_test.out | cut -f1 -d' ') " ]
2016-02-04 00:42:06 +01:00
# cleanup the output log again, to make sure the test is clean
rm -f block_test.out
# run test with free strategy and again count the completions
2016-03-03 21:22:35 +01:00
ansible-playbook -vv -e outputdir = $( TEST_DIR) test_blocks/main.yml -e test_strategy = free | tee block_test.out
2016-03-03 18:25:12 +01:00
[ " $$ (grep 'TEST COMPLETE' block_test.out | wc -l) " = " $$ (egrep '^[0-9]+ plays in' block_test.out | cut -f1 -d' ') " ]
2015-02-13 02:58:30 +01:00
2015-05-05 14:42:07 +02:00
cloud : amazon rackspace azure
2014-02-24 20:37:23 +01:00
2014-02-27 17:44:13 +01:00
cloud_cleanup : amazon_cleanup rackspace_cleanup
amazon_cleanup :
2014-03-13 14:52:36 +01:00
python cleanup_ec2.py -y --match= " ^ $( CLOUD_RESOURCE_PREFIX) "
2014-02-27 17:44:13 +01:00
2015-05-05 14:42:07 +02:00
azure_cleanup :
python cleanup_azure.py -y --match= " ^ $( CLOUD_RESOURCE_PREFIX) "
2014-04-12 00:45:56 +02:00
gce_setup :
python setup_gce.py " $( CLOUD_RESOURCE_PREFIX) "
2014-03-30 01:27:48 +01:00
gce_cleanup :
python cleanup_gce.py -y --match= " ^ $( CLOUD_RESOURCE_PREFIX) "
2014-02-27 17:44:13 +01:00
rackspace_cleanup :
2015-01-09 21:50:23 +01:00
python cleanup_rax.py -y --match= " ^ $( CLOUD_RESOURCE_PREFIX) "
2014-02-27 17:44:13 +01:00
2014-03-18 15:15:02 +01:00
$(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. "
2014-02-24 20:37:23 +01:00
@exit 1
2014-03-18 15:15:02 +01:00
amazon : $( CREDENTIALS_FILE )
2014-05-05 22:07:59 +02:00
ANSIBLE_HOST_KEY_CHECKING = False ANSIBLE_SSH_PIPELINING = no BOTO_CONFIG = /dev/null ansible-playbook amazon.yml -i $( INVENTORY) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
2014-02-27 17:44:13 +01:00
RC = $$ ? ; \
2014-03-13 14:52:36 +01:00
CLOUD_RESOURCE_PREFIX = " $( CLOUD_RESOURCE_PREFIX) " make amazon_cleanup ; \
2014-02-27 17:44:13 +01:00
exit $$ RC;
2014-02-24 20:37:23 +01:00
2015-05-05 14:42:07 +02:00
azure : $( CREDENTIALS_FILE )
ANSIBLE_HOST_KEY_CHECKING = False ansible-playbook azure.yml -i $( INVENTORY) $( CREDENTIALS_ARG) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
RC = $$ ? ; \
CLOUD_RESOURCE_PREFIX = " $( CLOUD_RESOURCE_PREFIX) " make azure_cleanup ; \
exit $$ RC;
2014-03-30 01:27:48 +01:00
gce : $( CREDENTIALS_FILE )
2014-04-12 00:45:56 +02:00
CLOUD_RESOURCE_PREFIX = " $( CLOUD_RESOURCE_PREFIX) " make gce_setup ; \
ansible-playbook gce.yml -i $( INVENTORY) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
2014-03-30 01:27:48 +01:00
RC = $$ ? ; \
CLOUD_RESOURCE_PREFIX = " $( CLOUD_RESOURCE_PREFIX) " make gce_cleanup ; \
exit $$ RC;
2014-03-18 15:15:02 +01:00
rackspace : $( CREDENTIALS_FILE )
ansible-playbook rackspace.yml -i $( INVENTORY) -e @$( VARS_FILE) $( CREDENTIALS_ARG) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
2014-02-27 17:44:13 +01:00
RC = $$ ? ; \
2014-03-13 14:52:36 +01:00
CLOUD_RESOURCE_PREFIX = " $( CLOUD_RESOURCE_PREFIX) " make rackspace_cleanup ; \
2014-02-27 17:44:13 +01:00
exit $$ RC;
2014-08-14 12:20:10 +02:00
2015-05-03 16:06:30 +02:00
cloudstack :
ansible-playbook cloudstack.yml -i $( INVENTORY) -e @$( VARS_FILE) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
RC = $$ ? ; \
exit $$ RC;
2016-03-23 21:41:50 +01:00
cloudflare : $( CREDENTIALS_FILE )
ansible-playbook cloudflare.yml -i $( INVENTORY) -e @$( VARS_FILE) -e @$( CREDENTIALS_FILE) -e " resource_prefix= $( CLOUD_RESOURCE_PREFIX) " -v $( TEST_FLAGS) ; \
RC = $$ ? ; \
exit $$ RC;
2015-01-24 02:09:03 +01:00
$(CONSUL_RUNNING) :
consul :
i f e q ( $( CONSUL_RUNNING ) , T r u e )
ansible-playbook -i $( INVENTORY) consul.yml ; \
2015-07-10 18:59:52 +02:00
ansible-playbook -i ../../contrib/inventory/consul_io.py consul_inventory.yml
2015-01-24 02:09:03 +01:00
e l s e
@echo "Consul agent is not running locally. To run a cluster locally see http://github.com/sgargan/consul-vagrant"
e n d i f
2016-01-21 13:00:29 +01:00
test_galaxy : test_galaxy_spec test_galaxy_yaml test_galaxy_git
2014-08-18 13:27:41 +02:00
2016-03-03 21:22:35 +01:00
test_galaxy_spec : setup
2015-02-03 01:17:40 +01:00
mytmpdir = $( MYTMPDIR) ; \
2015-10-03 16:29:28 +02:00
ansible-galaxy install -r galaxy_rolesfile -p $$ mytmpdir/roles -vvvv ; \
2014-08-14 12:20:10 +02:00
cp galaxy_playbook.yml $$ mytmpdir ; \
2016-03-03 21:22:35 +01:00
ansible-playbook -i $( INVENTORY) $$ mytmpdir/galaxy_playbook.yml -e outputdir = $( TEST_DIR) -v $( TEST_FLAGS) ; \
2014-08-14 12:20:10 +02:00
RC = $$ ? ; \
rm -rf $$ mytmpdir ; \
2014-08-18 13:27:41 +02:00
exit $$ RC
2016-03-03 21:22:35 +01:00
test_galaxy_yaml : setup
2015-02-03 01:17:40 +01:00
mytmpdir = $( MYTMPDIR) ; \
2015-10-03 16:29:28 +02:00
ansible-galaxy install -r galaxy_roles.yml -p $$ mytmpdir/roles -vvvv; \
2014-08-18 13:27:41 +02:00
cp galaxy_playbook.yml $$ mytmpdir ; \
2016-03-03 21:22:35 +01:00
ansible-playbook -i $( INVENTORY) $$ mytmpdir/galaxy_playbook.yml -e outputdir = $( TEST_DIR) -v $( TEST_FLAGS) ; \
2014-08-18 13:27:41 +02:00
RC = $$ ? ; \
rm -rf $$ mytmpdir ; \
exit $$ RC
2015-08-13 01:00:54 +02:00
2016-03-03 21:22:35 +01:00
test_galaxy_git : setup
2016-01-21 13:00:29 +01:00
mytmpdir = $( MYTMPDIR) ; \
ansible-galaxy install git+https://bitbucket.org/willthames/git-ansible-galaxy,v1.6 -p $$ mytmpdir/roles -vvvv; \
cp galaxy_playbook_git.yml $$ mytmpdir ; \
ansible-playbook -i $( INVENTORY) $$ mytmpdir/galaxy_playbook_git.yml -v $( TEST_FLAGS) ; \
RC = $$ ? ; \
rm -rf $$ mytmpdir ; \
exit $$ RC
2016-03-03 21:22:35 +01:00
test_lookup_paths : setup
ansible-playbook lookup_paths/play.yml -i $( INVENTORY) -e outputdir = $( TEST_DIR) -v $( TEST_FLAGS)
2015-10-02 15:09:12 +02:00
2016-03-03 21:22:35 +01:00
no_log : setup
2015-10-02 20:33:02 +02:00
# This test expects 7 loggable vars and 0 non loggable ones, if either mismatches it fails, run the ansible-playbook command to debug
2016-03-03 21:22:35 +01:00
[ " $$ (ansible-playbook no_log_local.yml -i $( INVENTORY) -e outputdir= $( TEST_DIR) -vvvvv | awk --source 'BEGIN { logme = 0; nolog = 0; } /LOG_ME/ { logme += 1;} /DO_NOT_LOG/ { nolog += 1;} END { printf " %d/%d", logme, nolog; }')" = "6/0" ]