Added 'validate' feature to copy and template modules, now you can add a check to force copy to fail if the check fails.

had to add entry in file for it to accept as a option even though file itself ignores it.
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
Brian Coca
2013-03-26 23:12:56 -04:00
parent 95f30f0def
commit a0422bd534
3 changed files with 24 additions and 2 deletions

View File

@@ -35,6 +35,12 @@ options:
required: false
choices: [ "yes", "no" ]
default: "no"
validate:
description:
- validation to run before copying into place
required: false
default: ""
version_added: "1.2"
others:
description:
- all arguments accepted by the M(file) module also work here
@@ -42,6 +48,8 @@ options:
examples:
- code: "template: src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode=0644"
description: "Example from Ansible Playbooks"
- code: "action: temlpate src=/mine/sudoers dest=/etc/sudoers validate='visudo -c %s'"
description: "Copy a new C(sudoers) file into place, after passing validation with visudo"
notes:
- Since Ansible version 0.9, templates are loaded with C(trim_blocks=True).
- 'You can override jinja2 settings by adding a special header to template file.