summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2019-01-25 19:37:56 -0800
committerMatt Clay <matt@mystile.com>2019-01-25 20:46:53 -0800
commita8116497ba302de524489ffd47444517b520e9a7 (patch)
tree3c4d07baddd98426280787f82c1231fefbd8cead
parent73636175da5f44eff2d2ac9623e38ed35d6e6309 (diff)
downloadansible-a8116497ba302de524489ffd47444517b520e9a7.tar.gz
More test fixes for split controller/remote tests.
-rw-r--r--test/integration/targets/blocks/main.yml2
-rw-r--r--test/integration/targets/check_mode/check_mode-not-on-cli.yml6
-rw-r--r--test/integration/targets/check_mode/check_mode-on-cli.yml6
-rw-r--r--test/integration/targets/environment/test_environment.yml9
-rw-r--r--test/integration/targets/get_url/tasks/main.yml10
-rw-r--r--test/integration/targets/git/tasks/depth.yml2
-rw-r--r--test/integration/targets/git/tasks/localmods.yml4
-rw-r--r--test/integration/targets/hash/roles/test_hash_behaviour/tasks/main.yml6
-rw-r--r--test/integration/targets/ini_file/meta/main.yml2
-rw-r--r--test/integration/targets/ini_file/tasks/main.yml116
-rw-r--r--test/integration/targets/iterators/files/bar11
-rw-r--r--test/integration/targets/iterators/files/foo11
-rw-r--r--test/integration/targets/iterators/tasks/main.yml16
-rw-r--r--test/integration/targets/module_precedence/modules_test.yml2
-rw-r--r--test/integration/targets/module_precedence/modules_test_envvar.yml2
-rw-r--r--test/integration/targets/module_precedence/modules_test_multiple_roles.yml2
-rw-r--r--test/integration/targets/module_precedence/modules_test_multiple_roles_reverse_order.yml2
-rw-r--r--test/integration/targets/module_precedence/modules_test_role.yml2
-rw-r--r--test/integration/targets/module_utils/module_utils_envvar.yml2
-rw-r--r--test/integration/targets/module_utils/module_utils_test.yml2
-rw-r--r--test/integration/targets/old_style_modules_posix/meta/main.yml2
-rw-r--r--test/integration/targets/old_style_modules_posix/tasks/main.yml7
-rw-r--r--test/integration/targets/omit/48673.yml2
-rw-r--r--test/integration/targets/pause/aliases2
-rw-r--r--test/integration/targets/pause/pause-1.yml2
-rw-r--r--test/integration/targets/pause/pause-2.yml2
-rw-r--r--test/integration/targets/pause/pause-3.yml2
-rw-r--r--test/integration/targets/pause/pause-4.yml2
-rw-r--r--test/integration/targets/pause/pause-5.yml2
-rwxr-xr-xtest/integration/targets/pause/runme.sh10
-rw-r--r--test/integration/targets/pause/setup.yml4
-rw-r--r--test/integration/targets/pause/test-pause-no-tty.yml2
-rw-r--r--test/integration/targets/pause/test-pause.yml2
-rw-r--r--test/integration/targets/read_csv/tasks/main.yml2
-rw-r--r--test/integration/targets/script/tasks/main.yml1
-rw-r--r--test/integration/targets/sensu_client/aliases1
-rw-r--r--test/integration/targets/sensu_client/tasks/main.yml22
-rw-r--r--test/integration/targets/sensu_handler/aliases1
-rw-r--r--test/integration/targets/sensu_handler/tasks/main.yml11
-rw-r--r--test/integration/targets/sensu_handler/tasks/set.yml11
-rw-r--r--test/integration/targets/sensu_handler/tasks/tcp.yml11
-rw-r--r--test/integration/targets/sensu_handler/tasks/transport.yml11
-rw-r--r--test/integration/targets/sensu_handler/tasks/udp.yml11
-rw-r--r--test/integration/targets/task_ordering/meta/main.yml2
-rw-r--r--test/integration/targets/task_ordering/tasks/main.yml13
-rw-r--r--test/integration/targets/task_ordering/tasks/taskorder-include.yml8
-rw-r--r--test/integration/targets/templating_settings/test_templating_settings.yml2
-rw-r--r--test/integration/targets/want_json_modules_posix/meta/main.yml2
-rw-r--r--test/integration/targets/want_json_modules_posix/tasks/main.yml7
49 files changed, 217 insertions, 135 deletions
diff --git a/test/integration/targets/blocks/main.yml b/test/integration/targets/blocks/main.yml
index ea61d05869..012d5ab270 100644
--- a/test/integration/targets/blocks/main.yml
+++ b/test/integration/targets/blocks/main.yml
@@ -84,7 +84,7 @@
- debug: msg="TEST COMPLETE"
- name: block with includes
- hosts: localhost
+ hosts: testhost
gather_facts: yes
strategy: "{{test_strategy|default('linear')}}"
vars:
diff --git a/test/integration/targets/check_mode/check_mode-not-on-cli.yml b/test/integration/targets/check_mode/check_mode-not-on-cli.yml
index 0c7af038e1..1b0c734b98 100644
--- a/test/integration/targets/check_mode/check_mode-not-on-cli.yml
+++ b/test/integration/targets/check_mode/check_mode-not-on-cli.yml
@@ -1,6 +1,6 @@
---
# Run withhout --check
-- hosts: localhost
+- hosts: testhost
gather_facts: False
tasks:
- command: 'echo ran'
@@ -12,7 +12,7 @@
that:
- '"ran" in command_out["stdout"]'
-- hosts: localhost
+- hosts: testhost
gather_facts: False
check_mode: True
tasks:
@@ -24,7 +24,7 @@
that:
- '"check mode" in command_out["msg"]'
-- hosts: localhost
+- hosts: testhost
gather_facts: False
tasks:
- command: 'echo ran'
diff --git a/test/integration/targets/check_mode/check_mode-on-cli.yml b/test/integration/targets/check_mode/check_mode-on-cli.yml
index 8091198bb7..0af34b83c0 100644
--- a/test/integration/targets/check_mode/check_mode-on-cli.yml
+++ b/test/integration/targets/check_mode/check_mode-on-cli.yml
@@ -1,6 +1,6 @@
---
# Run with --check
-- hosts: localhost
+- hosts: testhost
gather_facts: False
tasks:
- command: 'echo ran'
@@ -11,7 +11,7 @@
that:
- '"check mode" in command_out["msg"]'
-- hosts: localhost
+- hosts: testhost
gather_facts: False
check_mode: False
tasks:
@@ -23,7 +23,7 @@
that:
- '"ran" in command_out["stdout"]'
-- hosts: localhost
+- hosts: testhost
gather_facts: False
tasks:
- command: 'echo ran'
diff --git a/test/integration/targets/environment/test_environment.yml b/test/integration/targets/environment/test_environment.yml
index f8e49ac8d0..43f9c74eb6 100644
--- a/test/integration/targets/environment/test_environment.yml
+++ b/test/integration/targets/environment/test_environment.yml
@@ -1,4 +1,11 @@
- hosts: testhost
+ gather_facts: no
+ tasks:
+ - name: get PATH from target
+ command: echo $PATH
+ register: target_path
+
+- hosts: testhost
vars:
- test1:
key1: val1
@@ -9,7 +16,7 @@
- name: ensure special case with ansible_env is skipped but others still work
assert:
that:
- - lookup('env', 'PATH') == ansible_env.PATH
+ - target_path.stdout == ansible_env.PATH
- "'/lola' not in ansible_env.PATH"
- ansible_env.lola == 'ido'
diff --git a/test/integration/targets/get_url/tasks/main.yml b/test/integration/targets/get_url/tasks/main.yml
index e6d6d9c614..53789848fd 100644
--- a/test/integration/targets/get_url/tasks/main.yml
+++ b/test/integration/targets/get_url/tasks/main.yml
@@ -396,8 +396,8 @@
- name: Test headers string
assert:
that:
- - (result["content"] | b64decode | from_json).headers.get('Foo') == 'bar'
- - (result["content"] | b64decode | from_json).headers.get('Baz') == 'qux'
+ - (result.content | b64decode | from_json).headers.get('Foo') == 'bar'
+ - (result.content | b64decode | from_json).headers.get('Baz') == 'qux'
- name: Test headers string invalid format
get_url:
@@ -425,8 +425,8 @@
- name: Test headers dict
assert:
that:
- - (result["content"] | b64decode | from_json).headers.get('Foo') == 'bar'
- - (result["content"] | b64decode | from_json).headers.get('Baz') == 'qux'
+ - (result.content | b64decode | from_json).headers.get('Foo') == 'bar'
+ - (result.content | b64decode | from_json).headers.get('Baz') == 'qux'
- name: Test client cert auth, with certs
get_url:
@@ -444,5 +444,5 @@
- name: Assert that the ssl_client_verify file contains the correct content
assert:
that:
- - '(result["content"] | b64decode) == "ansible.http.tests:SUCCESS"'
+ - '(result.content | b64decode) == "ansible.http.tests:SUCCESS"'
when: has_httptester
diff --git a/test/integration/targets/git/tasks/depth.yml b/test/integration/targets/git/tasks/depth.yml
index 37b6ecdfef..547f84f7b5 100644
--- a/test/integration/targets/git/tasks/depth.yml
+++ b/test/integration/targets/git/tasks/depth.yml
@@ -169,7 +169,7 @@
- name: DEPTH | check update arrived
assert:
that:
- - "{{ a_file['content'] | b64decode | trim }} == 3"
+ - "{{ a_file.content | b64decode | trim }} == 3"
- git_fetch is changed
- name: DEPTH | clear checkout_dir
diff --git a/test/integration/targets/git/tasks/localmods.yml b/test/integration/targets/git/tasks/localmods.yml
index 083ec3f2af..09a1326d58 100644
--- a/test/integration/targets/git/tasks/localmods.yml
+++ b/test/integration/targets/git/tasks/localmods.yml
@@ -47,7 +47,7 @@
- name: LOCALMODS | check update arrived
assert:
that:
- - "{{ a_file['content'] | b64decode | trim }} == 2"
+ - "{{ a_file.content | b64decode | trim }} == 2"
- git_fetch_force is changed
- name: LOCALMODS | clear checkout_dir
@@ -105,7 +105,7 @@
- name: LOCALMODS | check update arrived
assert:
that:
- - "{{ a_file['content'] | b64decode | trim }} == 2"
+ - "{{ a_file.content | b64decode | trim }} == 2"
- git_fetch_force is changed
- name: LOCALMODS | clear checkout_dir
diff --git a/test/integration/targets/hash/roles/test_hash_behaviour/tasks/main.yml b/test/integration/targets/hash/roles/test_hash_behaviour/tasks/main.yml
index 03c8af7abd..bc63549808 100644
--- a/test/integration/targets/hash/roles/test_hash_behaviour/tasks/main.yml
+++ b/test/integration/targets/hash/roles/test_hash_behaviour/tasks/main.yml
@@ -18,13 +18,13 @@
- name: debug hash behaviour result
debug:
- var: ansible_env.ANSIBLE_HASH_BEHAVIOUR
+ var: "{{ lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') }}"
verbosity: 2
- name: assert hash behaviour is merge or replace
assert:
that:
- - ansible_env.ANSIBLE_HASH_BEHAVIOUR in ('merge', 'replace')
+ - lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') in ('merge', 'replace')
- name: debug test_hash var
debug:
@@ -34,4 +34,4 @@
- name: assert the dictionary values match
assert:
that:
- - "ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'merge' and test_hash == merged_hash or ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'replace' and test_hash == replaced_hash"
+ - "lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') == 'merge' and test_hash == merged_hash or lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') == 'replace' and test_hash == replaced_hash"
diff --git a/test/integration/targets/ini_file/meta/main.yml b/test/integration/targets/ini_file/meta/main.yml
new file mode 100644
index 0000000000..1810d4bec9
--- /dev/null
+++ b/test/integration/targets/ini_file/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_remote_tmp_dir
diff --git a/test/integration/targets/ini_file/tasks/main.yml b/test/integration/targets/ini_file/tasks/main.yml
index 4c44d918d0..c54b905ab2 100644
--- a/test/integration/targets/ini_file/tasks/main.yml
+++ b/test/integration/targets/ini_file/tasks/main.yml
@@ -18,7 +18,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: record the output directory
- set_fact: output_file={{output_dir}}/foo.ini
+ set_fact: output_file={{ remote_tmp_dir }}/foo.ini
- name: add "fav=lemonade" is in section "[drinks]" in specified file
ini_file:
@@ -34,13 +34,18 @@
- result1.changed == True
- result1.msg == 'section and option added'
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- expected1: |-
+ expected1: |
[drinks]
fav = lemonade
- content1: "{{ lookup('file', output_file) }}"
+ content1: "{{ output_content.content | b64decode }}"
- name: Verify content of ini file is as expected
assert:
@@ -69,14 +74,19 @@
value: coke
register: result3
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- expected3: |-
+ expected3: |
[drinks]
fav = lemonade
beverage = coke
- content3: "{{ lookup('file', output_file) }}"
+ content3: "{{ output_content.content | b64decode }}"
- name: assert 'changed' is true and content is OK
assert:
@@ -93,9 +103,14 @@
state: absent
register: result4
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: get ini file content
set_fact:
- content4: "{{ lookup('file', output_file) }}"
+ content4: "{{ output_content.content | b64decode }}"
- name: assert changed and content is as expected
assert:
@@ -111,16 +126,21 @@
state: absent
register: result5
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: get current ini file content
set_fact:
- content5: "{{ lookup('file', output_file) }}"
+ content5: "{{ output_content.content | b64decode }}"
- name: assert changed and content is empty
assert:
that:
- result5.changed == True
- result5.msg == 'section removed'
- - content5 == ""
+ - content5 == "\n"
# allow_no_value
@@ -163,11 +183,16 @@
- { o: "skip-name-resolve", v: null }
- { o: "max_connections", v: "500" }
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- content7: "{{ lookup('file', output_file) }}"
- expected7: |-
-
+ content7: "{{ output_content.content | b64decode }}"
+ expected7: |
+
[mysqld]
skip-name
skip-name-resolve
@@ -186,11 +211,16 @@
value: myvalue
register: result8
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- content8: "{{ lookup('file', output_file) }}"
- expected8: |-
-
+ content8: "{{ output_content.content | b64decode }}"
+ expected8: |
+
[mysqld]
skip-name = myvalue
skip-name-resolve
@@ -211,11 +241,16 @@
allow_no_value: yes
register: result9
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- content9: "{{ lookup('file', output_file) }}"
- expected9: |-
-
+ content9: "{{ output_content.content | b64decode }}"
+ expected9: |
+
[mysqld]
skip-name
skip-name-resolve
@@ -236,11 +271,16 @@
state: absent
register: result10
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- content10: "{{ lookup('file', output_file) }}"
- expected10: |-
-
+ content10: "{{ output_content.content | b64decode }}"
+ expected10: |
+
[mysqld]
skip-name
max_connections = 500
@@ -266,10 +306,15 @@
value: coke
register: result11
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- expected11: "beverage = coke"
- content11: "{{ lookup('file', output_file) }}"
+ expected11: "beverage = coke\n\n"
+ content11: "{{ output_content.content | b64decode }}"
- name: assert 'changed' is true and content is OK (no section)
assert:
@@ -286,11 +331,16 @@
section:
register: result12
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- expected12: "beverage = water"
+ expected12: "beverage = water\n\n"
- content12: "{{ lookup('file', output_file) }}"
+ content12: "{{ output_content.content | b64decode }}"
- name: assert 'changed' is true and content is OK (no section)
assert:
@@ -307,16 +357,21 @@
state: absent
register: result13
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: get current ini file content
set_fact:
- content13: "{{ lookup('file', output_file) }}"
+ content13: "{{ output_content.content | b64decode }}"
- name: assert changed (no section)
assert:
that:
- result13 is changed
- result13.msg == 'option changed'
- - content13 == ""
+ - content13 == "\n"
- name: Check add option without section before existing section
block:
@@ -333,14 +388,19 @@
option: like
value: tea
+- name: read content from output file
+ slurp:
+ src: "{{ output_file }}"
+ register: output_content
+
- name: set expected content and get current ini file content
set_fact:
- expected14: |-
+ expected14: |
like = tea
[drinks]
beverage = water
- content14: "{{ lookup('file', output_file) }}"
+ content14: "{{ output_content.content | b64decode }}"
- name: Verify content of ini file is as expected
assert:
diff --git a/test/integration/targets/iterators/files/bar1 b/test/integration/targets/iterators/files/bar1
new file mode 100644
index 0000000000..5716ca5987
--- /dev/null
+++ b/test/integration/targets/iterators/files/bar1
@@ -0,0 +1 @@
+bar
diff --git a/test/integration/targets/iterators/files/foo1 b/test/integration/targets/iterators/files/foo1
new file mode 100644
index 0000000000..257cc5642c
--- /dev/null
+++ b/test/integration/targets/iterators/files/foo1
@@ -0,0 +1 @@
+foo
diff --git a/test/integration/targets/iterators/tasks/main.yml b/test/integration/targets/iterators/tasks/main.yml
index 969caa95cc..917d97357c 100644
--- a/test/integration/targets/iterators/tasks/main.yml
+++ b/test/integration/targets/iterators/tasks/main.yml
@@ -201,25 +201,19 @@
# WITH_FIRST_FOUND
-- name: create file for test
- shell: echo "foo" > {{ output_dir }}/foo1
-
-- name: create file for test
- shell: echo "bar" > {{ output_dir }}/bar1
-
- name: test with_first_found
#shell: echo {{ item }}
set_fact: "first_found={{ item }}"
with_first_found:
- - "{{ output_dir + '/does_not_exist' }}"
- - "{{ output_dir + '/foo1' }}"
- - "{{ output_dir + '/bar1' }}"
+ - "{{ role_path + '/files/does_not_exist' }}"
+ - "{{ role_path + '/files/foo1' }}"
+ - "{{ role_path + '/files/bar1' }}"
- name: set expected
- set_fact: first_expected="{{ output_dir | expanduser + '/foo1' }}"
+ set_fact: first_expected="{{ role_path + '/files/foo1' }}"
- name: set unexpected
- set_fact: first_unexpected="{{ output_dir | expanduser + '/bar1' }}"
+ set_fact: first_unexpected="{{ role_path + '/files/bar1' }}"
- name: verify with_first_found results
assert:
diff --git a/test/integration/targets/module_precedence/modules_test.yml b/test/integration/targets/module_precedence/modules_test.yml
index ab783fdbaa..cf3e8886ad 100644
--- a/test/integration/targets/module_precedence/modules_test.yml
+++ b/test/integration/targets/module_precedence/modules_test.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
tasks:
- name: Use standard ping module
diff --git a/test/integration/targets/module_precedence/modules_test_envvar.yml b/test/integration/targets/module_precedence/modules_test_envvar.yml
index 5b6338a375..f52e2f914f 100644
--- a/test/integration/targets/module_precedence/modules_test_envvar.yml
+++ b/test/integration/targets/module_precedence/modules_test_envvar.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
tasks:
- name: Use ping from library path
diff --git a/test/integration/targets/module_precedence/modules_test_multiple_roles.yml b/test/integration/targets/module_precedence/modules_test_multiple_roles.yml
index 855afb7710..f4bd264957 100644
--- a/test/integration/targets/module_precedence/modules_test_multiple_roles.yml
+++ b/test/integration/targets/module_precedence/modules_test_multiple_roles.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
vars:
expected_location: "role: foo"
diff --git a/test/integration/targets/module_precedence/modules_test_multiple_roles_reverse_order.yml b/test/integration/targets/module_precedence/modules_test_multiple_roles_reverse_order.yml
index 5c57801566..5403ae238c 100644
--- a/test/integration/targets/module_precedence/modules_test_multiple_roles_reverse_order.yml
+++ b/test/integration/targets/module_precedence/modules_test_multiple_roles_reverse_order.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
vars:
expected_location: "role: bar"
diff --git a/test/integration/targets/module_precedence/modules_test_role.yml b/test/integration/targets/module_precedence/modules_test_role.yml
index 9a71598875..ccbe31d88b 100644
--- a/test/integration/targets/module_precedence/modules_test_role.yml
+++ b/test/integration/targets/module_precedence/modules_test_role.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
roles:
- foo
diff --git a/test/integration/targets/module_utils/module_utils_envvar.yml b/test/integration/targets/module_utils/module_utils_envvar.yml
index edd55d53b4..8d97e0eb9d 100644
--- a/test/integration/targets/module_utils/module_utils_envvar.yml
+++ b/test/integration/targets/module_utils/module_utils_envvar.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
tasks:
- name: Use a specially crafted module to see if things were imported correctly
diff --git a/test/integration/targets/module_utils/module_utils_test.yml b/test/integration/targets/module_utils/module_utils_test.yml
index 4359d24421..cf0672bc30 100644
--- a/test/integration/targets/module_utils/module_utils_test.yml
+++ b/test/integration/targets/module_utils/module_utils_test.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
gather_facts: no
tasks:
- name: Use a specially crafted module to see if things were imported correctly
diff --git a/test/integration/targets/old_style_modules_posix/meta/main.yml b/test/integration/targets/old_style_modules_posix/meta/main.yml
new file mode 100644
index 0000000000..1810d4bec9
--- /dev/null
+++ b/test/integration/targets/old_style_modules_posix/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_remote_tmp_dir
diff --git a/test/integration/targets/old_style_modules_posix/tasks/main.yml b/test/integration/targets/old_style_modules_posix/tasks/main.yml
index ba56de5bfc..a7882171b6 100644
--- a/test/integration/targets/old_style_modules_posix/tasks/main.yml
+++ b/test/integration/targets/old_style_modules_posix/tasks/main.yml
@@ -27,8 +27,13 @@
that:
- 'goodbye_ansible.msg == "Goodbye, Ansible!"'
+- name: Copy module to remote
+ copy:
+ src: "{{ role_path }}/library/helloworld.sh"
+ dest: "{{ remote_tmp_dir }}/helloworld.sh"
+
- name: Execute module directly
- command: '/bin/sh {{ role_path }}/library/helloworld.sh'
+ command: '/bin/sh {{ remote_tmp_dir }}/helloworld.sh'
register: direct
ignore_errors: true
diff --git a/test/integration/targets/omit/48673.yml b/test/integration/targets/omit/48673.yml
index b6d4f31b10..d25c8cf2a3 100644
--- a/test/integration/targets/omit/48673.yml
+++ b/test/integration/targets/omit/48673.yml
@@ -1,4 +1,4 @@
-- hosts: localhost
+- hosts: testhost
serial: "{{ testing_omitted_variable | default(omit) }}"
tasks:
- debug:
diff --git a/test/integration/targets/pause/aliases b/test/integration/targets/pause/aliases
index 447c957881..6b71e884a1 100644
--- a/test/integration/targets/pause/aliases
+++ b/test/integration/targets/pause/aliases
@@ -1,2 +1,2 @@
-setup/always/setup_pexpect
+needs/target/setup_pexpect
shippable/posix/group3
diff --git a/test/integration/targets/pause/pause-1.yml b/test/integration/targets/pause/pause-1.yml
index 493036895f..44c9960c4b 100644
--- a/test/integration/targets/pause/pause-1.yml
+++ b/test/integration/targets/pause/pause-1.yml
@@ -1,5 +1,5 @@
- name: Test pause module in default state
- hosts: testhost
+ hosts: localhost
become: no
gather_facts: no
diff --git a/test/integration/targets/pause/pause-2.yml b/test/integration/targets/pause/pause-2.yml
index e3d900ec47..81a7fda59b 100644
--- a/test/integration/targets/pause/pause-2.yml
+++ b/test/integration/targets/pause/pause-2.yml
@@ -1,5 +1,5 @@
- name: Test pause module with custom prompt
- hosts: testhost
+ hosts: localhost
become: no
gather_facts: no
diff --git a/test/integration/targets/pause/pause-3.yml b/test/integration/targets/pause/pause-3.yml
index 8daf061054..8f8c72ed10 100644
--- a/test/integration/targets/pause/pause-3.yml
+++ b/test/integration/targets/pause/pause-3.yml
@@ -1,5 +1,5 @@
- name: Test pause module with pause
- hosts: testhost
+ hosts: localhost
become: no
gather_facts: no
diff --git a/test/integration/targets/pause/pause-4.yml b/test/integration/targets/pause/pause-4.yml
index 01bd06a20c..f16c7d6763 100644
--- a/test/integration/targets/pause/pause-4.yml
+++ b/test/integration/targets/pause/pause-4.yml
@@ -1,5 +1,5 @@
- name: Test pause module with pause and custom prompt
- hosts: testhost
+ hosts: localhost
become: no
gather_facts: no
diff --git a/test/integration/targets/pause/pause-5.yml b/test/integration/targets/pause/pause-5.yml
index 2a2b154820..22955cd03d 100644
--- a/test/integration/targets/pause/pause-5.yml
+++ b/test/integration/targets/pause/pause-5.yml
@@ -1,5 +1,5 @@
- name: Test pause module echo output
- hosts: testhost
+ hosts: localhost
become: no
gather_facts: no
diff --git a/test/integration/targets/pause/runme.sh b/test/integration/targets/pause/runme.sh
index 5b2038541b..932f49ec2d 100755
--- a/test/integration/targets/pause/runme.sh
+++ b/test/integration/targets/pause/runme.sh
@@ -2,10 +2,12 @@
set -eux
+ANSIBLE_ROLES_PATH=../ ansible-playbook setup.yml
+
# Test pause module when no tty and non-interactive. This is to prevent playbooks
# from hanging in cron and Tower jobs.
/usr/bin/env bash << EOF
-ansible-playbook test-pause-no-tty.yml -i ../../inventory 2>&1 | \
+ansible-playbook test-pause-no-tty.yml 2>&1 | \
grep '\[WARNING\]: Not waiting for response to prompt as stdin is not interactive' && {
echo 'Successfully skipped pause in no TTY mode' >&2
exit 0
@@ -17,12 +19,12 @@ EOF
# Test redirecting stdout
# Issue #41717
-ansible-playbook pause-3.yml -i ../../inventory > /dev/null \
+ansible-playbook pause-3.yml > /dev/null \
&& echo "Successfully redirected stdout" \
|| echo "Failure when attempting to redirect stdout"
# Test pause with seconds and minutes specified
-ansible-playbook test-pause.yml -i ../../inventory "$@"
+ansible-playbook test-pause.yml "$@"
# Interactively test pause
-python test-pause.py -i ../../inventory "$@"
+python test-pause.py "$@"
diff --git a/test/integration/targets/pause/setup.yml b/test/integration/targets/pause/setup.yml
new file mode 100644
index 0000000000..9f6ab11741
--- /dev/null
+++ b/test/integration/targets/pause/setup.yml
@@ -0,0 +1,4 @@
+- hosts: localhost
+ gather_facts: no
+ roles:
+ - setup_pexpect
diff --git a/test/integration/targets/pause/test-pause-no-tty.yml b/test/integration/targets/pause/test-pause-no-tty.yml
index f7a2b36cbc..6e0e402710 100644
--- a/test/integration/targets/pause/test-pause-no-tty.yml
+++ b/test/integration/targets/pause/test-pause-no-tty.yml
@@ -1,5 +1,5 @@
- name: Test pause
- hosts: testhost
+ hosts: localhost
gather_facts: no
become: no
diff --git a/test/integration/targets/pause/test-pause.yml b/test/integration/targets/pause/test-pause.yml
index cfe9f32427..2703eed434 100644
--- a/test/integration/targets/pause/test-pause.yml
+++ b/test/integration/targets/pause/test-pause.yml
@@ -1,5 +1,5 @@
- name: Test pause
- hosts: testhost
+ hosts: localhost
gather_facts: no
become: no
diff --git a/test/integration/targets/read_csv/tasks/main.yml b/test/integration/targets/read_csv/tasks/main.yml
index e00d2a6ed2..a3dcf8a5ef 100644
--- a/test/integration/targets/read_csv/tasks/main.yml
+++ b/test/integration/targets/read_csv/tasks/main.yml
@@ -61,7 +61,6 @@
unique: no
delimiter: ';'
register: users_nonunique
- delegate_to: localhost
- assert:
that:
@@ -96,7 +95,6 @@
dag,500,500,Dag Wieƫrs
jeroen,501,500,Jeroen Hoekx
dest: users_noheader.csv
- delegate_to: localhost
# Read a CSV file and access user 'dag'
- name: Read users from CSV file and return a dictionary
diff --git a/test/integration/targets/script/tasks/main.yml b/test/integration/targets/script/tasks/main.yml
index e7913c9a9e..441d740691 100644
--- a/test/integration/targets/script/tasks/main.yml
+++ b/test/integration/targets/script/tasks/main.yml
@@ -45,7 +45,6 @@
assert:
that:
- "script_result0.rc == 0"
- - "script_result0.stderr == ''"
- "script_result0.stdout == 'win'"
- name: Execute a script with a space in the path
diff --git a/test/integration/targets/sensu_client/aliases b/test/integration/targets/sensu_client/aliases
index a6dafcf8cd..5dcaaac61c 100644
--- a/test/integration/targets/sensu_client/aliases
+++ b/test/integration/targets/sensu_client/aliases
@@ -1 +1,2 @@
shippable/posix/group1
+needs/root
diff --git a/test/integration/targets/sensu_client/tasks/main.yml b/test/integration/targets/sensu_client/tasks/main.yml
index c15685ad81..387a7c1e22 100644
--- a/test/integration/targets/sensu_client/tasks/main.yml
+++ b/test/integration/targets/sensu_client/tasks/main.yml
@@ -22,24 +22,23 @@
- default
register: client
-- name: Retrieve configuration file stat
- stat:
- path: "{{ client_file }}"
- register: client_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ client_file }}"
+ register: client_config
- name: Assert that client data was set successfully and properly
assert:
that:
- "client is successful"
- "client is changed"
- - "client_stat.stat.exists == true"
- "client['config']['name'] == 'client'"
- "'default' in client['config']['subscriptions']"
- "client['file'] == client_file"
- name: Assert that the client configuration file is actually configured properly
vars:
- config: "{{ lookup('file', client_file) | from_json }}"
+ config: "{{ client_config.content | b64decode | from_json }}"
assert:
that:
- "config['client']['keepalives'] == true"
@@ -129,10 +128,10 @@
occurrences: "3"
register: client_twice
-- name: Retrieve configuration file stat
- stat:
- path: "{{ client_file }}"
- register: client_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ client_file }}"
+ register: client_config
- name: Assert that client data was set successfully and properly
assert:
@@ -141,7 +140,6 @@
- "client is changed"
- "client_twice is successful"
- "client_twice is not changed"
- - "client_stat.stat.exists == true"
- "client['config']['name'] == 'custom'"
- "client['config']['address'] == 'host.fqdn'"
- "'default' in client['config']['subscriptions']"
@@ -155,7 +153,7 @@
- name: Assert that the client configuration file is actually configured properly
vars:
- config: "{{ lookup('file', client_file) | from_json }}"
+ config: "{{ client_config.content | b64decode | from_json }}"
assert:
that:
- "config['client']['name'] == 'custom'"
diff --git a/test/integration/targets/sensu_handler/aliases b/test/integration/targets/sensu_handler/aliases
index a6dafcf8cd..5dcaaac61c 100644
--- a/test/integration/targets/sensu_handler/aliases
+++ b/test/integration/targets/sensu_handler/aliases
@@ -1 +1,2 @@
shippable/posix/group1
+needs/root
diff --git a/test/integration/targets/sensu_handler/tasks/main.yml b/test/integration/targets/sensu_handler/tasks/main.yml
index e85543f20b..0c0b56d23e 100644
--- a/test/integration/targets/sensu_handler/tasks/main.yml
+++ b/test/integration/targets/sensu_handler/tasks/main.yml
@@ -28,10 +28,10 @@
state: "present"
register: handler_twice
-- name: Retrieve configuration file stat
- stat:
- path: "{{ handler['file'] }}"
- register: handler_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ handler['file'] }}"
+ register: handler_config
- name: Assert that handler data was set successfully and properly
assert:
@@ -40,7 +40,6 @@
- "handler is changed"
- "handler_twice is successful"
- "handler_twice is not changed"
- - "handler_stat.stat.exists == true"
- "handler['name'] == 'handler'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/handler.json'"
- "handler['config']['type'] == 'pipe'"
@@ -51,7 +50,7 @@
- name: Assert that the handler configuration file is actually configured properly
vars:
- config: "{{ lookup('file', handler['file']) | from_json }}"
+ config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'handler' in config['handlers']"
diff --git a/test/integration/targets/sensu_handler/tasks/set.yml b/test/integration/targets/sensu_handler/tasks/set.yml
index 27908b76ca..393d711dc3 100644
--- a/test/integration/targets/sensu_handler/tasks/set.yml
+++ b/test/integration/targets/sensu_handler/tasks/set.yml
@@ -19,17 +19,16 @@
- anotherhandler
register: handler
-- name: Retrieve configuration file stat
- stat:
- path: "{{ handler['file'] }}"
- register: handler_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ handler['file'] }}"
+ register: handler_config
- name: Validate set handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- - "handler_stat.stat.exists == true"
- "handler['name'] == 'set'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/set.json'"
- "handler['config']['type'] == 'set'"
@@ -39,7 +38,7 @@
- name: Assert that the handler configuration file is actually configured properly
vars:
- config: "{{ lookup('file', handler['file']) | from_json }}"
+ config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'set' in config['handlers']"
diff --git a/test/integration/targets/sensu_handler/tasks/tcp.yml b/test/integration/targets/sensu_handler/tasks/tcp.yml
index f318e3b8c9..076ea14e1e 100644
--- a/test/integration/targets/sensu_handler/tasks/tcp.yml
+++ b/test/integration/targets/sensu_handler/tasks/tcp.yml
@@ -20,17 +20,16 @@
port: 8000
register: handler
-- name: Retrieve configuration file stat
- stat:
- path: "{{ handler['file'] }}"
- register: handler_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ handler['file'] }}"
+ register: handler_config
- name: Validate tcp handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- - "handler_stat.stat.exists == true"
- "handler['name'] == 'tcp'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/tcp.json'"
- "handler['config']['type'] == 'tcp'"
@@ -41,7 +40,7 @@
- name: Assert that the handler configuration file is actually configured properly
vars:
- config: "{{ lookup('file', handler['file']) | from_json }}"
+ config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'tcp' in config['handlers']"
diff --git a/test/integration/targets/sensu_handler/tasks/transport.yml b/test/integration/targets/sensu_handler/tasks/transport.yml
index c40ee56202..34816194fa 100644
--- a/test/integration/targets/sensu_handler/tasks/transport.yml
+++ b/test/integration/targets/sensu_handler/tasks/transport.yml
@@ -20,17 +20,16 @@
name: "transport_handler"
register: handler
-- name: Retrieve configuration file stat
- stat:
- path: "{{ handler['file'] }}"
- register: handler_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ handler['file'] }}"
+ register: handler_config
- name: Validate transport handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- - "handler_stat.stat.exists == true"
- "handler['name'] == 'transport'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/transport.json'"
- "handler['config']['type'] == 'transport'"
@@ -41,7 +40,7 @@
- name: Assert that the handler configuration file is actually configured properly
vars:
- config: "{{ lookup('file', handler['file']) | from_json }}"
+ config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'transport' in config['handlers']"
diff --git a/test/integration/targets/sensu_handler/tasks/udp.yml b/test/integration/targets/sensu_handler/tasks/udp.yml
index 1c9bb4360a..8f13a2a25e 100644
--- a/test/integration/targets/sensu_handler/tasks/udp.yml
+++ b/test/integration/targets/sensu_handler/tasks/udp.yml
@@ -20,17 +20,16 @@
port: 8000
register: handler
-- name: Retrieve configuration file stat
- stat:
- path: "{{ handler['file'] }}"
- register: handler_stat
+- name: Retrieve configuration file
+ slurp:
+ src: "{{ handler['file'] }}"
+ register: handler_config
- name: Validate udp handler return data
assert:
that:
- "handler is successful"
- "handler is changed"
- - "handler_stat.stat.exists == true"
- "handler['name'] == 'udp'"
- "handler['file'] == '/etc/sensu/conf.d/handlers/udp.json'"
- "handler['config']['type'] == 'udp'"
@@ -41,7 +40,7 @@
- name: Assert that the handler configuration file is actually configured properly
vars:
- config: "{{ lookup('file', handler['file']) | from_json }}"
+ config: "{{ handler_config.content | b64decode | from_json }}"
assert:
that:
- "'udp' in config['handlers']"
diff --git a/test/integration/targets/task_ordering/meta/main.yml b/test/integration/targets/task_ordering/meta/main.yml
new file mode 100644
index 0000000000..1810d4bec9
--- /dev/null
+++ b/test/integration/targets/task_ordering/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_remote_tmp_dir
diff --git a/test/integration/targets/task_ordering/tasks/main.yml b/test/integration/targets/task_ordering/tasks/main.yml
index 281b837078..4a7828bf42 100644
--- a/test/integration/targets/task_ordering/tasks/main.yml
+++ b/test/integration/targets/task_ordering/tasks/main.yml
@@ -1,12 +1,15 @@
-- shell: mktemp
- register: temppath
+- set_fact:
+ temppath: "{{ remote_tmp_dir }}/output.txt"
+
- include: taskorder-include.yml
with_items:
- 1
- 2
- 3
-- assert:
- that: lookup('file', temppath.stdout) == "one.1.two.1.three.1.four.1.one.2.two.2.three.2.four.2.one.3.two.3.three.3.four.3."
+- slurp:
+ src: "{{ temppath }}"
+ register: tempout
-- file: path="{{temppath.stdout}}" state=absent
+- assert:
+ that: tempout.content | b64decode == "one.1.two.1.three.1.four.1.one.2.two.2.three.2.four.2.one.3.two.3.three.3.four.3."
diff --git a/test/integration/targets/task_ordering/tasks/taskorder-include.yml b/test/integration/targets/task_ordering/tasks/taskorder-include.yml
index 4e64b7e927..228e897e4d 100644
--- a/test/integration/targets/task_ordering/tasks/taskorder-include.yml
+++ b/test/integration/targets/task_ordering/tasks/taskorder-include.yml
@@ -2,9 +2,9 @@
# There have been regressions where included tasks and
# nested blocks ran out of order...
-- shell: printf one.{{ item }}. >> {{ temppath.stdout }}
+- shell: printf one.{{ item }}. >> {{ temppath }}
- block:
- - shell: printf two.{{ item }}. >> {{ temppath.stdout }}
+ - shell: printf two.{{ item }}. >> {{ temppath }}
- block:
- - shell: printf three.{{ item }}. >> {{ temppath.stdout }}
-- shell: printf four.{{ item }}. >> {{ temppath.stdout }}
+ - shell: printf three.{{ item }}. >> {{ temppath }}
+- shell: printf four.{{ item }}. >> {{ temppath }}
diff --git a/test/integration/targets/templating_settings/test_templating_settings.yml b/test/integration/targets/templating_settings/test_templating_settings.yml
index d00300bdc2..7fdd1fb85b 100644
--- a/test/integration/targets/templating_settings/test_templating_settings.yml
+++ b/test/integration/targets/templating_settings/test_templating_settings.yml
@@ -1,6 +1,6 @@
---
- name: 'Test templating in name'
- hosts: localhost
+ hosts: testhost
connection: local
vars:
a_list:
diff --git a/test/integration/targets/want_json_modules_posix/meta/main.yml b/test/integration/targets/want_json_modules_posix/meta/main.yml
new file mode 100644
index 0000000000..1810d4bec9
--- /dev/null
+++ b/test/integration/targets/want_json_modules_posix/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_remote_tmp_dir
diff --git a/test/integration/targets/want_json_modules_posix/tasks/main.yml b/test/integration/targets/want_json_modules_posix/tasks/main.yml
index 59ad0b7ca1..27e9f781b6 100644
--- a/test/integration/targets/want_json_modules_posix/tasks/main.yml
+++ b/test/integration/targets/want_json_modules_posix/tasks/main.yml
@@ -27,8 +27,13 @@
that:
- 'goodbye_ansible.msg == "Goodbye, Ansible!"'
+- name: Copy module to remote
+ copy:
+ src: "{{ role_path }}/library/helloworld.py"
+ dest: "{{ remote_tmp_dir }}/helloworld.py"
+
- name: Execute module directly
- command: '{{ ansible_python_interpreter|default(ansible_playbook_python) }} {{ role_path }}/library/helloworld.py'
+ command: '{{ ansible_python_interpreter|default(ansible_playbook_python) }} {{ remote_tmp_dir }}/helloworld.py'
register: direct
ignore_errors: true