hello Gauthreaux,

Does your problem has been resolved?

Can you help me to find service_request(ritm) variables using 
snow_record_find module.

Regards,
GG

On Thursday, April 11, 2019 at 11:22:40 PM UTC+5:30, Beau Gauthreaux wrote:
>
> Anybody else have ideas about this?
>
> On Tuesday, March 19, 2019 at 3:32:16 PM UTC-4, Beau Gauthreaux wrote:
>>
>> I'm trying to gather change record information from ServiceNow. 
>> Specifically I would like to query against a hostname and find if that 
>> server has change ticket open. I came across both of these modules for 
>> Ansible. I have had little success getting them to function properly. I'm 
>> hoping my syntax is bad or I'm doing something dumb. Here are my playbooks.
>>
>>    - hosts: localhost
>>   connection: local
>>   gather_facts: no
>>   ignore_errors: True
>>   tasks:
>>   - name: Grab a user record
>>     snow_record:
>>       username: testuser
>>       password: somepass
>>       instance: myinstance
>>       state: present
>>       number: CHG9999
>>       table: change_request
>>       lookup_field: cmdb_ci.name=someservername
>>
>> For snow_record_find:
>>
>> - hosts: mytest
>>   tasks:
>>   - name: Grab a user record
>>     snow_record_find:
>>       username: testuser
>>       password: somepass
>>       instance: someinstance
>>       #state: present
>>       #number: null??
>>       table: change_request
>>       query:
>>         AND:
>>           equals:
>>             active: "True"
>>             type: "standard"
>>             u_change_stage: "80"
>>           contains:
>>             u_template: "MY-Template"
>>
>> There does not seem to be many examples or documents on how to use these 
>> modules. I'm open to using something different as long as it can be done 
>> via bash, Python, Ansible or some other command line utility that runs on 
>> Linux. Also I grabbed the snow_record_find module from 
>> https://github.com/garbled1/ansible_modules If you want to try it 
>> yourself.
>>
>> Error output for snow_record:
>>
>>     The full traceback is:
>>     Traceback (most recent call last):
>>       File 
>> "/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py",
>>  line 113, in <module>
>>         _ansiballz_main()
>>       File 
>> "/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py",
>>  line 105, in _ansiballz_main
>>         invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
>>       File 
>> "/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py",
>>  line 48, in invoke_module
>>         imp.load_module('__main__', mod, module, MOD_DESC)
>>       File "/tmp/ansible_snow_record_payload_0p5jn8/__main__.py", line 332, 
>> in <module>
>>       File "/tmp/ansible_snow_record_payload_0p5jn8/__main__.py", line 328, 
>> in main
>>       File "/tmp/ansible_snow_record_payload_0p5jn8/__main__.py", line 317, 
>> in run_module
>>     AttributeError: 'module' object has no attribute 'UnexpectedResponse'
>>
>>     fatal: [localhost]: FAILED! => {
>>         "changed": false, 
>>         "module_stderr": "Traceback (most recent call last):\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py\",
>>  line 113, in <module>\n    _ansiballz_main()\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py\",
>>  line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, 
>> ANSIBALLZ_PARAMS)\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553017980.16-56687342300902/AnsiballZ_snow_record.py\",
>>  line 48, in invoke_module\n    imp.load_module('__main__', mod, module, 
>> MOD_DESC)\n  File \"/tmp/ansible_snow_record_payload_0p5jn8/__main__.py\", 
>> line 332, in <module>\n  File 
>> \"/tmp/ansible_snow_record_payload_0p5jn8/__main__.py\", line 328, in main\n 
>>  File \"/tmp/ansible_snow_record_payload_0p5jn8/__main__.py\", line 317, in 
>> run_module\nAttributeError: 'module' object has no attribute 
>> 'UnexpectedResponse'\n", 
>>         "module_stdout": "", 
>>         "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
>>         "rc": 1
>>
>> Error output for snow_record_show:
>>
>> atal: []: FAILED! => {
>>     "changed": false, 
>>     "module_stderr": "Shared connection to  closed.\r\n", 
>>     "module_stdout": "Traceback (most recent call last):\r\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553019300.21-10858374496170/AnsiballZ_snow_record_find.py\",
>>  line 113, in <module>\r\n    _ansiballz_main()\r\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553019300.21-10858374496170/AnsiballZ_snow_record_find.py\",
>>  line 105, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, 
>> ANSIBALLZ_PARAMS)\r\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1553019300.21-10858374496170/AnsiballZ_snow_record_find.py\",
>>  line 48, in invoke_module\r\n    imp.load_module('__main__', mod, module, 
>> MOD_DESC)\r\n  File 
>> \"/tmp/ansible_snow_record_find_payload_j9P62r/__main__.py\", line 260, in 
>> <module>\r\n  File 
>> \"/tmp/ansible_snow_record_find_payload_j9P62r/__main__.py\", line 257, in 
>> main\r\n  File \"/tmp/ansible_snow_record_find_payload_j9P62r/__main__.py\", 
>> line 249, in run_module\r\n  File 
>> \"/usr/lib/python2.7/site-packages/pysnow/legacy_request.py\", line 91, in 
>> _all_inner\r\n    yield self._get_content(response)\r\n  File 
>> \"/usr/lib/python2.7/site-packages/pysnow/legacy_request.py\", line 332, in 
>> _get_content\r\n    server_error['summary'], 
>> server_error['details']\r\npysnow.legacy_exceptions.UnexpectedResponse: 
>> Unexpected HTTP GET response code. Expected 200, got 401\r\n", 
>>     "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/757129a8-3a31-4e6e-bf86-19ac44269583o%40googlegroups.com.

Reply via email to