Skip to content

Instantly share code, notes, and snippets.

@lukeorland
Created December 2, 2014 17:11
Show Gist options
  • Save lukeorland/1feaef1be7640ad8fa65 to your computer and use it in GitHub Desktop.
Save lukeorland/1feaef1be7640ad8fa65 to your computer and use it in GitHub Desktop.
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: Remove file 0
file: name=/tmp/mycoolfile state=absent
- name: Touch file with async, dictionary syntax
command: touch mycoolfile
args:
chdir: /tmp
- name: File should exist 1
file: name=/tmp/mycoolfile state=absent
register: remove_file
failed_when: not remove_file.changed
- name: "Touch file with async, = syntax"
command: touch mycoolfile chdir=/tmp
async: 3600
poll: 5
- name: File should exist 2
file: name=/tmp/mycoolfile state=absent
register: remove_file
failed_when: not remove_file.changed
- name: Touch file with async, dictionary syntax
command: touch mycoolfile
args:
chdir: /tmp
async: 3600
poll: 5
- name: File should exist 3
file: name=/tmp/mycoolfile state=absent
register: remove_file
failed_when: not remove_file.changed
localhost
@lukeorland
Copy link
Author

Execute:

ansible-playbook ansible_chdir_async_bug.yml --connection=local -i hosts

The task Touch file with async, dictionary syntax tries to touch a file in / instead of in /tmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment