New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command module docs: args vs argv #49907
Conversation
The test
|
args: | ||
chdir: somedir/ | ||
creates: /path/to/database | ||
|
||
- name: use argv to send the command as a list. Be sure to leave command empty | ||
- name: Use 'argv' with 'args' to send a command as a list - be sure to leave 'command' empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually a better way would be command: argv=['echo', 'testing']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or even
command:
argv:
- echo
- testing
bringing args into the mix is just confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot pass 2 commands to command, argv is not for that, it is to pass the command and the arguments to the command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo 'testing' == argv: ['echo', 'testing']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, glad I asked. What is the advantage of using argv
over just passing them directly to command
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quote management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take 3 . . . how's 6fe81cd look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better, there are more cases than just whitespace, but that should be good enough
Co-Authored-By: acozine <879121+acozine@users.noreply.github.com>
* add note about 'args', update examples * Update lib/ansible/modules/commands/command.py Co-Authored-By: acozine <879121+acozine@users.noreply.github.com>
SUMMARY
Per user feedback, adds information to the
command
module documentation about the difference between theargv
parameter and theargs
task keyword. Also updates and expands examples.ISSUE TYPE
COMPONENT NAME
docs.ansible.com