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

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

list of admin users #174

Closed nbctcp closed 10 months ago

nbctcp commented 2 years ago

GOAL: get list of admin users OPTION1: do you have example using your module

OPTION2: can I run this command "get system admin list" on remote fortigate using ansible then register

JieX19 commented 2 years ago

Hi @nbctcp

We do have a module 'fortios_configuration_fact' to retrieve the info.

Here's an example:

- hosts: fortigate01
  collections:
   - fortinet.fortios
  connection: httpapi
  vars:
   vdom: "root"
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:
  - name: get all of the admins
    fortios_configuration_fact:
      selectors:
        #- selector: system_admin
        - selector: system_api-user

Feel free to register and copy the returned values if necessary. There're several selectors for getting different info https://ansible-galaxy-fortios-docs.readthedocs.io/en/galaxy-2.1.4/fortios_configuration_fact.html