Last active
August 29, 2015 14:17
-
-
Save ghoneycutt/03102b7f95f09bf45af9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# | |
# License: GPLv2 | |
# | |
# Quick and dirty shell script for taking a file with one package per line and | |
# turning that into valid YAML to use in conjunction with puppet-module-types | |
# and Hiera. | |
# | |
# Given a file, 'package_list' with contents | |
# | |
# foo | |
# bar | |
# baz | |
# | |
# The following output is generated | |
# | |
# types::packages: | |
# 'foo': | |
# ensure: 'present' | |
# 'bar': | |
# ensure: 'present' | |
# 'baz': | |
# ensure: 'present' | |
# | |
if [ $# -ne 1 ]; then | |
echo "Must supply one argument - a file with one package per line" | |
exit 1 | |
fi | |
echo -e "types::packages:" | |
for package in $(cat $1) | |
do | |
echo -e " '${package}':\n ensure: 'present'" | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment