Update changelogs/fragments/102_module_at_add_chdir_option.yml

Co-authored-by: quidame <quidame@poivron.org>
This commit is contained in:
Baptiste Mille-Mathias 2021-05-30 18:18:57 +02:00 committed by Abhijeet Kasurde
parent ceaee68c85
commit 17f8c02361
3 changed files with 21 additions and 11 deletions

View file

@ -1,2 +1,2 @@
minor_changes: minor_changes:
- module at - add option ``chdir`` to permit to launch the at command from a specific directory (https://github.com/ansible-collections/ansible.posix/pull/102). - at - add option ``chdir`` to permit to launch the ``at`` command from a specific directory (https://github.com/ansible-collections/ansible.posix/issues/13).

View file

@ -19,8 +19,8 @@ version_added: "1.0.0"
options: options:
chdir: chdir:
description: description:
- An optional location from where to run the command C(at). Useful for intance - An optional location from where to run the command C(at).
when running a playbook using ansible-pull with C(purge) option. - Useful for intance when running a playbook using ansible-pull with C(purge) option.
type: path type: path
version_added: 1.3.0 version_added: 1.3.0
command: command:
@ -194,8 +194,7 @@ def main():
result['count'] = count result['count'] = count
result['units'] = units result['units'] = units
add_job(module, result, at_cmd, count, units, command, script_file, add_job(module, result, at_cmd, count, units, command, script_file, chdir=chdir)
chdir=chdir)
module.exit_json(**result) module.exit_json(**result)

View file

@ -61,7 +61,7 @@
- 'at_test0.state is defined' - 'at_test0.state is defined'
- 'at_test0.units is defined' - 'at_test0.units is defined'
- name: add a at useless command - name: Add a useless command using at
at: at:
command: /bin/logger 'AT task ran from Ansible' command: /bin/logger 'AT task ran from Ansible'
count: 1 count: 1
@ -71,11 +71,11 @@
- debug: var=at_add - debug: var=at_add
- name: pause, giving the time the at runs once - name: Wait for at to run the previous command
pause: pause:
minutes: 1 minutes: 1
- name: add a at useless command - name: Add a useless command
at: at:
command: /bin/logger 'AT task ran from Ansible' command: /bin/logger 'AT task ran from Ansible'
count: 1 count: 1
@ -83,11 +83,16 @@
unique: true unique: true
state: absent state: absent
register: at_removal register: at_removal
ignore_errors: true
- debug: var=at_removal - debug: var=at_removal
- name: create an at command with chdir with valid value - name: Validate results
assert:
that:
- at_add is changed
- at_removal is changed
- name: Create an at command with chdir with valid value
at: at:
command: /bin/logger 'AT task ran from Ansible with chdir' command: /bin/logger 'AT task ran from Ansible with chdir'
count: 1 count: 1
@ -96,7 +101,7 @@
register: at_chdir_valid register: at_chdir_valid
- debug: var=at_chdir_valid - debug: var=at_chdir_valid
- name: create an at command with chdir with invalid value - name: Create an at command with chdir with invalid value
at: at:
command: /bin/logger 'AT task ran from Ansible with chdir' command: /bin/logger 'AT task ran from Ansible with chdir'
count: 1 count: 1
@ -106,3 +111,9 @@
ignore_errors: true ignore_errors: true
- debug: var=at_chdir_invalid - debug: var=at_chdir_invalid
- name: Validate results
assert:
that:
- at_chdir_valid is changed
- not at_chdir_valid is changed