You have to use egrep to get real regexes

How is this still the case in 2016?

Change-Id: I3de8832bb1b86fd822f10ce35b695f10f4f8a652
This commit is contained in:
Monty Taylor 2016-01-18 18:29:56 -05:00
parent 9367e61fd9
commit 45efc4afc9

View File

@ -25,7 +25,7 @@ for line in $(</etc/ansible/groups.txt); do
name=$(echo $line | cut -f1 -d' ')
pattern=$(echo $line | cut -f2 -d' ')
echo "[${name}]" >> $outfile
ansible "~${pattern}" --list-hosts | grep -v '^ +hosts \([0-9]+\):' >> $outfile
ansible "~${pattern}" --list-hosts | egrep -v '^ +hosts \([0-9]+\):' >> $outfile
done
cp $outfile /etc/ansible/hosts/generated-groups