np422/Op5util

Adding multiple hosts from ansible fails due to multiple outstanding create operations simultanous

np422 opened this issue · 2 comments

np422 commented

TASK [op5-add-host : Register client with Op5 monitoring server] *************************************************************************************************
fatal: [epr-int-bpm-a -> localhost]: FAILED! => {"changed": true, "cmd": "op5util -u int-appAnsibleOp5 -p ZsdJCc6AvhDRvXUa6w9L -m 10.30.20.21 add -g conextrade-windows-SOE-base epr-int-bpm-a", "delta": "0:00:01.209163", "end": "2017-08-28 15:41:24.824721", "failed": true, "rc": 1, "start": "2017-08-28 15:41:23.615558", "stderr": "error: Response code: 500, Message: {"error":"Export failed","full_error":{"type":"save in progress"}}", "stderr_lines": ["error: Response code: 500, Message: {"error":"Export failed","full_error":{"type":"save in progress"}}"], "stdout": "New host created\nError, Response code: 500, Message: {"error":"Export failed","full_error":{"type":"save in progress"}}", "stdout_lines": ["New host created", "Error, Response code: 500, Message: {"error":"Export failed","full_error":{"type":"save in progress"}}"]}
changed: [epr-int-proc-a -> localhost]

jag körde två host:ar på en gång
ops@epr-int-adm:~/ansible-epr-inf$ ansible-playbook -i inventories/int/inventory.int playbooks/soe-windows.yml -l epr-int-proc-a,epr-int-bpm-a

np422 commented

A --no-commit switch to the add commands and a commit command will probably solve this issue.

Could then be fixed in ansible with:

register: commit op5

And a handler:

- name: commit op5
    shell: op5util -u {{ op5User }} -p {{ op5Password }} -m {{ op5Server }} add -g {{ op5Hostgroups | default([ 'linux_hosts' ])  | join(' -g ') }} {{ inventory_hostname }}
    delegate_to: localhost