Closed tohillm closed 5 years ago
Apologies for the poor formatting of this issue creation. I am a newbie at this. Mark
Hello, According to your error msg the host running your ansible can not connect to your fortigate.
You must be able to run https calls on your fortigate from the host you run Ansible. That mean inside same Vnet and Foritgate corresponding interface set for admin access on https://
Nicholas, You were correct. Apologies for this.
Mark
Working with @JonTheNiceGuy on Fortigate Playbooks:
I have built a FortiGate NGFW - Single VM on Azure using the marketplace and selecting the "BYOL 6.0.3" model.
I then execute the following playbook: `
RESTful API to Azure
Global Vars declaration
vars:
tasks:
This module was developed by Fortinet to configure all aspects of all aspects of fortinet pro$
https://github.com/fortinet-solutions-cse/40ansible
Here, it configures the local memory and local disk logging of the firewallit similar to exis$
# #
action: "set"
config: "log.memory setting" config_parameters: status: "disable"
_ansiballz_main()
File "/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py", line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py", line 48, in invoke_module
imp.load_module('main', mod, module, MOD_DESC)
File "/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py", line 859, in
File "/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py", line 847, in main
File "/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py", line 519, in fortigate_config_set
File "/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py", line 469, in login
File "/usr/lib/python2.7/site-packages/fortiosapi/fortiosapi.py", line 118, in login
data='username=' + username + '&secretkey=' + password + "&ajax=1")
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 507, in post
return self.request('POST', url, data=data, json=json, kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
resp = self.send(prep, send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(101, 'Network is unreachable'))
The verbose output from the failure step is as follows:
TASK [configures local memory logging] ** task path: /home/tohillm/playbooks/AF-1137-FW-locallog-Mgmt/AF-1137-FW-locallog-Mgmt-part1.yml:49 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: tohillm <127.0.0.1> EXEC /bin/sh -c 'echo ~tohillm && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446
" && echo ansible-tmp-1549365329.73-215581636446446="echo /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446
" ) && sleep 0' Using module file /home/tohillm/playbooks/AF-1137-FW-locallog-Mgmt/library/fortiosconfig.py <127.0.0.1> PUT /home/tohillm/.ansible/tmp/ansible-local-535168S05J/tmpXp4CD9 TO /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/ /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py", line 113, infatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py\", line 113, in\n _ansiballz_main()\n File \"/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/tohillm/.ansible/tmp/ansible-tmp-1549365329.73-215581636446446/AnsiballZ_fortiosconfig.py\", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File \"/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py\", line 859, in \n File \"/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py\", line 847, in main\n File \"/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py\", line 519, in fortigate_config_set\n File \"/tmp/ansible_fortiosconfig_payload_CUwU8c/main.py\", line 469, in login\n File \"/usr/lib/python2.7/site-packages/fortiosapi/fortiosapi.py\", line 118, in login\n data='username=' + username + '&secretkey=' + password + \"&ajax=1\")\n File \"/usr/lib/python2.7/site-packages/requests/sessions.py\", line 507, in post\n return self.request('POST', url, data=data, json=json, kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/sessions.py\", line 464, in request\n resp = self.send(prep, send_kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/sessions.py\", line 576, in send\n r = adapter.send(request, **kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/adapters.py\", line 415, in send\n raise ConnectionError(err, request=request)\nrequests.exceptions.ConnectionError: ('Connection aborted.', error(101, 'Network is unreachable'))\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
to retry, use: --limit @/home/tohillm/playbooks/AF-1137-FW-locallog-Mgmt/AF-1137-FW-locallog-Mgmt-part1.retry
PLAY RECAP ** localhost : ok=1 changed=0 unreachable=0 failed=1 `
Can anyone give me advice as to what I am doing wrong? Thanks, Mark