tests: Name tasks

For easier grep, and easier identification in task_profiler summaries.
pull/964/head
Alex Willmer 2 years ago
parent 2e8bf73877
commit 526422b74b

@ -1,12 +1,14 @@
- name: bench/loop-20-templates.yml - name: bench/loop-20-templates.yml
hosts: all hosts: all
tasks: tasks:
- file: - name: Create loop templates dir
file:
dest: /tmp/templates dest: /tmp/templates
state: "{{item}}" state: "{{item}}"
with_items: ["absent", "directory"] with_items: ["absent", "directory"]
- copy: - name: Copy loop files
copy:
dest: /tmp/templates/{{item}} dest: /tmp/templates/{{item}}
mode: 0755 mode: 0755
content: content:

@ -3,21 +3,22 @@
- name: integration/action/copy.yml - name: integration/action/copy.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- copy: - name: Create tiny file
copy:
dest: /tmp/copy-tiny-file dest: /tmp/copy-tiny-file
content: content:
this is a tiny file. this is a tiny file.
delegate_to: localhost delegate_to: localhost
- copy: - name: Create large file
copy:
dest: /tmp/copy-large-file dest: /tmp/copy-large-file
# Must be larger than Connection.SMALL_SIZE_LIMIT. # Must be larger than Connection.SMALL_SIZE_LIMIT.
content: "{% for x in range(200000) %}x{% endfor %}" content: "{% for x in range(200000) %}x{% endfor %}"
delegate_to: localhost delegate_to: localhost
# end of making files - name: Cleanup copied files
file:
- file:
state: absent state: absent
path: "{{item}}" path: "{{item}}"
with_items: with_items:
@ -26,28 +27,31 @@
- /tmp/copy-tiny-inline-file.out - /tmp/copy-tiny-inline-file.out
- /tmp/copy-large-inline-file.out - /tmp/copy-large-inline-file.out
# end of cleaning out files - name: Copy large file
copy:
- copy:
dest: /tmp/copy-large-file.out dest: /tmp/copy-large-file.out
src: /tmp/copy-large-file src: /tmp/copy-large-file
- copy: - name: Copy tiny file
copy:
dest: /tmp/copy-tiny-file.out dest: /tmp/copy-tiny-file.out
src: /tmp/copy-tiny-file src: /tmp/copy-tiny-file
- copy: - name: Copy tiny inline file
copy:
dest: /tmp/copy-tiny-inline-file.out dest: /tmp/copy-tiny-inline-file.out
content: "tiny inline content" content: "tiny inline content"
- copy: - name: Copy large inline file
copy:
dest: /tmp/copy-large-inline-file.out dest: /tmp/copy-large-inline-file.out
content: | content: |
{% for x in range(200000) %}y{% endfor %} {% for x in range(200000) %}y{% endfor %}
# stat results # stat results
- stat: - name: Stat copied files
stat:
path: "{{item}}" path: "{{item}}"
with_items: with_items:
- /tmp/copy-tiny-file.out - /tmp/copy-tiny-file.out
@ -64,7 +68,8 @@
- stat.results[3].stat.checksum == "d675f47e467eae19e49032a2cc39118e12a6ee72" - stat.results[3].stat.checksum == "d675f47e467eae19e49032a2cc39118e12a6ee72"
fail_msg: stat={{stat}} fail_msg: stat={{stat}}
- file: - name: Cleanup files
file:
state: absent state: absent
path: "{{item}}" path: "{{item}}"
with_items: with_items:

