|
| 1 | +--- |
| 2 | + |
| 3 | +-hosts:clients |
| 4 | +gather_facts:no |
| 5 | +tasks: |
| 6 | + |
| 7 | + -name:generate connstrings |
| 8 | +set_fact: |
| 9 | +connstr:"-d 'host={{item}} user=cluster port=15432 dbname=postgres'" |
| 10 | +with_items: |
| 11 | +groups['nodes'] | reverse | batch(nnodes | d(2) | int) | first |
| 12 | +register:connstrs |
| 13 | + |
| 14 | + -name:make a list |
| 15 | +set_fact: |
| 16 | +connections:"{{ connstrs.results | map(attribute='ansible_facts.connstr') | join }}" |
| 17 | + |
| 18 | + -name:copy transfers binary |
| 19 | +copy:src=transfers.linux dest=~/transfers mode=a+x |
| 20 | + |
| 21 | +-hosts:clients[0] |
| 22 | +gather_facts:no |
| 23 | +tasks: |
| 24 | + -name:fill the databases |
| 25 | +shell:"./transfers {{connections}} -f -g" |
| 26 | +register:transfers_result |
| 27 | + -debug:"var=transfers_result" |
| 28 | + |
| 29 | +-hosts:clients |
| 30 | +gather_facts:no |
| 31 | +tasks: |
| 32 | + -name:run transfers |
| 33 | +shell:"./transfers {{connections}} -s {{runkeys | d('-g -w 60 -m -o -u 10000 -r 0')}} -k {{hostvars[inventory_hostname]['offset']}}" |
| 34 | +register:transfers_result |
| 35 | + -debug:var=transfers_result |
| 36 | + |