DEV Community

Discussion on: Tips for using Ansible

Collapse
 
schnipdip profile image
schnipdip

"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:

  • 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.

Collapse
 
tomowatt profile image
Tom Watt • Edited

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.

Collapse
 
ramnikov profile image
Andrey Ramnikov

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.