@ -6,10 +6,6 @@
- name: integration/action/fixup_perms2__copy.yml - name: integration/action/fixup_perms2__copy.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
#
# copy module (no mode).
#
- name: "Copy files (no mode)" - name: "Copy files (no mode)"
copy: copy:
content: "" content: ""
@ -22,10 +18,6 @@
- out.stat.mode in ("0644", "0664") - out.stat.mode in ("0644", "0664")
fail_msg: out={{out}} fail_msg: out={{out}}
#
# copy module (explicit mode).
#
- name: "Copy files from content: arg" - name: "Copy files from content: arg"
copy: copy:
content: "" content: ""
@ -39,22 +31,20 @@
- out.stat.mode == "0400" - out.stat.mode == "0400"
fail_msg: out={{out}} fail_msg: out={{out}}
# - name: Cleanup local weird mode file
# copy module (existing disk files, no mode). file:
#
- file:
path: /tmp/weird-mode.out path: /tmp/weird-mode.out
state: absent state: absent
- name: Create local test file. - name: Create local weird mode file
delegate_to: localhost delegate_to: localhost
copy: copy:
content: "weird mode" content: "weird mode"
dest: "/tmp/weird-mode" dest: "/tmp/weird-mode"
mode: "1462" mode: "1462"
- copy: - name: Copy file with weird mode
copy:
src: "/tmp/weird-mode" src: "/tmp/weird-mode"
dest: "/tmp/weird-mode.out" dest: "/tmp/weird-mode.out"
@ -66,11 +56,8 @@
- out.stat.mode in ("0644", "0664") - out.stat.mode in ("0644", "0664")
fail_msg: out={{out}} fail_msg: out={{out}}
# - name: Copy file with weird mode, preserving mode
# copy module (existing disk files, preserve mode). copy:
#
- copy:
src: "/tmp/weird-mode" src: "/tmp/weird-mode"
dest: "/tmp/weird-mode" dest: "/tmp/weird-mode"
mode: preserve mode: preserve
@ -83,11 +70,8 @@
- out.stat.mode == "1462" - out.stat.mode == "1462"
fail_msg: out={{out}} fail_msg: out={{out}}
# - name: Copy file with weird mode, explicit mode
# copy module (existing disk files, explicit mode). copy:
#
- copy:
src: "/tmp/weird-mode" src: "/tmp/weird-mode"
dest: "/tmp/weird-mode" dest: "/tmp/weird-mode"
mode: "1461" mode: "1461"
@ -101,7 +85,8 @@
- out.stat.mode == "1461" - out.stat.mode == "1461"
fail_msg: out={{out}} fail_msg: out={{out}}
- file: - name: Cleanup
file:
state: absent state: absent
path: "{{item}}" path: "{{item}}"
with_items: with_items:

@ -2,36 +2,32 @@
- name: integration/action/remote_file_exists.yml - name: integration/action/remote_file_exists.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- name: Ensure does-not-exist doesnt
- file: file:
path: /tmp/does-not-exist path: /tmp/does-not-exist
state: absent state: absent
- action_passthrough: - action_passthrough:
method: _remote_file_exists method: _remote_file_exists
args: ['/tmp/does-not-exist'] args: ['/tmp/does-not-exist']
register: out register: out
- assert: - assert:
that: out.result == False that: out.result == False
fail_msg: out={{out}} fail_msg: out={{out}}
# --- - name: Ensure does-exist does
copy:
- copy:
dest: /tmp/does-exist dest: /tmp/does-exist
content: "I think, therefore I am" content: "I think, therefore I am"
- action_passthrough: - action_passthrough:
method: _remote_file_exists method: _remote_file_exists
args: ['/tmp/does-exist'] args: ['/tmp/does-exist']
register: out register: out
- assert: - assert:
that: out.result == True that: out.result == True
fail_msg: out={{out}} fail_msg: out={{out}}
- file: - name: Cleanup
file:
path: /tmp/does-exist path: /tmp/does-exist
state: absent state: absent
tags: tags:

@ -10,7 +10,8 @@
# return a result with a 'src' attribute pointing into that directory. # return a result with a 'src' attribute pointing into that directory.
# #
- copy: - name: Ensure remove_tmp_path_test
copy:
dest: /tmp/remove_tmp_path_test dest: /tmp/remove_tmp_path_test
content: "{{ 123123 | random }}" content: "{{ 123123 | random }}"
register: out register: out

