blob: 2b55e9e07fee30d704be16e6701fdd16cec1c2df [file] [log] [blame]
Ales Komarek1b373112017-08-08 08:48:56 +02001#!/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
6awk -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