np422 / Op5util

Utility to do common op5 monitoring server administration tasks from the command line, latest release is 0.1.8
https://rubygems.org/gems/op5util
MIT License
6 stars 0 forks source link

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

Open np422 opened 7 years ago

np422 commented 7 years ago

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 7 years ago

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

maglub commented 6 years ago

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