Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Disable Certificate Check #19

Closed
thibrahim opened this issue Jun 15, 2020 · 3 comments
Closed

Unable to Disable Certificate Check #19

thibrahim opened this issue Jun 15, 2020 · 3 comments

Comments

@thibrahim
Copy link

I am attempting to connect to my Fortigate device to gather facts with the playbook below. We are using the automation hub collections from Fortinet for the modules as well as for ansible_network_os: fortinet.fortios.fortios. However we keep getting the following error when attempting to reach our device.
Additional configuration variables:
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 444
ansible_network_os: fortinet.fortios.fortios

{
"module_stdout": "",
"module_stderr": "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\n/var/lib/awx/venv/ansible/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\n/var/lib/awx/venv/ansible/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\nin formatresponse res.content does not exist, should not occur\nTraceback (most recent call last):\n File "/var/lib/awx/.ansible/tmp/ansible-local-2mz2oszqh/ansible-tmp-1592227468.6901195-160250334423800/AnsiballZ_fortios_facts.py", line 102, in \n _ansiballz_main()\n File "/var/lib/awx/.ansible/tmp/ansible-local-2mz2oszqh/ansible-tmp-1592227468.6901195-160250334423800/AnsiballZ_fortios_facts.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/var/lib/awx/.ansible/tmp/ansible-local-2mz2oszqh/ansible-tmp-1592227468.6901195-160250334423800/AnsiballZ_fortios_facts.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.fortinet.fortios.plugins.modules.fortios_facts', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_facts.py", line 282, in \n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible_collections/fortinet/fortios/plugins/modules/fortios_facts.py", line 278, in main\n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible/module_utils/basic.py", line 2072, in exit_json\n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible/module_utils/basic.py", line 2065, in _return_formatted\n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible/module_utils/basic.py", line 418, in remove_values\n File "/tmp/ansible_fortinet.fortios.fortios_facts_payload_f4w2dvsx/ansible_fortinet.fortios.fortios_facts_payload.zip/ansible/module_utils/basic.py", line 401, in _remove_values_conditions\nTypeError: Value of unknown type: <class 'requests.models.Response'>, <Response [404]>\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"_ansible_no_log": false,
"changed": false
}

Versions:

  • Ansible Tower 3.6.2
  • Ansible Engine 2.9.1
---
- name: Fortigate connection test
  hosts: Fortigate
  gather_facts: no
  connection: httpapi
  vars:
      ansible_httpapi_password: "{{ ansible_password }}"
      ansible_httpapi_user: "{{ ansible_user }}"
      ansible_httpapi_validate_certs: no
  tasks:
  - name: gather basic system status facts
    fortinet.fortios.fortios_facts:
      host:  "{{ ansible_host }}:444"
      username: "{{ ansible_user }}"
      password: "{{ ansible_password }}"
      vdom:  "root"
      ssl_verify: false
      gather_subset:
        - fact: 'system_status_select'


@chillancezen
Copy link

hi @thibrahim,

please use httpapi and have a try :

in your playbook, you didn't actually use httpapi becase you specified host, username and password.
please also see steps in the following page: https://ansible-galaxy-fortios-docs.readthedocs.io/en/latest/playbook.html

- hosts: fortigate01
  connection: httpapi
  collections:
    - fortinet.fortios
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443 
  tasks:
  - name: gather basic system status facts.
    fortios_facts:
      vdom:  "{{ vdom }}"
      gather_subset:
         - fact: 'system_status_select'
         - fact: 'system_interface_select'

thanks,
Link

@chillancezen
Copy link

hi @thibrahim, hope you are doing fine.

do you have any updates on this issue ?

thanks,
Link

@chillancezen
Copy link

hi @thibrahim ,

I now mark this issue closed.
please feel free to reopen if this issue is not resolved at your side, and you can reach out to me at anytime.

thanks,
Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants