
    Vh                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ  G d de      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functional  
---
module: ad_group
version_added: "1.0.0"
author:
    - WangBaoshan (@ispim)
short_description: Manage active directory group information
description:
   - Manage active directory group information on Inspur server.
notes:
   - Does not support C(check_mode).
options:
    state:
        description:
            - Whether the active directory group should exist or not, taking action if the state is different from what is stated.
        choices: ['present', 'absent']
        default: present
        type: str
    name:
        description:
            - Group name.
        type: str
        required: true
    domain:
        description:
            - Group domain.
        type: str
    pri:
        description:
            - Group privilege.
        choices: ['administrator', 'user', 'operator', 'oem', 'none']
        type: str
    kvm:
        description:
            - Kvm privilege.
        choices: ['enable', 'disable']
        type: str
    vm:
        description:
            - Vmedia privilege.
        choices: ['enable', 'disable']
        type: str
extends_documentation_fragment:
    - inspur.ispim.ism
a  
- name: Ad group test
  hosts: ism
  connection: local
  gather_facts: no
  vars:
    ism:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Add active directory group information"
    inspur.ispim.ad_group:
      state: "present"
      name: "wbs"
      domain: "inspur.com"
      pri: "administrator"
      kvm: "enable"
      vm: "disable"
      provider: "{{ ism }}"

  - name: "Set active directory group information"
    inspur.ispim.ad_group:
      state: "present"
      name: "wbs"
      pri: "user"
      kvm: "disable"
      provider: "{{ ism }}"

  - name: "Delete active directory group information"
    inspur.ispim.ad_group:
      state: "absent"
      name: "wbs"
      provider: "{{ ism }}"
a1  
message:
    description: Messages returned after module execution.
    returned: always
    type: str
state:
    description: Status after module execution.
    returned: always
    type: str
changed:
    description: Check to see if a change was made on the device.
    returned: always
    type: bool
)AnsibleModule)ism_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)ADc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     i/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/inspur/ispim/plugins/modules/ad_group.py__init__zAD.__init__s   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zAD.init_moduley   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Neditadgroup
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzAD.run_command   sJ    +8<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzAD.show_result   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workzAD.work   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   r   s    @+.r   r
   c                  "   t        t        dddgd      t        dd      t        dd      t        ddg d	      t        ddd
dg	      t        ddd
dg	            } | j                  t               t        |       }|j	                          y )Nstrpresentabsent)typechoicesdefaultT)r/   requiredF)administratoruseroperatoroemnone)r/   r2   r0   enabledisable)statenamedomainprikvmvm)r   updater   r
   r'   )r   ad_objs     r   mainrB      s    	8'<iPut,/ee5ijeeh	5JKUUXy4IJM *+F
KKMr   __main__N)
__future__r   r   r   r/   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   9ansible_collections.inspur.ispim.plugins.module_utils.ismr   r   objectr
   rB   r(   r"   r   r   <module>rL      sW    C B,\$L
 5 i : zF r   