Skip to content

Instantly share code, notes, and snippets.

@Seegras
Created March 23, 2015 13:15
Show Gist options
  • Save Seegras/59b05a3dc47b6344cb17 to your computer and use it in GitHub Desktop.
Save Seegras/59b05a3dc47b6344cb17 to your computer and use it in GitHub Desktop.
Creates a hiera yaml file for use with puppet-icinga2 from icinga1 host objects
for i in *.cfg; do egrep 'host_name|address' $i | sed 's/host_name/display_name:/' | sed 's/address/ipv4_address:/' | sed -s 's/\t/ /g' | sed -s 's/\s/ /g' | tr "\n" " " | awk '{ print " '\''"$2"'\'':\n " $1 " '\''" $2 "'\''\n " $3 "'\''" $4 "'\''\n groups:\n - '\''linux'\''\n - '\''wualaserver'\''\n target_file_name: '\''"$2".conf'\''" }' ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment