2018-01-19 17:23:48 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
export ANSIBLE_ROLES_PATH=./roles
|
|
|
|
|
2018-04-11 23:08:33 +02:00
|
|
|
function gen_task_files() {
|
|
|
|
for i in $(seq -f '%03g' 1 39); do
|
|
|
|
echo -e "- name: Hello Message\n debug:\n msg: Task file ${i}" > "tasks/hello/tasks-file-${i}.yml"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-05-08 15:53:25 +02:00
|
|
|
## Adhoc
|
|
|
|
|
|
|
|
ansible -m include_role -a name=role1 localhost
|
|
|
|
|
2018-01-19 17:23:48 +01:00
|
|
|
## Import (static)
|
|
|
|
|
|
|
|
# Playbook
|
2020-06-10 19:22:40 +02:00
|
|
|
test "$(ansible-playbook -i ../../inventory playbook/test_import_playbook.yml "$@" 2>&1 | grep -c '\[WARNING\]: Additional parameters in import_playbook')" = 1
|
|
|
|
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook playbook/test_import_playbook_tags.yml -i inventory "$@" --tags canary1,canary22,validate --skip-tags skipme
|
2018-01-19 17:23:48 +01:00
|
|
|
|
|
|
|
# Tasks
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook tasks/test_import_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_import_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_import_tasks_tags.yml -i inventory "$@" --tags tasks1,canary1,validate
|
2018-01-19 17:23:48 +01:00
|
|
|
|
|
|
|
# Role
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook role/test_import_role.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook role/test_import_role.yml -i inventory "$@"
|
2018-01-19 17:23:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
## Include (dynamic)
|
|
|
|
|
|
|
|
# Tasks
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook tasks/test_include_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_include_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_include_tasks_tags.yml -i inventory "$@" --tags tasks1,canary1,validate
|
2018-01-19 17:23:48 +01:00
|
|
|
|
|
|
|
# Role
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook role/test_include_role.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook role/test_include_role.yml -i inventory "$@"
|
2018-01-19 17:23:48 +01:00
|
|
|
|
2020-04-17 07:27:41 +02:00
|
|
|
# https://github.com/ansible/ansible/issues/68515
|
|
|
|
ansible-playbook -v role/test_include_role_vars_from.yml 2>&1 | tee test_include_role_vars_from.out
|
|
|
|
test "$(grep -E -c 'Expected a string for vars_from but got' test_include_role_vars_from.out)" = 1
|
2018-01-19 17:23:48 +01:00
|
|
|
|
2018-04-11 23:08:33 +02:00
|
|
|
## Max Recursion Depth
|
2018-01-19 17:23:48 +01:00
|
|
|
# https://github.com/ansible/ansible/issues/23609
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook test_role_recursion.yml -i inventory "$@"
|
2018-01-31 14:35:06 +01:00
|
|
|
|
|
|
|
## Nested tasks
|
|
|
|
# https://github.com/ansible/ansible/issues/34782
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook test_nested_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook test_nested_tasks.yml -i inventory "$@"
|
2018-04-11 23:08:33 +02:00
|
|
|
|
|
|
|
## Tons of top level include_tasks
|
|
|
|
# https://github.com/ansible/ansible/issues/36053
|
|
|
|
# Fixed by https://github.com/ansible/ansible/pull/36075
|
|
|
|
gen_task_files
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook test_copious_include_tasks.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook test_copious_include_tasks.yml -i inventory "$@"
|
2018-04-11 23:08:33 +02:00
|
|
|
rm -f tasks/hello/*.yml
|
2018-04-16 23:46:47 +02:00
|
|
|
|
|
|
|
# Inlcuded tasks should inherit attrs from non-dynamic blocks in parent chain
|
|
|
|
# https://github.com/ansible/ansible/pull/38827
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook test_grandparent_inheritance.yml -i inventory "$@"
|
2018-04-26 20:39:44 +02:00
|
|
|
|
|
|
|
# undefined_var
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook undefined_var/playbook.yml -i inventory "$@"
|
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook undefined_var/playbook.yml -i inventory "$@"
|
2018-04-26 21:25:02 +02:00
|
|
|
|
2018-05-31 19:08:38 +02:00
|
|
|
# include_ + apply (explicit inheritance)
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook apply/include_apply.yml -i inventory "$@" --tags foo
|
2018-05-31 19:08:38 +02:00
|
|
|
set +e
|
2019-01-10 00:36:59 +01:00
|
|
|
OUT=$(ANSIBLE_STRATEGY='linear' ansible-playbook apply/import_apply.yml -i inventory "$@" --tags foo 2>&1 | grep 'ERROR! Invalid options for import_tasks: apply')
|
2018-05-31 19:08:38 +02:00
|
|
|
set -e
|
|
|
|
if [[ -z "$OUT" ]]; then
|
|
|
|
echo "apply on import_tasks did not cause error"
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-06-08 22:36:22 +02:00
|
|
|
|
|
|
|
# Test that duplicate items in loop are not deduped
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='linear' ansible-playbook tasks/test_include_dupe_loop.yml -i inventory "$@" | tee test_include_dupe_loop.out
|
2018-07-09 17:27:00 +02:00
|
|
|
test "$(grep -c '"item=foo"' test_include_dupe_loop.out)" = 3
|
2019-01-10 00:36:59 +01:00
|
|
|
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_include_dupe_loop.yml -i inventory "$@" | tee test_include_dupe_loop.out
|
2018-07-15 16:59:30 +02:00
|
|
|
test "$(grep -c '"item=foo"' test_include_dupe_loop.out)" = 3
|
|
|
|
|
2019-01-10 00:36:59 +01:00
|
|
|
ansible-playbook public_exposure/playbook.yml -i inventory "$@"
|
|
|
|
ansible-playbook public_exposure/no_bleeding.yml -i inventory "$@"
|
|
|
|
ansible-playbook public_exposure/no_overwrite_roles.yml -i inventory "$@"
|
2018-11-08 16:29:24 +01:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/pull/48068
|
2019-03-22 03:49:58 +01:00
|
|
|
ANSIBLE_HOST_PATTERN_MISMATCH=warning ansible-playbook run_once/playbook.yml "$@"
|
2018-11-29 20:50:07 +01:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/48936
|
|
|
|
ansible-playbook -v handler_addressing/playbook.yml 2>&1 | tee test_handler_addressing.out
|
2019-08-12 22:24:28 +02:00
|
|
|
test "$(grep -E -c 'include handler task|ERROR! The requested handler '"'"'do_import'"'"' was not found' test_handler_addressing.out)" = 2
|
2019-01-03 22:13:02 +01:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/49969
|
|
|
|
ansible-playbook -v parent_templating/playbook.yml 2>&1 | tee test_parent_templating.out
|
2019-08-12 22:24:28 +02:00
|
|
|
test "$(grep -E -c 'Templating the path of the parent include_tasks failed.' test_parent_templating.out)" = 0
|
2019-04-09 17:14:42 +02:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/54618
|
|
|
|
ansible-playbook test_loop_var_bleed.yaml "$@"
|
2019-06-11 18:21:28 +02:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/56580
|
|
|
|
ansible-playbook valid_include_keywords/playbook.yml "$@"
|
2019-12-03 16:21:54 +01:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/64902
|
|
|
|
ansible-playbook tasks/test_allow_single_role_dup.yml 2>&1 | tee test_allow_single_role_dup.out
|
|
|
|
test "$(grep -c 'ok=3' test_allow_single_role_dup.out)" = 1
|
2020-02-14 22:50:52 +01:00
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/issues/66764
|
|
|
|
ANSIBLE_HOST_PATTERN_MISMATCH=error ansible-playbook empty_group_warning/playbook.yml
|