Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | # Prints commands to create user .yml with linux/openssh pillar | ||||
4 | # $1 - csv file with full name; email; id; ssh pub key | ||||
5 | |||||
6 | awk -F';' '\ | ||||
7 | { fname=$1;gsub(/\s+/,_,$1); sname=tolower(substr($1,1,1)substr($1,index(fname," "))); split($4, key ," "); } | ||||
8 | { print "FNAME=\\\""fname"\\\"", "SNAME=\\\""sname"\\\"", "KEY=\\\""key[1]" "key[2]"\\\"","EMAIL="$2" envsubst < team.template > "tolower($1)".yml" }'\ | ||||
9 | < $1 | xargs -n11 echo |