@ -12,23 +12,27 @@
ansible_password: '' ansible_password: ''
tasks: tasks:
# must copy git file to set proper file mode. # must copy git file to set proper file mode.
- copy: - name: Copy synchronize-action-key
copy:
dest: /tmp/synchronize-action-key dest: /tmp/synchronize-action-key
src: ../../../data/docker/mitogen__has_sudo_pubkey.key src: ../../../data/docker/mitogen__has_sudo_pubkey.key
mode: u=rw,go= mode: u=rw,go=
delegate_to: localhost delegate_to: localhost
- file: - name: Cleanup sync-test
file:
path: /tmp/sync-test path: /tmp/sync-test
state: absent state: absent
delegate_to: localhost delegate_to: localhost
- file: - name: Create sync-test
file:
path: /tmp/sync-test path: /tmp/sync-test
state: directory state: directory
delegate_to: localhost delegate_to: localhost
- copy: - name: Create syn-test item
copy:
dest: /tmp/sync-test/item dest: /tmp/sync-test/item
content: "item!" content: "item!"
delegate_to: localhost delegate_to: localhost

@ -2,47 +2,45 @@
- name: integration/action/transfer_data.yml - name: integration/action/transfer_data.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- name: Cleanup transfer data
- file: file:
path: /tmp/transfer-data path: /tmp/transfer-data
state: absent state: absent
# Ensure it JSON-encodes dicts. - name: Create JSON transfer data
- action_passthrough: action_passthrough:
method: _transfer_data method: _transfer_data
kwargs: kwargs:
remote_path: /tmp/transfer-data remote_path: /tmp/transfer-data
data: { data: {
"I am JSON": true "I am JSON": true
} }
- name: Slurp JSON transfer data
- slurp: slurp:
src: /tmp/transfer-data src: /tmp/transfer-data
register: out register: out
- assert: - assert:
that: | that: |
out.content|b64decode == '{"I am JSON": true}' out.content|b64decode == '{"I am JSON": true}'
fail_msg: out={{out}} fail_msg: out={{out}}
- name: Create text transfer data
# Ensure it handles strings. action_passthrough:
- action_passthrough:
method: _transfer_data method: _transfer_data
kwargs: kwargs:
remote_path: /tmp/transfer-data remote_path: /tmp/transfer-data
data: "I am text." data: "I am text."
- name: Slurp text transfer data
- slurp: slurp:
src: /tmp/transfer-data src: /tmp/transfer-data
register: out register: out
- assert: - assert:
that: that:
out.content|b64decode == 'I am text.' out.content|b64decode == 'I am text.'
fail_msg: out={{out}} fail_msg: out={{out}}
- file: - name: Cleanup transfer data
file:
path: /tmp/transfer-data path: /tmp/transfer-data
state: absent state: absent
tags: tags:

@ -37,7 +37,8 @@
retries: 100000 retries: 100000
delay: 0 delay: 0
- slurp: - name: Slurp async busy-poll
slurp:
src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}" src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
register: result register: result

@ -4,14 +4,17 @@
hosts: test-targets hosts: test-targets
tasks: tasks:
- shell: echo hi; echo there >&2 - name: Async shell
shell: echo hi; echo there >&2
async: 100 async: 100
poll: 0 poll: 0
register: job register: job
- shell: sleep 1 - name: Sleepy shell
shell: sleep 1
- slurp: - name: Slurp async shell
slurp:
src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}" src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
register: result register: result

@ -5,7 +5,8 @@
# Start 2 duplicate jobs, verify they run concurrently. # Start 2 duplicate jobs, verify they run concurrently.
- file: - name: Cleanup semaphore file
file:
path: /tmp/flurp path: /tmp/flurp
state: absent state: absent

