yammering
yammering

Reputation: 146

Ansible script module 'creates:' not generating file

I am running the script module in a role on a windows machine.

I am attempting to use the "args: creates:" parameter. The script runs but the file that 'creates' is supposed to generate never gets created. When I run the playbook again the script runs a second time.

I've tried changing the file name and directory, I've tried using the environment variable to designate HOME as the root directory but the file never gets generated.

---
- name: run script
  script: ./files/script.ps1 PARAMETERS
  args:
    creates: script_has_been_run.txt

Upvotes: 0

Views: 730

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 67959

Q: "The script runs but the file that 'creates' is supposed to generate never gets created."

A: It's the responsibility of the script to create the file. Quoting from script

creates: A filename on the remote node, when it already exists, this step will not be run.

The purpose of the parameter creates is to make the module idempotent, i.e run the script if the file does not exist. Once the file has been created, by the script, the task will be skipped.

Upvotes: 1

Related Questions