Last active
August 29, 2015 14:09
-
-
Save elvisciotti/8dacf247312190c64287 to your computer and use it in GitHub Desktop.
Puppet task to add a line into a file if not existing and not commented out (prefixed with "#")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add STRING-XXXXXXX to FILE-YYYYYY | |
# if commented out, it gets re-added | |
exec { "[task name]": | |
command => '/bin/echo "STRING-XXXXXXX" >> FILE-YYYYYY', | |
unless => '/bin/grep -E "^STRING-XXXXXXX$" FILE-YYYYYY' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for /etc/hosts: http://www.puppetcookbook.com/posts/adding-a-host-entry.html