@ -1,19 +1,23 @@
--- ---
- shell: dd if=/dev/urandom of=/tmp/{{file_name}} bs=1024 count={{file_size}} - name: Create {{ file_name }}
shell: dd if=/dev/urandom of=/tmp/{{ file_name }} bs=1024 count={{ file_size }}
args: args:
creates: /tmp/{{file_name}} creates: /tmp/{{file_name}}
delegate_to: localhost delegate_to: localhost
- copy: - name: Copy {{ file_name }}
copy:
dest: /tmp/{{file_name}}.out dest: /tmp/{{file_name}}.out
src: /tmp/{{file_name}} src: /tmp/{{file_name}}
- stat: path=/tmp/{{file_name}} - name: Stat created {{ file_name }}
stat: path=/tmp/{{ file_name }}
register: original register: original
delegate_to: localhost delegate_to: localhost
- stat: path=/tmp/{{file_name}}.out - name: Stat copied {{ file_name }}
stat: path=/tmp/{{ file_name }}.out
register: copied register: copied
- assert: - assert:

@ -9,10 +9,13 @@
- meta: end_play - meta: end_play
when: not is_mitogen when: not is_mitogen
- delegate_to: localhost - name: Run _disconnect_during_module.yml
delegate_to: localhost
command: | command: |
ansible-playbook ansible-playbook
-i "{{MITOGEN_INVENTORY_FILE}}" {% for inv in ansible_inventory_sources %}
-i "{{ inv }}"
{% endfor %}
integration/connection/_disconnect_during_module.yml integration/connection/_disconnect_during_module.yml
args: args:
chdir: ../.. chdir: ../..

@ -13,7 +13,8 @@
custom_python_detect_environment: custom_python_detect_environment:
register: old_become_env register: old_become_env
- become: true - name: Kill ssh process
become: true
shell: | shell: |
bash -c "( sleep 3; kill -9 {{ssh_account_env.pid}}; ) & disown" bash -c "( sleep 3; kill -9 {{ssh_account_env.pid}}; ) & disown"

@ -10,7 +10,8 @@
- meta: end_play - meta: end_play
when: ansible_system != 'Linux' when: ansible_system != 'Linux'
- shell: 'cat /proc/$PPID/cmdline | tr \\0 \\n' - name: Get cmdline
shell: 'cat /proc/$PPID/cmdline | tr \\0 \\n'
register: out register: out
- debug: var=out - debug: var=out
@ -19,7 +20,8 @@
- out.stdout is match('.*python([0-9.]+)?\(mitogen:[a-z]+@[^:]+:[0-9]+\)') - out.stdout is match('.*python([0-9.]+)?\(mitogen:[a-z]+@[^:]+:[0-9]+\)')
fail_msg: out={{out}} fail_msg: out={{out}}
- shell: 'cat /proc/$PPID/cmdline | tr \\0 \\n' - name: Get cmdline, with mitogen_mask_remote_name
shell: 'cat /proc/$PPID/cmdline | tr \\0 \\n'
register: out register: out
vars: vars:
mitogen_mask_remote_name: true mitogen_mask_remote_name: true

@ -15,12 +15,14 @@
- ansible_facts.virtualization_type == "docker" - ansible_facts.virtualization_type == "docker"
- ansible_facts.python.version_info[:2] >= [2, 5] - ansible_facts.python.version_info[:2] >= [2, 5]
- shell: cp /etc/resolv.conf /tmp/resolv.conf - name: Backup resolv.conf
shell: cp /etc/resolv.conf /tmp/resolv.conf
when: when:
- ansible_facts.virtualization_type == "docker" - ansible_facts.virtualization_type == "docker"
- ansible_facts.python.version_info[:2] >= [2, 5] - ansible_facts.python.version_info[:2] >= [2, 5]
- shell: echo > /etc/resolv.conf - name: Truncate resolv.conf
shell: echo > /etc/resolv.conf
when: when:
- ansible_facts.virtualization_type == "docker" - ansible_facts.virtualization_type == "docker"
- ansible_facts.python.version_info[:2] >= [2, 5] - ansible_facts.python.version_info[:2] >= [2, 5]
@ -33,7 +35,8 @@
- ansible_facts.virtualization_type == "docker" - ansible_facts.virtualization_type == "docker"
- ansible_facts.python.version_info[:2] >= [2, 5] - ansible_facts.python.version_info[:2] >= [2, 5]
- shell: cat /tmp/resolv.conf > /etc/resolv.conf - name: Restore resolv.conf
shell: cat /tmp/resolv.conf > /etc/resolv.conf
when: when:
- ansible_facts.virtualization_type == "docker" - ansible_facts.virtualization_type == "docker"
- ansible_facts.python.version_info[:2] >= [2, 5] - ansible_facts.python.version_info[:2] >= [2, 5]

