Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-13 Thread John Harmon
In case anybody else is looking to do the same thing, here is my BASH solution: - name: Sanitize Virtual Interface(s) shell: | file="/var/ftp/vm.cfg" total=$( grep ^vif "$file" | grep -o mac | wc -l ) for i in `seq 1 $total`; do my_random=$(xxd -l 1 -p

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-12 Thread Thad Guidry
OK, sounds good, yes a script should do the trick. You can even write it in Python and later contribute a nice Ansible module :) :) Here's inspiration: https://docs.ansible.com/ansible/latest/modules/list_of_cloud_modules.html#vmware

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-12 Thread John Harmon
On Saturday, November 10, 2018 at 9:48:17 AM UTC-7, Thad Guidry wrote: > > John, > > What problem are you actually trying to solve ? Generating random numbers > especially around MAC certainly can get you in trouble. Are you trying to > generate a Pool and apply something 1 time from that

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-12 Thread John Harmon
On Saturday, November 10, 2018 at 2:07:52 AM UTC-7, Kai Stian Olstad wrote: > > On Wednesday, 7 November 2018 17:36:43 CET John Harmon wrote: > > Desired (As shown above, keep first three octets of mac, change 4th to > AA, > > and the last two are random numbers between 10-99): > > vif =

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-10 Thread Thad Guidry
John, What problem are you actually trying to solve ? Generating random numbers especially around MAC certainly can get you in trouble. Are you trying to generate a Pool and apply something 1 time from that Pool ? Explain the use case, and we could help a lot more. -Thad On Sat, Nov 10, 2018

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-10 Thread Kai Stian Olstad
On Wednesday, 7 November 2018 17:36:43 CET John Harmon wrote: > Desired (As shown above, keep first three octets of mac, change 4th to AA, > and the last two are random numbers between 10-99): > vif = ['mac=00:21:f6:AA:21:56,bridge=101498d8ff', > 'mac=00:21:f6:AA:17:27,bridge=1017dc5841'] > >