community.general.fmgr_device_group (0.1.1) — module

Alter FortiManager device groups.

Authors: Luke Weighall (@lweighall), Andrew Welsh (@Ghilli3), Jim Huber (@p4r4n0y1ng)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Add or edit device groups and assign devices to device groups FortiManager Device Manager using JSON RPC API.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: CREATE DEVICE GROUP
  fmgr_device_group:
    grp_name: "TestGroup"
    grp_desc: "CreatedbyAnsible"
    adom: "ansible"
    mode: "add"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: CREATE DEVICE GROUP 2
  fmgr_device_group:
    grp_name: "AnsibleGroup"
    grp_desc: "CreatedbyAnsible"
    adom: "ansible"
    mode: "add"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: ADD DEVICES TO DEVICE GROUP
  fmgr_device_group:
    mode: "add"
    grp_name: "TestGroup"
    grp_members: "FGT1,FGT2"
    adom: "ansible"
    vdom: "root"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: REMOVE DEVICES TO DEVICE GROUP
  fmgr_device_group:
    mode: "delete"
    grp_name: "TestGroup"
    grp_members: "FGT1,FGT2"
    adom: "ansible"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: DELETE DEVICE GROUP
  fmgr_device_group:
    grp_name: "AnsibleGroup"
    grp_desc: "CreatedbyAnsible"
    mode: "delete"
    adom: "ansible"

Inputs

    
adom:
    default: root
    description:
    - The ADOM the configuration should belong to.
    required: false

mode:
    choices:
    - add
    - set
    - delete
    - update
    default: add
    description:
    - Sets one of three modes for managing the object.
    - Allows use of soft-adds instead of overwriting existing values
    required: false

vdom:
    default: root
    description:
    - The VDOM of the Fortigate you want to add, must match the device in FMGR. Usually
      root.
    required: false

grp_desc:
    description:
    - The description of the device group.
    required: false

grp_name:
    description:
    - The name of the device group.
    required: false

grp_members:
    description:
    - A comma separated list of device names or device groups to be added as members to
      the device group.
    - If Group Members are defined, and mode="delete", only group members will be removed.
    - If you want to delete a group itself, you must omit this parameter from the task
      in playbook.
    required: false

Outputs

api_result:
  description: full API response, includes status code and message
  returned: always
  type: str