@ -7,7 +7,8 @@
- name: integration/local/cwd_preserved.yml - name: integration/local/cwd_preserved.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- connection: local - name: Get local cwd
connection: local
command: pwd command: pwd
register: pwd register: pwd

@ -3,7 +3,8 @@
- name: integration/playbook_semantics/environment.yml - name: integration/playbook_semantics/environment.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- shell: echo $SOME_ENV - name: Echo $SOME_ENV
shell: echo $SOME_ENV
environment: environment:
SOME_ENV: 123 SOME_ENV: 123
register: result register: result

@ -1,18 +1,21 @@
# /etc/environment # /etc/environment
- file: - name: Remove /etc/environment
file:
path: /etc/environment path: /etc/environment
state: absent state: absent
become: true become: true
- shell: echo $MAGIC_ETC_ENV - name: Check MAGIC_ETC_ENV without
shell: echo $MAGIC_ETC_ENV
register: echo register: echo
- assert: - assert:
that: echo.stdout == "" that: echo.stdout == ""
fail_msg: echo={{echo}} fail_msg: echo={{echo}}
- copy: - name: Create /etc/environment
copy:
dest: /etc/environment dest: /etc/environment
content: | content: |
MAGIC_ETC_ENV=555 MAGIC_ETC_ENV=555
@ -23,14 +26,16 @@
#- mitogen_shutdown_all: #- mitogen_shutdown_all:
#when: not is_mitogen #when: not is_mitogen
- shell: echo $MAGIC_ETC_ENV - name: Check MAGIC_ETC_ENV with
shell: echo $MAGIC_ETC_ENV
register: echo register: echo
- assert: - assert:
that: echo.stdout == "555" that: echo.stdout == "555"
fail_msg: echo={{echo}} fail_msg: echo={{echo}}
- file: - name: Cleanup /etc/environment
file:
path: /etc/environment path: /etc/environment
state: absent state: absent
become: true become: true
@ -40,7 +45,8 @@
- mitogen_shutdown_all: - mitogen_shutdown_all:
when: not is_mitogen when: not is_mitogen
- shell: echo $MAGIC_ETC_ENV - name: Check MAGIC_ETC_ENV without+shutdown
shell: echo $MAGIC_ETC_ENV
register: echo register: echo
- assert: - assert:

@ -1,6 +1,7 @@
# ~/.pam_environment # ~/.pam_environment
- file: - name: Remove pam_environment
file:
path: ~/.pam_environment path: ~/.pam_environment
state: absent state: absent
@ -11,7 +12,8 @@
that: echo.stdout == "" that: echo.stdout == ""
fail_msg: echo={{echo}} fail_msg: echo={{echo}}
- copy: - name: Copy pam_environment
copy:
dest: ~/.pam_environment dest: ~/.pam_environment
content: | content: |
MAGIC_PAM_ENV=321 MAGIC_PAM_ENV=321
@ -23,7 +25,8 @@
that: echo.stdout == "321" that: echo.stdout == "321"
fail_msg: echo={{echo}} fail_msg: echo={{echo}}
- file: - name: Cleanup pam_environment
file:
path: ~/.pam_environment path: ~/.pam_environment
state: absent state: absent

