Closed Jmahaja1 closed 1 year ago
Hi @Jmahaja1
I ran the same playbook on my env, there're no errors.
The playbook I used:
- hosts: fortigates
connection: httpapi
gather_facts: no
collections:
- fortinet.fortios
vars:
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 443
vdom: ""
Make: Fortigate
Model: 400E
tasks:
- name: get all
fortinet.fortios.fortios_configuration_fact:
vdom: ""
access_token: 3kNsh1mcNg83b9G09Hcbjwhxpmqm5b
selector: hardware_status
register: show_hardware_status
- name: Print show hardware status
debug:
var: show_hardware_status
The hosts file on my env:
[fortigates]
fortigate01 enable_log=True ansible_host=192.168.21.12
[fortigates:vars]
ansible_network_os=fortinet.fortios.fortios
access_token=3kNsh1mcNg83b9G09Hcbjwhxpmqm5b
Can you check the hosts file to make sure the network_os is included?
Thank you for getting back to me.
Kind Regards,
Juhi
Thank you, ansible_network_os fixed this for me. Also fixed the below, which I had hacked my way around only to end up at the error above.
File "/home/jeff/.ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py", line 48, in getattr raise AttributeError( AttributeError: 'Connection' object has no attribute 'nonetype'
My playbook
hosts: fortigates connection: httpapi gather_facts: no collections:
fortinet.fortios vars: ansible_httpapi_use_ssl: yes ansible_httpapi_validate_certs: no ansible_httpapi_port: 443 vdom: "" Make: Fortigate Model: 400E tasks:
name: get all fortinet.fortios.fortios_configuration_fact: vdom: "" access_token: 3kNsh1mcNg83b9G09Hcbjwhxpmqm5b selector: hardware_status register: show_hardware_status
name: Print show hardware status debug: var: show_hardware_status
name: get all fortinet.fortios.fortios_configuration_fact: vdom: "" access_token: xxxx selector: system_status register: show_system_status
name: Print show system status debug: var: show_system_status
ENTBAS_POC_FW_01 ansible_host=xx.xx.xx.xx ansible_user="xxx" ansible_password="xxxx" [fortigates:vars]