Ansible actually advises against resorting to utilizing shell commands because they don't maintain state. Ansible has no visibility with shell commands. It's best to:
find a module in Ansible
look at Ansible-galaxy for a collection to see if someone else wrote a module
potentially write a module
IF NEED BE, utilize the command line.
the command line makes it rather convenient, but you lose a lot of the core functionalities of Ansible.
Thanks for the comment, I am aware that Ansible is against use of ‘shell’ & ‘command’ and updated the post. The point is more at the fact that some modules are complex and who ever maintains the code and uses them in a Task in the future might not be as knowledgeable and understand it if it needs changing.
It is impossible to cover everything with Ansible. In many cases I have to use shell commands for deployments. One example is IBM WebSphere deployment.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"3. Don’t be afraid to use ‘shell’ or ‘command’"
Ansible actually advises against resorting to utilizing shell commands because they don't maintain state. Ansible has no visibility with shell commands. It's best to:
the command line makes it rather convenient, but you lose a lot of the core functionalities of Ansible.
Thanks for the comment, I am aware that Ansible is against use of ‘shell’ & ‘command’ and updated the post. The point is more at the fact that some modules are complex and who ever maintains the code and uses them in a Task in the future might not be as knowledgeable and understand it if it needs changing.
It is impossible to cover everything with Ansible. In many cases I have to use shell commands for deployments. One example is IBM WebSphere deployment.