@ -9,20 +9,16 @@
vars: vars:
path: /tmp/atexit-should-delete-this path: /tmp/atexit-should-delete-this
tasks: tasks:
- name: Verify a run with a healthy atexit handler
# custom_python_run_script:
# Verify a run with a healthy atexit handler. Broken handlers cause an
# exception to be raised.
#
- custom_python_run_script:
script: | script: |
import atexit, os, shutil import atexit, os, shutil
path = '{{path}}' path = '{{path}}'
os.mkdir(path, int('777', 8)) os.mkdir(path, int('777', 8))
atexit.register(shutil.rmtree, path) atexit.register(shutil.rmtree, path)
- stat: - name: Stat atexit file
stat:
path: "{{path}}" path: "{{path}}"
register: out register: out

@ -3,7 +3,8 @@
hosts: test-targets hosts: test-targets
gather_facts: true gather_facts: true
tasks: tasks:
- command: hostname - name: Run hostname
command: hostname
with_sequence: start=1 end={{end|default(1)}} with_sequence: start=1 end={{end|default(1)}}
register: out register: out

@ -1,51 +1,38 @@
# issue #309: ensure process environment is restored after a module runs. # issue #309: ensure process environment is restored after a module runs.
- name: integration/runner/environment_isolation.yml - name: integration/runner/environment_isolation.yml
hosts: test-targets hosts: test-targets
gather_facts: true gather_facts: true
tasks: tasks:
- name: Verify custom env setting is cleared, control
# --- custom_python_detect_environment:
# Verify custom env setting is cleared out.
# ---
# Verify sane state first.
- custom_python_detect_environment:
register: out register: out
- assert: - assert:
that: not out.env.evil_key is defined that: not out.env.evil_key is defined
fail_msg: out={{out}} fail_msg: out={{out}}
- name: Verify custom env setting is cleared, with evil_key
- shell: echo 'hi' shell: echo 'hi'
environment: environment:
evil_key: evil evil_key: evil
- name: Verify custom env setting is cleared, without evil_key
# Verify environment was cleaned up. custom_python_detect_environment:
- custom_python_detect_environment:
register: out register: out
- assert: - assert:
that: not out.env.evil_key is defined that: not out.env.evil_key is defined
fail_msg: out={{out}} fail_msg: out={{out}}
- name: Verify non-explicit module env mutations are cleared, control
# --- custom_python_detect_environment:
# Verify non-explicit module env mutations are cleared out.
# ---
# Verify sane state first.
- custom_python_detect_environment:
register: out register: out
- assert: - assert:
that: not out.env.evil_key is defined that: not out.env.evil_key is defined
fail_msg: out={{out}} fail_msg: out={{out}}
- name: Verify non-explicit module env mutations are cleared, mutate evil_key
- custom_python_modify_environ: custom_python_modify_environ:
key: evil_key key: evil_key
val: evil val: evil
- name: Verify non-explicit module env mutations are cleared, without evil_key
# Verify environment was cleaned up. custom_python_detect_environment:
- custom_python_detect_environment:
register: out register: out
- assert: - assert:
that: not out.env.evil_key is defined that: not out.env.evil_key is defined

@ -3,7 +3,8 @@
hosts: test-targets[0] hosts: test-targets[0]
connection: local connection: local
tasks: tasks:
- connection: local - name: Run missing_module
connection: local
command: | command: |
ansible -vvv ansible -vvv
-i "{{MITOGEN_INVENTORY_FILE}}" -i "{{MITOGEN_INVENTORY_FILE}}"

@ -3,7 +3,8 @@
- name: integration/ssh/timeouts.yml - name: integration/ssh/timeouts.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- connection: local - name: Cause Ansible connection timeout
connection: local
command: | command: |
ansible -vvv ansible -vvv
-i "{{MITOGEN_INVENTORY_FILE}}" -i "{{MITOGEN_INVENTORY_FILE}}"
@ -16,7 +17,8 @@
ignore_errors: true ignore_errors: true
when: is_mitogen when: is_mitogen
- assert: - name: Verify connection timeout occurred
assert:
that: that:
- | - |
'"changed": false' in out.stdout '"changed": false' in out.stdout

