# fmgr_device_group – Alter FortiManager device groups

New in version 2.8.

- Synopsis

- Parameters

- Notes

- Examples

- Return Values

- Status

## Synopsis

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

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
adom - | Default: "root" | The ADOM the configuration should belong to.
grp_desc - |  | The description of the device group.
grp_members - |  | 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.
grp_name - |  | The name of the device group.

mode
-

Choices:
- add ←
- set
- delete
- update

Sets one of three modes for managing the object.
Allows use of soft-adds instead of overwriting existing values

vdom - | Default: "root" | The VDOM of the Fortigate you want to add, must match the device in FMGR. Usually root.

## Notes

Note

- Full Documentation at https://ftnt-ansible-docs.readthedocs.io/en/latest/.

## Examples

    - name: CREATE DEVICE GROUP
      fmgr_device_group:
        grp_name: "TestGroup"
        grp_desc: "CreatedbyAnsible"
        adom: "ansible"
        mode: "add"

    - name: CREATE DEVICE GROUP 2
      fmgr_device_group:
        grp_name: "AnsibleGroup"
        grp_desc: "CreatedbyAnsible"
        adom: "ansible"
        mode: "add"

    - name: ADD DEVICES TO DEVICE GROUP
      fmgr_device_group:
        mode: "add"
        grp_name: "TestGroup"
        grp_members: "FGT1,FGT2"
        adom: "ansible"
        vdom: "root"

    - name: REMOVE DEVICES TO DEVICE GROUP
      fmgr_device_group:
        mode: "delete"
        grp_name: "TestGroup"
        grp_members: "FGT1,FGT2"
        adom: "ansible"

    - name: DELETE DEVICE GROUP
      fmgr_device_group:
        grp_name: "AnsibleGroup"
        grp_desc: "CreatedbyAnsible"
        mode: "delete"
        adom: "ansible"

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
api_result string | always | full API response, includes status code and message

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Community. [community]

### Authors

- Luke Weighall (@lweighall)

- Andrew Welsh (@Ghilli3)

- Jim Huber (@p4r4n0y1ng)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.