fortinet-ansible-dev / ansible-galaxy-fortios-collection

GNU General Public License v3.0
85 stars 49 forks source link

fortios "msg": "Error in repo"} #222

Open shokrymohamedshokry opened 1 year ago

shokrymohamedshokry commented 1 year ago

When I run any playbook using fortios collection i got this error ( "vdom": "root", "version": "v6.4.11"}, "msg": "Error in repo"}) at the end of task and return with failed status.


PLAY RECAP *********************************************************************************************************************************************
fortigate03                : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

[shokry@hq-ans-eng forti]$ ansible-navigator run -m stdout nic.yml

PLAY [fortigate04] *********************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************
ok: [fortigate04]

TASK [Display NIC informationn] *********************************************************************************************************************************************
fatal: [fortigate04]: FAILED! => {"changed": false, "meta": {"build": 2030, "http_method": "PUT", "http_status": 403, "name": "nic", 
"path": "********rdware", "serial": "FG4H0ETB20903251", "status": "error", "vdom": "root", "version": "v6.4.11"}, 
"msg": "Error in repo"}

PLAY RECAP *********************************************************************************************************************************************
fortigate04                : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

example of the playbook

- hosts: fortigate04
  collections:
    - fortinet.fortios
  connection: httpapi
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 8443
  tasks:
  - name: Display NIC informationn
    fortios_hardware_nic:
      vdom:  "{{ vdom }}"
      access_token: "{{ Fortitoken }}"
      hardware_nic:
        nic: "ha"

fortios version 2.2.2 ansible version [core 2.13.3] python version 3.9.13

MaxxLiu22 commented 1 year ago

Hi @shokrymohamedshokry ,

Thank you for your question, if you would like to get NIC information, you can try to use fortios_monitor_fact module and use system_available-interfaces as selector to get, Let me know if you still have questions.

- hosts: fortigates
  connection: httpapi
  collections:
    - fortinet.fortios
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:

  - name: fact gathering
    fortios_monitor_fact:
       vdom: "root"
       access_token: "{{token}}"
       selector: 'system_available-interfaces'
    register: info

  - name: display vars
    debug: msg="{{info}}"

Thanks, Maxx

mattpainter701 commented 1 year ago

i get the same error in repo msg trying to do a basic backup

- hosts: dc_fortigate
  connection: httpapi
  collections:
  - fortinet.fortios
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 8080
   ansible_httpapi_timeout: 60
  tasks:
  - name: Backup a virtual domain.
    fortios_monitor:
     access_token: "{{ fortios_access_token }}"
     selector: 'backup.system.config'
     vdom: 'root'
     params:
         scope: 'global'
    register: backupinfo

  - name: Save the backup information.
    copy:
     content: '{{ backupinfo.meta.raw }}'
     dest: './local.backup'

"msg": "Error in repo"}