@ -13,7 +13,8 @@
- include: _end_play_if_not_sudo_linux.yml - include: _end_play_if_not_sudo_linux.yml
- command: | - name: Run stub-lxc-info.py
command: |
sudo -nE "{{lookup('env', 'VIRTUAL_ENV')}}/bin/ansible" sudo -nE "{{lookup('env', 'VIRTUAL_ENV')}}/bin/ansible"
-i localhost, -i localhost,
-c setns -c setns

@ -13,7 +13,8 @@
- include: _end_play_if_not_sudo_linux.yml - include: _end_play_if_not_sudo_linux.yml
- command: | - name: Run ansible stub-lxc.py
command: |
sudo -nE "{{lookup('env', 'VIRTUAL_ENV')}}/bin/ansible" sudo -nE "{{lookup('env', 'VIRTUAL_ENV')}}/bin/ansible"
-i localhost, -i localhost,
-c setns -c setns

@ -9,8 +9,8 @@
when: when:
- ansible_version.full is version('2.6', '<', strict=True) - ansible_version.full is version('2.6', '<', strict=True)
# Copy the naughty 'ansible' into place. - name: Copy the naughty ansible into place
- copy: copy:
dest: "{{ansible_user_dir}}/ansible.py" dest: "{{ansible_user_dir}}/ansible.py"
src: ansible.py src: ansible.py
@ -20,15 +20,15 @@
- custom_python_detect_environment: - custom_python_detect_environment:
register: env register: env
# Verify interpreter config would actually trigger the bug. - name: Verify interpreter config would actually trigger the bug
- assert: assert:
that: that:
- env.cwd == ansible_user_dir - env.cwd == ansible_user_dir
- (not env.mitogen_loaded) or (env.python_path.count("") == 1) - (not env.mitogen_loaded) or (env.python_path.count("") == 1)
fail_msg: env={{env}} fail_msg: env={{env}}
# Run some new-style modules that 'from ansible.module_utils...' - name: Run some new-style from ansible.module_utils... modules
- stat: stat:
path: / path: /
tags: tags:
- issue_109 - issue_109

@ -17,7 +17,8 @@
- name: Delete remote file tree - name: Delete remote file tree
file: path=/tmp/filetree.out state=absent file: path=/tmp/filetree.out state=absent
- file: - name: Recreate file tree
file:
state: directory state: directory
path: /tmp/filetree.out path: /tmp/filetree.out

@ -8,7 +8,8 @@
connection: local connection: local
tasks: tasks:
- copy: - name: Create /tmp/issue_152_interpreter.sh
copy:
dest: /tmp/issue_152_interpreter.sh dest: /tmp/issue_152_interpreter.sh
mode: u+x mode: u+x
content: | content: |
@ -26,7 +27,8 @@
- out.env.CUSTOM_INTERPRETER == "1" - out.env.CUSTOM_INTERPRETER == "1"
fail_msg: out={{out}} fail_msg: out={{out}}
- file: - name: Cleanup /tmp/issue_152_interpreter.sh
file:
path: /tmp/issue_152_interpreter.sh path: /tmp/issue_152_interpreter.sh
state: absent state: absent
tags: tags:

@ -7,11 +7,12 @@
# Can't use pip module because it can't create virtualenvs, must call it # Can't use pip module because it can't create virtualenvs, must call it
# directly. # directly.
- shell: virtualenv /tmp/issue_152_virtualenv - name: Create /tmp/issue_152_virtualenv
environment: environment:
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}" https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}" no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
shell: virtualenv /tmp/issue_152_virtualenv
when: when:
- lout.python.version.full is version('2.7', '>=', strict=True) - lout.python.version.full is version('2.7', '>=', strict=True)
@ -29,7 +30,8 @@
when: when:
- lout.python.version.full is version('2.7', '>=', strict=True) - lout.python.version.full is version('2.7', '>=', strict=True)
- file: - name: Cleanup /tmp/issue_152_virtualenv
file:
path: /tmp/issue_152_virtualenv path: /tmp/issue_152_virtualenv
state: absent state: absent
when: when:

