
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,796 Views
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,722 Views
You are welcome, however, keep in mind, that you might be better of migrating your script to an actual ansible module instead.
Anyway, make sure to mark my answer as a solution, if it is, so other forum users, can find it as well ;-)
Alexander


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,770 Views
Hey jonawang,
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/script_module.html
Regarding best practices, see the Notes section: "[...]It is usually preferable to write Ansible modules rather than pushing scripts. Convert your script to an Ansible module for bonus points![...]"
See also:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html
Alexander

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,734 Views
Thanks, Alexander.
Before I asked this question, I were thinkg how to use command or shell module to achieve this purpose. As you mentioned, it sounds script module is more approriate for setting up executing shell scripts at remote servers.
Regards,
Jonathan


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,723 Views
You are welcome, however, keep in mind, that you might be better of migrating your script to an actual ansible module instead.
Anyway, make sure to mark my answer as a solution, if it is, so other forum users, can find it as well ;-)
Alexander