3 ms·
A configuration management system may have you write e.g. YAML with Jinja2 so that you don't reinvent the idempotent wheel. It's really easy to write dangerous
by westurner 6y ago
A configuration management system may have you write e.g. YAML with Jinja2 so that you don't reinvent the idempotent wheel.
It's really easy to write dangerous shell scripts ("${@}" vs ${@} for example) and also easy to write dangerous Python scripts (cmd="{}; {}").
Sarge is one way to use subprocess in Python. https://sarge.readthedocs.io/en/latest/ https://sarge.readthedocs.io/en/latest/
If you're doing installation and configuration, the most team-maintainable thing is to avoid custom code and work with a configuration management system test runner.
When you "A shell script will be fine, all I have to do is [...]" and then you realize that you need a portable POSIX shell script and to be merged it must have actual automated tests of things that are supposed to run as root - now in a fresh vm/container for testing - and manual verification of `set +xev` output isn't an automated assertion.
- westurner 6y ago> avoid custom code and work with a configuration management system test runner ansible-molecule is a test runner for Ansible playbooks that can create VMs or containers on local or remote resources. You can definitely just call shell scripts from Ansible, but the (parallel) script output is only logged after the script returns a return code unless you pipe the script output somewhere and tail that . > manual verification of `set +xev` output isn't an automated assertion. From "Bash Error Handling" https://news.ycombinator.com/item?id=24745833 https://news.ycombinator.com/item?id=24745833 : you can display the line number in `set -x` output by setting $PS4: export PS4='+(${BASH_SOURCE}:${LINENO}) ' set -x But that's no substitute for automated tests and a test runner that produces e.g. TAP output from test runner results: http://testanything.org/producers.html#shell http://testanything.org/producers.html#shell