Validating Config Files in Puppet and Ansible
While doing some experiments with Ansible I came across a little snippet of code that I really liked -
- name: manage /etc/sudoers template: src=sudoers.j2 dest=/etc/sudoers validate='visudo -cf %s' Ansible runs the command specified by ‘validate’ against the expanded templates contents and only copies the newly generated file in to place if it’s valid. This is a wonderful feature that will help stop you from making some potentially time consuming errors.
Read on →