You can’t normally run in parallel with a loop, they are run sequentially. You can hack around it by running with async and poll 0 and then poll that status but it isn’t a perfect “run all items in list in parallel” that you are looking for.
Won’t work as you are trying to get key 0, 1, 2, 3, etc of the svc.results var when it is actually a list. You want something like 'svc.results[item].exists' instead. What this does is get's the list entry of item, bare in mind that lists are a 0 based index, so the first entry is 0, 2nd is 1 and so on. You might have to do something like 'svc.results[item - 1].exists' if you want to match up the entry to your agent index starting at 1.
I haven't used with_sequence a lot so can't tell if that syntax is ok, apart from that what you have seems ok at a brief glance but having the output from a run that failed would help us narrow down your issue.
TASK [output] **************************************************************************************************************************************************************************************************************************************************************************************
task path: /ansible/scripts/playbooks/qb-agents-fw-multiple.yml:20
ok: [hasgappqba1102.DOMAIN] => (item=None) => {
“qb_svc.results[item].exists”: “VARIABLE IS NOT DEFINED!: ‘list object’ has no attribute u’1’”
}
ok: [hasgappqba1102.DOMAIN] => (item=None) => {
“qb_svc.results[item].exists”: “VARIABLE IS NOT DEFINED!: ‘list object’ has no attribute u’2’”
}
TASK [install Agent ‘{{ item }}’] ******************************************************************************************************************************************************************************************************************************************************************
task path: /ansible/scripts/playbooks/qb-agents-fw-multiple.yml:25
fatal: [hasgappqba1102.DOMAIN]: FAILED! => {
“msg”: “The conditional check ‘qb_svc.results[item].exists’ failed. The error was: error while evaluating conditional (qb_svc.results[item].exists): ‘list object’ has no attribute u’1’\n\nThe error appears to have been in ‘/ansible/scripts/playbooks/qb-agents-fw-multiple.yml’: line 25, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: install Agent ‘{{ item }}’\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - "{{ foo }}"\n”
}
to retry, use: --limit @/ansible/scripts/playbooks/qb-agents-fw-multiple.retry
`