@ -2,7 +2,8 @@
hosts: test-targets hosts: test-targets
tasks: tasks:
- copy: - name: Copy files
copy:
src: /etc/{{item}} src: /etc/{{item}}
dest: /tmp/{{item}} dest: /tmp/{{item}}
mode: 0644 mode: 0644
@ -10,7 +11,8 @@
- passwd - passwd
- hosts - hosts
- file: - name: Cleanup files
file:
path: /tmp/{{item}} path: /tmp/{{item}}
state: absent state: absent
with_items: with_items:

@ -4,7 +4,12 @@
- name: regression/issue_332_ansiblemoduleerror_first_occurrence.yml - name: regression/issue_332_ansiblemoduleerror_first_occurrence.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- file: path=/usr/bin/does-not-exist mode='a-s' state=file follow=yes - name: Attempt to modify /usr/bin/does-not-exist
file:
path: /usr/bin/does-not-exist
mode: a-s
state: file
follow: true
ignore_errors: true ignore_errors: true
register: out register: out

@ -4,9 +4,16 @@
- name: regression/issue_558_unarchive_failed.yml - name: regression/issue_558_unarchive_failed.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- file: state=absent path=/tmp/foo - name: Cleanup /tmp/foo
- file: state=directory path=/tmp/foo file:
- unarchive: path: /tmp/foo
state: absent
- name: Create /tmp/foo
file:
path: /tmp/foo
state: directory
- name: Unarchive unarchive_test.tar
unarchive:
src: "{{git_basedir}}/tests/data/unarchive_test.tar" src: "{{git_basedir}}/tests/data/unarchive_test.tar"
dest: /tmp/foo dest: /tmp/foo
# garbage doesn't work with BSD tar # garbage doesn't work with BSD tar

@ -1,4 +1,4 @@
- name: regression/iss590__sys_modules_crap.yml - name: regression/issue_590__sys_modules_crap.yml
hosts: test-targets hosts: test-targets
tasks: tasks:
- meta: end_play - meta: end_play

@ -9,19 +9,23 @@
mitogen_ssh_compression: false mitogen_ssh_compression: false
tasks: tasks:
- block: - block:
- shell: | - name: Create /tmp/512mb.zero
shell: |
dd if=/dev/zero of=/tmp/512mb.zero bs=1048576 count=512; dd if=/dev/zero of=/tmp/512mb.zero bs=1048576 count=512;
chmod go= /tmp/512mb.zero chmod go= /tmp/512mb.zero
- fetch: - name: Fetch /tmp/512mb.zero
fetch:
src: /tmp/512mb.zero src: /tmp/512mb.zero
dest: /tmp/fetch-out dest: /tmp/fetch-out
- file: - name: Cleanup /tmp/512mb.zero
file:
path: /tmp/512mb.zero path: /tmp/512mb.zero
state: absent state: absent
- file: - name: Cleanup fetched file
file:
path: /tmp/fetch-out path: /tmp/fetch-out
state: absent state: absent
become: false become: false

@ -1,6 +1,8 @@
- file: - name: Delete existing /tmp/foo-<inventory_hostname>
file:
path: /tmp/foo-{{inventory_hostname}} path: /tmp/foo-{{inventory_hostname}}
state: absent state: absent
- copy: - name: Create /tmp/foo-<inventory_hostname>
copy:
dest: /tmp/foo-{{inventory_hostname}} dest: /tmp/foo-{{inventory_hostname}}
content: "{{content}}" content: "{{content}}"

Loading…
Cancel
Save