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

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

check mode not supported on fortios_system_global #351

Open powershellbreakfast opened 1 week ago

powershellbreakfast commented 1 week ago

Using the following playbook and hosts file i am unable to run a simple check on whether a FortiGate has a setting configured in fortios_system_global.

Is there a reason its not supported or a recommended way of checking for this value ?

inventory file: hosts.yml *credentials stored separately

all:
  vars:
    ansible_user: "{{ credentials[inventory_hostname].user }}" 
    ansible_password: "{{ credentials[inventory_hostname].password }}"
    ansible_become_password: "{{ credentials[inventory_hostname].become_password }}"

fortigate:
  hosts:
    SYM-HQ-FW1:
      ansible_host: 192.168.255.253
    home_fortigate:
      ansible_host: 192.168.0.1
  vars:
    #ansible_connection: ansible.netcomon.network_cli
    ansible_network_os: fortinet.fortios.fortios
    ### Specify API connection with HTTP (default SSH)###
    ansible_connection: httpapi
    ansible_httpapi_validate_certs: no
    ansible_httpapi_use_ssl: yes

playbook: set_system_global_revision-backup-on-logout.yml

---
- name: configure revision-backup-on-logout 
  hosts: home_fortigate
  collections:
  - fortinet.fortios
  tasks:
    - name: configure system global.
      fortios_system_global:
        system_global:
          revision_backup_on_logout: "disable"

command used to run playbook

ansible-playbook -i hosts.yml set_system_global_revision-backup-on-logout.yml --check -v

results in

skipping: [home_fortigate] => {"changed": false, "msg": "remote module (fortios_system_global) does not support check mode"}                   
MaxxLiu22 commented 1 week ago

Hi @powershellbreakfast ,

Thank you for bringing this issue to our attention. Currently, Ansible FOS check mode does not support all resources, including fortios_system_global. I have reported this to our development team, and they are considering adding check mode support for additional resources. We are also aware that there may be some display issues with the current check mode, and the team is working on improvements. We sincerely apologize for any inconvenience this may have caused.

Thanks, Maxx