����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

deexcl@216.73.217.71: ~ $
# -*- coding: utf-8 -*-

# Copyright (c) 2016, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

from __future__ import absolute_import, division, print_function
__metaclass__ = type

DOCUMENTATION = r'''
---
module: rhevm
short_description: RHEV/oVirt automation
description:
    - This module only supports oVirt/RHEV version 3.
    - A newer module M(ovirt.ovirt.ovirt_vm) supports oVirt/RHV version 4.
    - Allows you to create/remove/update or powermanage virtual machines on a RHEV/oVirt platform.
requirements:
    - ovirtsdk
author:
    - Timothy Vandenbrande (@TimothyVandenbrande)
extends_documentation_fragment:
    - community.general.attributes
attributes:
    check_mode:
        support: none
    diff_mode:
        support: none
options:
    user:
        description:
            - The user to authenticate with.
        type: str
        default: admin@internal
    password:
        description:
            - The password for user authentication.
        type: str
        required: true
    server:
        description:
            - The name/IP of your RHEV-m/oVirt instance.
        type: str
        default: 127.0.0.1
    port:
        description:
            - The port on which the API is reachable.
        type: int
        default: 443
    insecure_api:
        description:
            - A boolean switch to make a secure or insecure connection to the server.
        type: bool
        default: false
    name:
        description:
            - The name of the VM.
        type: str
    cluster:
        description:
            - The RHEV/oVirt cluster in which you want you VM to start.
        type: str
        default: ''
    datacenter:
        description:
            - The RHEV/oVirt datacenter in which you want you VM to start.
        type: str
        default: Default
    state:
        description:
            - This serves to create/remove/update or powermanage your VM.
        type: str
        choices: [ absent, cd, down, info, ping, present, restarted, up ]
        default: present
    image:
        description:
            - The template to use for the VM.
        type: str
    type:
        description:
            - To define if the VM is a server or desktop.
        type: str
        choices: [ desktop, host, server ]
        default: server
    vmhost:
        description:
            - The host you wish your VM to run on.
        type: str
    vmcpu:
        description:
            - The number of CPUs you want in your VM.
        type: int
        default: 2
    cpu_share:
        description:
            - This parameter is used to configure the CPU share.
        type: int
        default: 0
    vmmem:
        description:
            - The amount of memory you want your VM to use (in GB).
        type: int
        default: 1
    osver:
        description:
            - The operating system option in RHEV/oVirt.
        type: str
        default: rhel_6x64
    mempol:
        description:
            - The minimum amount of memory you wish to reserve for this system.
        type: int
        default: 1
    vm_ha:
        description:
            - To make your VM High Available.
        type: bool
        default: true
    disks:
        description:
            - This option uses complex arguments and is a list of disks with the options name, size and domain.
        type: list
        elements: str
    ifaces:
        description:
            - This option uses complex arguments and is a list of interfaces with the options name and vlan.
        type: list
        elements: str
        aliases: [ interfaces, nics ]
    boot_order:
        description:
            - This option uses complex arguments and is a list of items that specify the bootorder.
        type: list
        elements: str
        default: [ hd, network ]
    del_prot:
        description:
            - This option sets the delete protection checkbox.
        type: bool
        default: true
    cd_drive:
        description:
            - The CD you wish to have mounted on the VM when I(state = 'CD').
        type: str
    timeout:
        description:
            - The timeout you wish to define for power actions.
            - When I(state = 'up').
            - When I(state = 'down').
            - When I(state = 'restarted').
        type: int
'''

RETURN = r'''
vm:
    description: Returns all of the VMs variables and execution.
    returned: always
    type: dict
    sample: {
        "boot_order": [
            "hd",
            "network"
        ],
        "changed": true,
        "changes": [
            "Delete Protection"
        ],
        "cluster": "C1",
        "cpu_share": "0",
        "created": false,
        "datacenter": "Default",
        "del_prot": true,
        "disks": [
            {
                "domain": "ssd-san",
                "name": "OS",
                "size": 40
            }
        ],
        "eth0": "00:00:5E:00:53:00",
        "eth1": "00:00:5E:00:53:01",
        "eth2": "00:00:5E:00:53:02",
        "exists": true,
        "failed": false,
        "ifaces": [
            {
                "name": "eth0",
                "vlan": "Management"
            },
            {
                "name": "eth1",
                "vlan": "Internal"
            },
            {
                "name": "eth2",
                "vlan": "External"
            }
        ],
        "image": false,
        "mempol": "0",
        "msg": [
            "VM exists",
            "cpu_share was already set to 0",
            "VM high availability was already set to True",
            "The boot order has already been set",
            "VM delete protection has been set to True",
            "Disk web2_Disk0_OS already exists",
            "The VM starting host was already set to host416"
        ],
        "name": "web2",
        "type": "server",
        "uuid": "4ba5a1be-e60b-4368-9533-920f156c817b",
        "vm_ha": true,
        "vmcpu": "4",
        "vmhost": "host416",
        "vmmem": "16"
    }
'''

EXAMPLES = r'''
- name: Basic get info from VM
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: demo
    state: info

- name: Basic create example from image
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: demo
    cluster: centos
    image: centos7_x64
    state: present

- name: Power management
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    cluster: RH
    name: uptime_server
    image: centos7_x64
    state: down

- name: Multi disk, multi nic create example
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    cluster: RH
    name: server007
    type: server
    vmcpu: 4
    vmmem: 2
    ifaces:
    - name: eth0
      vlan: vlan2202
    - name: eth1
      vlan: vlan36
    - name: eth2
      vlan: vlan38
    - name: eth3
      vlan: vlan2202
    disks:
    - name: root
      size: 10
      domain: ssd-san
    - name: swap
      size: 10
      domain: 15kiscsi-san
    - name: opt
      size: 10
      domain: 15kiscsi-san
    - name: var
      size: 10
      domain: 10kiscsi-san
    - name: home
      size: 10
      domain: sata-san
    boot_order:
    - network
    - hd
    state: present

- name: Add a CD to the disk cd_drive
  community.general.rhevm:
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: server007
    cd_drive: rhev-tools-setup.iso
    state: cd

- name: New host deployment + host network configuration
  community.general.rhevm:
    password: '{{ rhevm.admin.pass }}'
    name: ovirt_node007
    type: host
    cluster: rhevm01
    ifaces:
    - name: em1
    - name: em2
    - name: p3p1
      ip: 172.31.224.200
      netmask: 255.255.254.0
    - name: p3p2
      ip: 172.31.225.200
      netmask: 255.255.254.0
    - name: bond0
      bond:
      - em1
      - em2
      network: rhevm
      ip: 172.31.222.200
      netmask: 255.255.255.0
      management: true
    - name: bond0.36
      network: vlan36
      ip: 10.2.36.200
      netmask: 255.255.254.0
      gateway: 10.2.36.254
    - name: bond0.2202
      network: vlan2202
    - name: bond0.38
      network: vlan38
    state: present
'''

import time

try:
    from ovirtsdk.api import API
    from ovirtsdk.xml import params
    HAS_SDK = True
except ImportError:
    HAS_SDK = False

from ansible.module_utils.basic import AnsibleModule


RHEV_FAILED = 1
RHEV_SUCCESS = 0
RHEV_UNAVAILABLE = 2

RHEV_TYPE_OPTS = ['desktop', 'host', 'server']
STATE_OPTS = ['absent', 'cd', 'down', 'info', 'ping', 'present', 'restart', 'up']

msg = []
changed = False
failed = False


class RHEVConn(object):
    'Connection to RHEV-M'

    def __init__(self, module):
        self.module = module

        user = module.params.get('user')
        password = module.params.get('password')
        server = module.params.get('server')
        port = module.params.get('port')
        insecure_api = module.params.get('insecure_api')

        url = "https://%s:%s" % (server, port)

        try:
            api = API(url=url, username=user, password=password, insecure=str(insecure_api))
            api.test()
            self.conn = api
        except Exception:
            raise Exception("Failed to connect to RHEV-M.")

    def __del__(self):
        self.conn.disconnect()

    def createVMimage(self, name, cluster, template):
        try:
            vmparams = params.VM(
                name=name,
                cluster=self.conn.clusters.get(name=cluster),
                template=self.conn.templates.get(name=template),
                disks=params.Disks(clone=True)
            )
            self.conn.vms.add(vmparams)
            setMsg("VM is created")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to create VM")
            setMsg(str(e))
            setFailed()
            return False

    def createVM(self, name, cluster, os, actiontype):
        try:
            vmparams = params.VM(
                name=name,
                cluster=self.conn.clusters.get(name=cluster),
                os=params.OperatingSystem(type_=os),
                template=self.conn.templates.get(name="Blank"),
                type_=actiontype
            )
            self.conn.vms.add(vmparams)
            setMsg("VM is created")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to create VM")
            setMsg(str(e))
            setFailed()
            return False

    def createDisk(self, vmname, diskname, disksize, diskdomain, diskinterface, diskformat, diskallocationtype, diskboot):
        VM = self.get_VM(vmname)

        newdisk = params.Disk(
            name=diskname,
            size=1024 * 1024 * 1024 * int(disksize),
            wipe_after_delete=True,
            sparse=diskallocationtype,
            interface=diskinterface,
            format=diskformat,
            bootable=diskboot,
            storage_domains=params.StorageDomains(
                storage_domain=[self.get_domain(diskdomain)]
            )
        )

        try:
            VM.disks.add(newdisk)
            VM.update()
            setMsg("Successfully added disk " + diskname)
            setChanged()
        except Exception as e:
            setFailed()
            setMsg("Error attaching " + diskname + "disk, please recheck and remove any leftover configuration.")
            setMsg(str(e))
            return False

        try:
            currentdisk = VM.disks.get(name=diskname)
            attempt = 1
            while currentdisk.status.state != 'ok':
                currentdisk = VM.disks.get(name=diskname)
                if attempt == 100:
                    setMsg("Error, disk %s, state %s" % (diskname, str(currentdisk.status.state)))
                    raise Exception()
                else:
                    attempt += 1
                    time.sleep(2)
            setMsg("The disk  " + diskname + " is ready.")
        except Exception as e:
            setFailed()
            setMsg("Error getting the state of " + diskname + ".")
            setMsg(str(e))
            return False
        return True

    def createNIC(self, vmname, nicname, vlan, interface):
        VM = self.get_VM(vmname)
        CLUSTER = self.get_cluster_byid(VM.cluster.id)
        DC = self.get_DC_byid(CLUSTER.data_center.id)
        newnic = params.NIC(
            name=nicname,
            network=DC.networks.get(name=vlan),
            interface=interface
        )

        try:
            VM.nics.add(newnic)
            VM.update()
            setMsg("Successfully added iface " + nicname)
            setChanged()
        except Exception as e:
            setFailed()
            setMsg("Error attaching " + nicname + " iface, please recheck and remove any leftover configuration.")
            setMsg(str(e))
            return False

        try:
            currentnic = VM.nics.get(name=nicname)
            attempt = 1
            while currentnic.active is not True:
                currentnic = VM.nics.get(name=nicname)
                if attempt == 100:
                    setMsg("Error, iface %s, state %s" % (nicname, str(currentnic.active)))
                    raise Exception()
                else:
                    attempt += 1
                    time.sleep(2)
            setMsg("The iface  " + nicname + " is ready.")
        except Exception as e:
            setFailed()
            setMsg("Error getting the state of " + nicname + ".")
            setMsg(str(e))
            return False
        return True

    def get_DC(self, dc_name):
        return self.conn.datacenters.get(name=dc_name)

    def get_DC_byid(self, dc_id):
        return self.conn.datacenters.get(id=dc_id)

    def get_VM(self, vm_name):
        return self.conn.vms.get(name=vm_name)

    def get_cluster_byid(self, cluster_id):
        return self.conn.clusters.get(id=cluster_id)

    def get_cluster(self, cluster_name):
        return self.conn.clusters.get(name=cluster_name)

    def get_domain_byid(self, dom_id):
        return self.conn.storagedomains.get(id=dom_id)

    def get_domain(self, domain_name):
        return self.conn.storagedomains.get(name=domain_name)

    def get_disk(self, disk):
        return self.conn.disks.get(disk)

    def get_network(self, dc_name, network_name):
        return self.get_DC(dc_name).networks.get(network_name)

    def get_network_byid(self, network_id):
        return self.conn.networks.get(id=network_id)

    def get_NIC(self, vm_name, nic_name):
        return self.get_VM(vm_name).nics.get(nic_name)

    def get_Host(self, host_name):
        return self.conn.hosts.get(name=host_name)

    def get_Host_byid(self, host_id):
        return self.conn.hosts.get(id=host_id)

    def set_Memory(self, name, memory):
        VM = self.get_VM(name)
        VM.memory = int(int(memory) * 1024 * 1024 * 1024)
        try:
            VM.update()
            setMsg("The Memory has been updated.")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to update memory.")
            setMsg(str(e))
            setFailed()
            return False

    def set_Memory_Policy(self, name, memory_policy):
        VM = self.get_VM(name)
        VM.memory_policy.guaranteed = int(memory_policy) * 1024 * 1024 * 1024
        try:
            VM.update()
            setMsg("The memory policy has been updated.")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to update memory policy.")
            setMsg(str(e))
            setFailed()
            return False

    def set_CPU(self, name, cpu):
        VM = self.get_VM(name)
        VM.cpu.topology.cores = int(cpu)
        try:
            VM.update()
            setMsg("The number of CPUs has been updated.")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to update the number of CPUs.")
            setMsg(str(e))
            setFailed()
            return False

    def set_CPU_share(self, name, cpu_share):
        VM = self.get_VM(name)
        VM.cpu_shares = int(cpu_share)
        try:
            VM.update()
            setMsg("The CPU share has been updated.")
            setChanged()
            return True
        except Exception as e:
            setMsg("Failed to update the CPU share.")
            setMsg(str(e))
            setFailed()
            return False

    def set_Disk(self, diskname, disksize, diskinterface, diskboot):
        DISK = self.get_disk(diskname)
        setMsg("Checking disk " + diskname)
        if DISK.get_bootable() != diskboot:
            try:
                DISK.set_bootable(diskboot)
                setMsg("Updated the boot option on the disk.")
                setChanged()
            except Exception as e:
                setMsg("Failed to set the boot option on the disk.")
                setMsg(str(e))
                setFailed()
                return False
        else:
            setMsg("The boot option of the disk is correct")
        if int(DISK.size) < (1024 * 1024 * 1024 * int(disksize)):
            try:
                DISK.size = (1024 * 1024 * 1024 * int(disksize))
                setMsg("Updated the size of the disk.")
                setChanged()
            except Exception as e:
                setMsg("Failed to update the size of the disk.")
                setMsg(str(e))
                setFailed()
                return False
        elif int(DISK.size) > (1024 * 1024 * 1024 * int(disksize)):
            setMsg("Shrinking disks is not supported")
            setFailed()
            return False
        else:
            setMsg("The size of the disk is correct")
        if str(DISK.interface) != str(diskinterface):
            try:
                DISK.interface = diskinterface
                setMsg("Updated the interface of the disk.")
                setChanged()
            except Exception as e:
                setMsg("Failed to update the interface of the disk.")
                setMsg(str(e))
                setFailed()
                return False
        else:
            setMsg("The interface of the disk is correct")
        return True

    def set_NIC(self, vmname, nicname, newname, vlan, interface):
        NIC = self.get_NIC(vmname, nicname)
        VM = self.get_VM(vmname)
        CLUSTER = self.get_cluster_byid(VM.cluster.id)
        DC = self.get_DC_byid(CLUSTER.data_center.id)
        NETWORK = self.get_network(str(DC.name), vlan)
        checkFail()
        if NIC.name != newname:
            NIC.name = newname
            setMsg('Updating iface name to ' + newname)
            setChanged()
        if str(NIC.network.id) != str(NETWORK.id):
            NIC.set_network(NETWORK)
            setMsg('Updating iface network to ' + vlan)
            setChanged()
        if NIC.interface != interface:
            NIC.interface = interface
            setMsg('Updating iface interface to ' + interface)
            setChanged()
        try:
            NIC.update()
            setMsg('iface has successfully been updated.')
        except Exception as e:
            setMsg("Failed to update the iface.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def set_DeleteProtection(self, vmname, del_prot):
        VM = self.get_VM(vmname)
        VM.delete_protected = del_prot
        try:
            VM.update()
            setChanged()
        except Exception as e:
            setMsg("Failed to update delete protection.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def set_BootOrder(self, vmname, boot_order):
        VM = self.get_VM(vmname)
        bootorder = []
        for device in boot_order:
            bootorder.append(params.Boot(dev=device))
        VM.os.boot = bootorder

        try:
            VM.update()
            setChanged()
        except Exception as e:
            setMsg("Failed to update the boot order.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def set_Host(self, host_name, cluster, ifaces):
        HOST = self.get_Host(host_name)
        CLUSTER = self.get_cluster(cluster)

        if HOST is None:
            setMsg("Host does not exist.")
            ifacelist = dict()
            networklist = []
            manageip = ''

            try:
                for iface in ifaces:
                    try:
                        setMsg('creating host interface ' + iface['name'])
                        if 'management' in iface:
                            manageip = iface['ip']
                        if 'boot_protocol' not in iface:
                            if 'ip' in iface:
                                iface['boot_protocol'] = 'static'
                            else:
                                iface['boot_protocol'] = 'none'
                        if 'ip' not in iface:
                            iface['ip'] = ''
                        if 'netmask' not in iface:
                            iface['netmask'] = ''
                        if 'gateway' not in iface:
                            iface['gateway'] = ''

                        if 'network' in iface:
                            if 'bond' in iface:
                                bond = []
                                for slave in iface['bond']:
                                    bond.append(ifacelist[slave])
                                try:
                                    tmpiface = params.Bonding(
                                        slaves=params.Slaves(host_nic=bond),
                                        options=params.Options(
                                            option=[
                                                params.Option(name='miimon', value='100'),
                                                params.Option(name='mode', value='4')
                                            ]
                                        )
                                    )
                                except Exception as e:
                                    setMsg('Failed to create the bond for  ' + iface['name'])
                                    setFailed()
                                    setMsg(str(e))
                                    return False
                                try:
                                    tmpnetwork = params.HostNIC(
                                        network=params.Network(name=iface['network']),
                                        name=iface['name'],
                                        boot_protocol=iface['boot_protocol'],
                                        ip=params.IP(
                                            address=iface['ip'],
                                            netmask=iface['netmask'],
                                            gateway=iface['gateway']
                                        ),
                                        override_configuration=True,
                                        bonding=tmpiface)
                                    networklist.append(tmpnetwork)
                                    setMsg('Applying network ' + iface['name'])
                                except Exception as e:
                                    setMsg('Failed to set' + iface['name'] + ' as network interface')
                                    setFailed()
                                    setMsg(str(e))
                                    return False
                            else:
                                tmpnetwork = params.HostNIC(
                                    network=params.Network(name=iface['network']),
                                    name=iface['name'],
                                    boot_protocol=iface['boot_protocol'],
                                    ip=params.IP(
                                        address=iface['ip'],
                                        netmask=iface['netmask'],
                                        gateway=iface['gateway']
                                    ))
                                networklist.append(tmpnetwork)
                                setMsg('Applying network ' + iface['name'])
                        else:
                            tmpiface = params.HostNIC(
                                name=iface['name'],
                                network=params.Network(),
                                boot_protocol=iface['boot_protocol'],
                                ip=params.IP(
                                    address=iface['ip'],
                                    netmask=iface['netmask'],
                                    gateway=iface['gateway']
                                ))
                        ifacelist[iface['name']] = tmpiface
                    except Exception as e:
                        setMsg('Failed to set ' + iface['name'])
                        setFailed()
                        setMsg(str(e))
                        return False
            except Exception as e:
                setMsg('Failed to set networks')
                setMsg(str(e))
                setFailed()
                return False

            if manageip == '':
                setMsg('No management network is defined')
                setFailed()
                return False

            try:
                HOST = params.Host(name=host_name, address=manageip, cluster=CLUSTER, ssh=params.SSH(authentication_method='publickey'))
                if self.conn.hosts.add(HOST):
                    setChanged()
                    HOST = self.get_Host(host_name)
                    state = HOST.status.state
                    while (state != 'non_operational' and state != 'up'):
                        HOST = self.get_Host(host_name)
                        state = HOST.status.state
                        time.sleep(1)
                        if state == 'non_responsive':
                            setMsg('Failed to add host to RHEVM')
                            setFailed()
                            return False

                    setMsg('status host: up')
                    time.sleep(5)

                    HOST = self.get_Host(host_name)
                    state = HOST.status.state
                    setMsg('State before setting to maintenance: ' + str(state))
                    HOST.deactivate()
                    while state != 'maintenance':
                        HOST = self.get_Host(host_name)
                        state = HOST.status.state
                        time.sleep(1)
                    setMsg('status host: maintenance')

                    try:
                        HOST.nics.setupnetworks(params.Action(
                            force=True,
                            check_connectivity=False,
                            host_nics=params.HostNics(host_nic=networklist)
                        ))
                        setMsg('nics are set')
                    except Exception as e:
                        setMsg('Failed to apply networkconfig')
                        setFailed()
                        setMsg(str(e))
                        return False

                    try:
                        HOST.commitnetconfig()
                        setMsg('Network config is saved')
                    except Exception as e:
                        setMsg('Failed to save networkconfig')
                        setFailed()
                        setMsg(str(e))
                        return False
            except Exception as e:
                if 'The Host name is already in use' in str(e):
                    setMsg("Host already exists")
                else:
                    setMsg("Failed to add host")
                    setFailed()
                    setMsg(str(e))
                return False

            HOST.activate()
            while state != 'up':
                HOST = self.get_Host(host_name)
                state = HOST.status.state
                time.sleep(1)
                if state == 'non_responsive':
                    setMsg('Failed to apply networkconfig.')
                    setFailed()
                    return False
            setMsg('status host: up')
        else:
            setMsg("Host exists.")

        return True

    def del_NIC(self, vmname, nicname):
        return self.get_NIC(vmname, nicname).delete()

    def remove_VM(self, vmname):
        VM = self.get_VM(vmname)
        try:
            VM.delete()
        except Exception as e:
            setMsg("Failed to remove VM.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def start_VM(self, vmname, timeout):
        VM = self.get_VM(vmname)
        try:
            VM.start()
        except Exception as e:
            setMsg("Failed to start VM.")
            setMsg(str(e))
            setFailed()
            return False
        return self.wait_VM(vmname, "up", timeout)

    def wait_VM(self, vmname, state, timeout):
        VM = self.get_VM(vmname)
        while VM.status.state != state:
            VM = self.get_VM(vmname)
            time.sleep(10)
            if timeout is not False:
                timeout -= 10
                if timeout <= 0:
                    setMsg("Timeout expired")
                    setFailed()
                    return False
        return True

    def stop_VM(self, vmname, timeout):
        VM = self.get_VM(vmname)
        try:
            VM.stop()
        except Exception as e:
            setMsg("Failed to stop VM.")
            setMsg(str(e))
            setFailed()
            return False
        return self.wait_VM(vmname, "down", timeout)

    def set_CD(self, vmname, cd_drive):
        VM = self.get_VM(vmname)
        try:
            if str(VM.status.state) == 'down':
                cdrom = params.CdRom(file=cd_drive)
                VM.cdroms.add(cdrom)
                setMsg("Attached the image.")
                setChanged()
            else:
                cdrom = VM.cdroms.get(id="00000000-0000-0000-0000-000000000000")
                cdrom.set_file(cd_drive)
                cdrom.update(current=True)
                setMsg("Attached the image.")
                setChanged()
        except Exception as e:
            setMsg("Failed to attach image.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def set_VM_Host(self, vmname, vmhost):
        VM = self.get_VM(vmname)
        HOST = self.get_Host(vmhost)
        try:
            VM.placement_policy.host = HOST
            VM.update()
            setMsg("Set startup host to " + vmhost)
            setChanged()
        except Exception as e:
            setMsg("Failed to set startup host.")
            setMsg(str(e))
            setFailed()
            return False
        return True

    def migrate_VM(self, vmname, vmhost):
        VM = self.get_VM(vmname)

        HOST = self.get_Host_byid(VM.host.id)
        if str(HOST.name) != vmhost:
            try:
                VM.migrate(
                    action=params.Action(
                        host=params.Host(
                            name=vmhost,
                        )
                    ),
                )
                setChanged()
                setMsg("VM migrated to " + vmhost)
            except Exception as e:
                setMsg("Failed to set startup host.")
                setMsg(str(e))
                setFailed()
                return False
        return True

    def remove_CD(self, vmname):
        VM = self.get_VM(vmname)
        try:
            VM.cdroms.get(id="00000000-0000-0000-0000-000000000000").delete()
            setMsg("Removed the image.")
            setChanged()
        except Exception as e:
            setMsg("Failed to remove the image.")
            setMsg(str(e))
            setFailed()
            return False
        return True


class RHEV(object):
    def __init__(self, module):
        self.module = module

    def __get_conn(self):
        self.conn = RHEVConn(self.module)
        return self.conn

    def test(self):
        self.__get_conn()
        return "OK"

    def getVM(self, name):
        self.__get_conn()
        VM = self.conn.get_VM(name)
        if VM:
            vminfo = dict()
            vminfo['uuid'] = VM.id
            vminfo['name'] = VM.name
            vminfo['status'] = VM.status.state
            vminfo['cpu_cores'] = VM.cpu.topology.cores
            vminfo['cpu_sockets'] = VM.cpu.topology.sockets
            vminfo['cpu_shares'] = VM.cpu_shares
            vminfo['memory'] = (int(VM.memory) // 1024 // 1024 // 1024)
            vminfo['mem_pol'] = (int(VM.memory_policy.guaranteed) // 1024 // 1024 // 1024)
            vminfo['os'] = VM.get_os().type_
            vminfo['del_prot'] = VM.delete_protected
            try:
                vminfo['host'] = str(self.conn.get_Host_byid(str(VM.host.id)).name)
            except Exception:
                vminfo['host'] = None
            vminfo['boot_order'] = []
            for boot_dev in VM.os.get_boot():
                vminfo['boot_order'].append(str(boot_dev.dev))
            vminfo['disks'] = []
            for DISK in VM.disks.list():
                disk = dict()
                disk['name'] = DISK.name
                disk['size'] = (int(DISK.size) // 1024 // 1024 // 1024)
                disk['domain'] = str((self.conn.get_domain_byid(DISK.get_storage_domains().get_storage_domain()[0].id)).name)
                disk['interface'] = DISK.interface
                vminfo['disks'].append(disk)
            vminfo['ifaces'] = []
            for NIC in VM.nics.list():
                iface = dict()
                iface['name'] = str(NIC.name)
                iface['vlan'] = str(self.conn.get_network_byid(NIC.get_network().id).name)
                iface['interface'] = NIC.interface
                iface['mac'] = NIC.mac.address
                vminfo['ifaces'].append(iface)
                vminfo[str(NIC.name)] = NIC.mac.address
            CLUSTER = self.conn.get_cluster_byid(VM.cluster.id)
            if CLUSTER:
                vminfo['cluster'] = CLUSTER.name
        else:
            vminfo = False
        return vminfo

    def createVMimage(self, name, cluster, template, disks):
        self.__get_conn()
        return self.conn.createVMimage(name, cluster, template, disks)

    def createVM(self, name, cluster, os, actiontype):
        self.__get_conn()
        return self.conn.createVM(name, cluster, os, actiontype)

    def setMemory(self, name, memory):
        self.__get_conn()
        return self.conn.set_Memory(name, memory)

    def setMemoryPolicy(self, name, memory_policy):
        self.__get_conn()
        return self.conn.set_Memory_Policy(name, memory_policy)

    def setCPU(self, name, cpu):
        self.__get_conn()
        return self.conn.set_CPU(name, cpu)

    def setCPUShare(self, name, cpu_share):
        self.__get_conn()
        return self.conn.set_CPU_share(name, cpu_share)

    def setDisks(self, name, disks):
        self.__get_conn()
        counter = 0
        bootselect = False
        for disk in disks:
            if 'bootable' in disk:
                if disk['bootable'] is True:
                    bootselect = True

        for disk in disks:
            diskname = name + "_Disk" + str(counter) + "_" + disk.get('name', '').replace('/', '_')
            disksize = disk.get('size', 1)
            diskdomain = disk.get('domain', None)
            if diskdomain is None:
                setMsg("`domain` is a required disk key.")
                setFailed()
                return False
            diskinterface = disk.get('interface', 'virtio')
            diskformat = disk.get('format', 'raw')
            diskallocationtype = disk.get('thin', False)
            diskboot = disk.get('bootable', False)

            if bootselect is False and counter == 0:
                diskboot = True

            DISK = self.conn.get_disk(diskname)

            if DISK is None:
                self.conn.createDisk(name, diskname, disksize, diskdomain, diskinterface, diskformat, diskallocationtype, diskboot)
            else:
                self.conn.set_Disk(diskname, disksize, diskinterface, diskboot)
            checkFail()
            counter += 1

        return True

    def setNetworks(self, vmname, ifaces):
        self.__get_conn()
        VM = self.conn.get_VM(vmname)

        counter = 0
        length = len(ifaces)

        for NIC in VM.nics.list():
            if counter < length:
                iface = ifaces[counter]
                name = iface.get('name', None)
                if name is None:
                    setMsg("`name` is a required iface key.")
                    setFailed()
                elif str(name) != str(NIC.name):
                    setMsg("ifaces are in the wrong order, rebuilding everything.")
                    for NIC in VM.nics.list():
                        self.conn.del_NIC(vmname, NIC.name)
                    self.setNetworks(vmname, ifaces)
                    checkFail()
                    return True
                vlan = iface.get('vlan', None)
                if vlan is None:
                    setMsg("`vlan` is a required iface key.")
                    setFailed()
                checkFail()
                interface = iface.get('interface', 'virtio')
                self.conn.set_NIC(vmname, str(NIC.name), name, vlan, interface)
            else:
                self.conn.del_NIC(vmname, NIC.name)
            counter += 1
            checkFail()

        while counter < length:
            iface = ifaces[counter]
            name = iface.get('name', None)
            if name is None:
                setMsg("`name` is a required iface key.")
                setFailed()
            vlan = iface.get('vlan', None)
            if vlan is None:
                setMsg("`vlan` is a required iface key.")
                setFailed()
            if failed is True:
                return False
            interface = iface.get('interface', 'virtio')
            self.conn.createNIC(vmname, name, vlan, interface)

            counter += 1
            checkFail()
        return True

    def setDeleteProtection(self, vmname, del_prot):
        self.__get_conn()
        VM = self.conn.get_VM(vmname)
        if bool(VM.delete_protected) != bool(del_prot):
            self.conn.set_DeleteProtection(vmname, del_prot)
            checkFail()
            setMsg("`delete protection` has been updated.")
        else:
            setMsg("`delete protection` already has the right value.")
        return True

    def setBootOrder(self, vmname, boot_order):
        self.__get_conn()
        VM = self.conn.get_VM(vmname)
        bootorder = []
        for boot_dev in VM.os.get_boot():
            bootorder.append(str(boot_dev.dev))

        if boot_order != bootorder:
            self.conn.set_BootOrder(vmname, boot_order)
            setMsg('The boot order has been set')
        else:
            setMsg('The boot order has already been set')
        return True

    def removeVM(self, vmname):
        self.__get_conn()
        self.setPower(vmname, "down", 300)
        return self.conn.remove_VM(vmname)

    def setPower(self, vmname, state, timeout):
        self.__get_conn()
        VM = self.conn.get_VM(vmname)
        if VM is None:
            setMsg("VM does not exist.")
            setFailed()
            return False

        if state == VM.status.state:
            setMsg("VM state was already " + state)
        else:
            if state == "up":
                setMsg("VM is going to start")
                self.conn.start_VM(vmname, timeout)
                setChanged()
            elif state == "down":
                setMsg("VM is going to stop")
                self.conn.stop_VM(vmname, timeout)
                setChanged()
            elif state == "restarted":
                self.setPower(vmname, "down", timeout)
                checkFail()
                self.setPower(vmname, "up", timeout)
            checkFail()
            setMsg("the vm state is set to " + state)
        return True

    def setCD(self, vmname, cd_drive):
        self.__get_conn()
        if cd_drive:
            return self.conn.set_CD(vmname, cd_drive)
        else:
            return self.conn.remove_CD(vmname)

    def setVMHost(self, vmname, vmhost):
        self.__get_conn()
        return self.conn.set_VM_Host(vmname, vmhost)

    def setHost(self, hostname, cluster, ifaces):
        self.__get_conn()
        return self.conn.set_Host(hostname, cluster, ifaces)


def checkFail():
    if failed:
        module.fail_json(msg=msg)
    else:
        return True


def setFailed():
    global failed
    failed = True


def setChanged():
    global changed
    changed = True


def setMsg(message):
    msg.append(message)


def core(module):

    r = RHEV(module)

    state = module.params.get('state')

    if state == 'ping':
        r.test()
        return RHEV_SUCCESS, {"ping": "pong"}
    elif state == 'info':
        name = module.params.get('name')
        if not name:
            setMsg("`name` is a required argument.")
            return RHEV_FAILED, msg
        vminfo = r.getVM(name)
        return RHEV_SUCCESS, {'changed': changed, 'msg': msg, 'vm': vminfo}
    elif state == 'present':
        created = False
        name = module.params.get('name')
        if not name:
            setMsg("`name` is a required argument.")
            return RHEV_FAILED, msg
        actiontype = module.params.get('type')
        if actiontype == 'server' or actiontype == 'desktop':
            vminfo = r.getVM(name)
            if vminfo:
                setMsg('VM exists')
            else:
                # Create VM
                cluster = module.params.get('cluster')
                if cluster is None:
                    setMsg("cluster is a required argument.")
                    setFailed()
                template = module.params.get('image')
                if template:
                    disks = module.params.get('disks')
                    if disks is None:
                        setMsg("disks is a required argument.")
                        setFailed()
                    checkFail()
                    if r.createVMimage(name, cluster, template, disks) is False:
                        return RHEV_FAILED, vminfo
                else:
                    os = module.params.get('osver')
                    if os is None:
                        setMsg("osver is a required argument.")
                        setFailed()
                    checkFail()
                    if r.createVM(name, cluster, os, actiontype) is False:
                        return RHEV_FAILED, vminfo
                created = True

            # Set MEMORY and MEMORY POLICY
            vminfo = r.getVM(name)
            memory = module.params.get('vmmem')
            if memory is not None:
                memory_policy = module.params.get('mempol')
                if memory_policy == 0:
                    memory_policy = memory
                mem_pol_nok = True
                if int(vminfo['mem_pol']) == memory_policy:
                    setMsg("Memory is correct")
                    mem_pol_nok = False

                mem_nok = True
                if int(vminfo['memory']) == memory:
                    setMsg("Memory is correct")
                    mem_nok = False

                if memory_policy > memory:
                    setMsg('memory_policy cannot have a higher value than memory.')
                    return RHEV_FAILED, msg

                if mem_nok and mem_pol_nok:
                    if memory_policy > int(vminfo['memory']):
                        r.setMemory(vminfo['name'], memory)
                        r.setMemoryPolicy(vminfo['name'], memory_policy)
                    else:
                        r.setMemoryPolicy(vminfo['name'], memory_policy)
                        r.setMemory(vminfo['name'], memory)
                elif mem_nok:
                    r.setMemory(vminfo['name'], memory)
                elif mem_pol_nok:
                    r.setMemoryPolicy(vminfo['name'], memory_policy)
                checkFail()

            # Set CPU
            cpu = module.params.get('vmcpu')
            if int(vminfo['cpu_cores']) == cpu:
                setMsg("Number of CPUs is correct")
            else:
                if r.setCPU(vminfo['name'], cpu) is False:
                    return RHEV_FAILED, msg

            # Set CPU SHARE
            cpu_share = module.params.get('cpu_share')
            if cpu_share is not None:
                if int(vminfo['cpu_shares']) == cpu_share:
                    setMsg("CPU share is correct.")
                else:
                    if r.setCPUShare(vminfo['name'], cpu_share) is False:
                        return RHEV_FAILED, msg

            # Set DISKS
            disks = module.params.get('disks')
            if disks is not None:
                if r.setDisks(vminfo['name'], disks) is False:
                    return RHEV_FAILED, msg

            # Set NETWORKS
            ifaces = module.params.get('ifaces', None)
            if ifaces is not None:
                if r.setNetworks(vminfo['name'], ifaces) is False:
                    return RHEV_FAILED, msg

            # Set Delete Protection
            del_prot = module.params.get('del_prot')
            if r.setDeleteProtection(vminfo['name'], del_prot) is False:
                return RHEV_FAILED, msg

            # Set Boot Order
            boot_order = module.params.get('boot_order')
            if r.setBootOrder(vminfo['name'], boot_order) is False:
                return RHEV_FAILED, msg

            # Set VM Host
            vmhost = module.params.get('vmhost')
            if vmhost:
                if r.setVMHost(vminfo['name'], vmhost) is False:
                    return RHEV_FAILED, msg

            vminfo = r.getVM(name)
            vminfo['created'] = created
            return RHEV_SUCCESS, {'changed': changed, 'msg': msg, 'vm': vminfo}

        if actiontype == 'host':
            cluster = module.params.get('cluster')
            if cluster is None:
                setMsg("cluster is a required argument.")
                setFailed()
            ifaces = module.params.get('ifaces')
            if ifaces is None:
                setMsg("ifaces is a required argument.")
                setFailed()
            if r.setHost(name, cluster, ifaces) is False:
                return RHEV_FAILED, msg
            return RHEV_SUCCESS, {'changed': changed, 'msg': msg}

    elif state == 'absent':
        name = module.params.get('name')
        if not name:
            setMsg("`name` is a required argument.")
            return RHEV_FAILED, msg
        actiontype = module.params.get('type')
        if actiontype == 'server' or actiontype == 'desktop':
            vminfo = r.getVM(name)
            if vminfo:
                setMsg('VM exists')

                # Set Delete Protection
                del_prot = module.params.get('del_prot')
                if r.setDeleteProtection(vminfo['name'], del_prot) is False:
                    return RHEV_FAILED, msg

                # Remove VM
                if r.removeVM(vminfo['name']) is False:
                    return RHEV_FAILED, msg
                setMsg('VM has been removed.')
                vminfo['state'] = 'DELETED'
            else:
                setMsg('VM was already removed.')
            return RHEV_SUCCESS, {'changed': changed, 'msg': msg, 'vm': vminfo}

    elif state == 'up' or state == 'down' or state == 'restarted':
        name = module.params.get('name')
        if not name:
            setMsg("`name` is a required argument.")
            return RHEV_FAILED, msg
        timeout = module.params.get('timeout')
        if r.setPower(name, state, timeout) is False:
            return RHEV_FAILED, msg
        vminfo = r.getVM(name)
        return RHEV_SUCCESS, {'changed': changed, 'msg': msg, 'vm': vminfo}

    elif state == 'cd':
        name = module.params.get('name')
        cd_drive = module.params.get('cd_drive')
        if r.setCD(name, cd_drive) is False:
            return RHEV_FAILED, msg
        return RHEV_SUCCESS, {'changed': changed, 'msg': msg}


def main():
    global module
    module = AnsibleModule(
        argument_spec=dict(
            state=dict(type='str', default='present', choices=['absent', 'cd', 'down', 'info', 'ping', 'present', 'restarted', 'up']),
            user=dict(type='str', default='admin@internal'),
            password=dict(type='str', required=True, no_log=True),
            server=dict(type='str', default='127.0.0.1'),
            port=dict(type='int', default=443),
            insecure_api=dict(type='bool', default=False),
            name=dict(type='str'),
            image=dict(type='str'),
            datacenter=dict(type='str', default="Default"),
            type=dict(type='str', default='server', choices=['desktop', 'host', 'server']),
            cluster=dict(type='str', default=''),
            vmhost=dict(type='str'),
            vmcpu=dict(type='int', default=2),
            vmmem=dict(type='int', default=1),
            disks=dict(type='list', elements='str'),
            osver=dict(type='str', default="rhel_6x64"),
            ifaces=dict(type='list', elements='str', aliases=['interfaces', 'nics']),
            timeout=dict(type='int'),
            mempol=dict(type='int', default=1),
            vm_ha=dict(type='bool', default=True),
            cpu_share=dict(type='int', default=0),
            boot_order=dict(type='list', elements='str', default=['hd', 'network']),
            del_prot=dict(type='bool', default=True),
            cd_drive=dict(type='str'),
        ),
    )

    if not HAS_SDK:
        module.fail_json(msg="The 'ovirtsdk' module is not importable. Check the requirements.")

    rc = RHEV_SUCCESS
    try:
        rc, result = core(module)
    except Exception as e:
        module.fail_json(msg=str(e))

    if rc != 0:  # something went wrong emit the msg
        module.fail_json(rc=rc, msg=result)

    module.exit_json(**result)


if __name__ == '__main__':
    main()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
aerospike_migrations.py File 18.75 KB 0644
airbrake_deployment.py File 4.8 KB 0644
aix_devices.py File 9.89 KB 0644
aix_filesystem.py File 17.48 KB 0644
aix_inittab.py File 7.33 KB 0644
aix_lvg.py File 11 KB 0644
aix_lvol.py File 10.54 KB 0644
alerta_customer.py File 6.61 KB 0644
ali_instance.py File 39.51 KB 0644
ali_instance_info.py File 13.79 KB 0644
alternatives.py File 14.23 KB 0644
ansible_galaxy_install.py File 15.21 KB 0644
apache2_mod_proxy.py File 16.85 KB 0644
apache2_module.py File 8.95 KB 0644
apk.py File 12.07 KB 0644
apt_repo.py File 3.71 KB 0644
apt_rpm.py File 7.75 KB 0644
archive.py File 22.65 KB 0644
atomic_container.py File 6.69 KB 0644
atomic_host.py File 2.8 KB 0644
atomic_image.py File 5.3 KB 0644
awall.py File 4.61 KB 0644
beadm.py File 11.87 KB 0644
bearychat.py File 5.36 KB 0644
bigpanda.py File 6.32 KB 0644
bitbucket_access_key.py File 8.75 KB 0644
bitbucket_pipeline_key_pair.py File 5.95 KB 0644
bitbucket_pipeline_known_host.py File 8.8 KB 0644
bitbucket_pipeline_variable.py File 8.6 KB 0644
bower.py File 6.78 KB 0644
btrfs_info.py File 3.08 KB 0644
btrfs_subvolume.py File 28.14 KB 0644
bundler.py File 6.98 KB 0644
bzr.py File 6.02 KB 0644
campfire.py File 5.15 KB 0644
capabilities.py File 6.8 KB 0644
cargo.py File 5.9 KB 0644
catapult.py File 4.35 KB 0644
circonus_annotation.py File 7.46 KB 0644
cisco_webex.py File 5.58 KB 0644
clc_aa_policy.py File 10.52 KB 0644
clc_alert_policy.py File 17.39 KB 0644
clc_blueprint_package.py File 10.25 KB 0644
clc_firewall_policy.py File 21.16 KB 0644
clc_group.py File 16.72 KB 0644
clc_loadbalancer.py File 34.43 KB 0644
clc_modify_server.py File 34.27 KB 0644
clc_publicip.py File 12.15 KB 0644
clc_server.py File 55.34 KB 0644
clc_server_snapshot.py File 14.16 KB 0644
cloud_init_data_facts.py File 3.45 KB 0644
cloudflare_dns.py File 34.21 KB 0644
cobbler_sync.py File 4.38 KB 0644
cobbler_system.py File 10.74 KB 0644
composer.py File 9.25 KB 0644
consul.py File 21.73 KB 0644
consul_acl.py File 21.9 KB 0644
consul_kv.py File 11.4 KB 0644
consul_session.py File 9.69 KB 0644
copr.py File 16.71 KB 0644
cpanm.py File 8.59 KB 0644
cronvar.py File 13.65 KB 0644
crypttab.py File 10.98 KB 0644
datadog_downtime.py File 10.48 KB 0644
datadog_event.py File 5.77 KB 0644
datadog_monitor.py File 15.77 KB 0644
dconf.py File 18.53 KB 0644
deploy_helper.py File 19.5 KB 0644
dimensiondata_network.py File 9.03 KB 0644
dimensiondata_vlan.py File 18.51 KB 0644
discord.py File 6.7 KB 0644
django_manage.py File 15.82 KB 0644
dnf_versionlock.py File 12.25 KB 0644
dnsimple.py File 16.26 KB 0644
dnsimple_info.py File 9.35 KB 0644
dnsmadeeasy.py File 23.71 KB 0644
dpkg_divert.py File 13.43 KB 0644
easy_install.py File 6.63 KB 0644
ejabberd_user.py File 5.88 KB 0644
elasticsearch_plugin.py File 9.72 KB 0644
emc_vnx_sg_member.py File 5.12 KB 0644
etcd3.py File 8.56 KB 0644
facter.py File 1.88 KB 0644
filesize.py File 16.85 KB 0644
filesystem.py File 21 KB 0644
flatpak.py File 12.16 KB 0644
flatpak_remote.py File 9.08 KB 0644
flowdock.py File 5.84 KB 0644
gandi_livedns.py File 5.05 KB 0644
gconftool2.py File 5.41 KB 0644
gconftool2_info.py File 2.2 KB 0644
gem.py File 10.22 KB 0644
git_config.py File 8.63 KB 0644
github_deploy_key.py File 11.91 KB 0644
github_issue.py File 3.1 KB 0644
github_key.py File 7.49 KB 0644
github_release.py File 6.16 KB 0644
github_repo.py File 8.57 KB 0644
github_webhook.py File 8.75 KB 0644
github_webhook_info.py File 5.27 KB 0644
gitlab_branch.py File 5.46 KB 0644
gitlab_deploy_key.py File 9.41 KB 0644
gitlab_group.py File 13.13 KB 0644
gitlab_group_members.py File 18.54 KB 0644
gitlab_group_variable.py File 15.39 KB 0644
gitlab_hook.py File 12.31 KB 0644
gitlab_project.py File 26.07 KB 0644
gitlab_project_badge.py File 5.99 KB 0644
gitlab_project_members.py File 18.81 KB 0644
gitlab_project_variable.py File 16.48 KB 0644
gitlab_protected_branch.py File 6.92 KB 0644
gitlab_runner.py File 16.47 KB 0644
gitlab_user.py File 22.36 KB 0644
grove.py File 3.37 KB 0644
gunicorn.py File 6.73 KB 0644
hana_query.py File 7 KB 0644
haproxy.py File 17.2 KB 0644
heroku_collaborator.py File 4.21 KB 0644
hg.py File 9.77 KB 0644
hipchat.py File 6.28 KB 0644
homebrew.py File 30.28 KB 0644
homebrew_cask.py File 27.09 KB 0644
homebrew_tap.py File 7.59 KB 0644
homectl.py File 25.17 KB 0644
honeybadger_deployment.py File 3.76 KB 0644
hpilo_boot.py File 6.77 KB 0644
hpilo_info.py File 8.43 KB 0644
hponcfg.py File 3.1 KB 0644
htpasswd.py File 9.23 KB 0644
hwc_ecs_instance.py File 58.07 KB 0644
hwc_evs_disk.py File 34.9 KB 0644
hwc_network_vpc.py File 13.83 KB 0644
hwc_smn_topic.py File 9.79 KB 0644
hwc_vpc_eip.py File 26.16 KB 0644
hwc_vpc_peering_connect.py File 17.58 KB 0644
hwc_vpc_port.py File 30.1 KB 0644
hwc_vpc_private_ip.py File 9.57 KB 0644
hwc_vpc_route.py File 11.57 KB 0644
hwc_vpc_security_group.py File 18.89 KB 0644
hwc_vpc_security_group_rule.py File 17.45 KB 0644
hwc_vpc_subnet.py File 20.28 KB 0644
ibm_sa_domain.py File 4.35 KB 0644
ibm_sa_host.py File 3.38 KB 0644
ibm_sa_host_ports.py File 3.64 KB 0644
ibm_sa_pool.py File 3.06 KB 0644
ibm_sa_vol.py File 2.79 KB 0644
ibm_sa_vol_map.py File 3.71 KB 0644
icinga2_feature.py File 4.32 KB 0644
icinga2_host.py File 10.07 KB 0644
idrac_redfish_command.py File 7.79 KB 0644
idrac_redfish_config.py File 10.92 KB 0644
idrac_redfish_info.py File 7.95 KB 0644
ilo_redfish_command.py File 5.17 KB 0644
ilo_redfish_config.py File 5.46 KB 0644
ilo_redfish_info.py File 5.85 KB 0644
imc_rest.py File 15.01 KB 0644
imgadm.py File 9.8 KB 0644
infinity.py File 21.86 KB 0644
influxdb_database.py File 3.84 KB 0644
influxdb_query.py File 2.73 KB 0644
influxdb_retention_policy.py File 11.77 KB 0644
influxdb_user.py File 9.03 KB 0644
influxdb_write.py File 2.55 KB 0644
ini_file.py File 18.01 KB 0644
installp.py File 9.18 KB 0644
interfaces_file.py File 14.75 KB 0644
ip_netns.py File 3.49 KB 0644
ipa_config.py File 12.92 KB 0644
ipa_dnsrecord.py File 12.58 KB 0644
ipa_dnszone.py File 5.83 KB 0644
ipa_group.py File 11.41 KB 0644
ipa_hbacrule.py File 13.54 KB 0644
ipa_host.py File 10.51 KB 0644
ipa_hostgroup.py File 7.69 KB 0644
ipa_otpconfig.py File 5.69 KB 0644
ipa_otptoken.py File 22.64 KB 0644
ipa_pwpolicy.py File 8.83 KB 0644
ipa_role.py File 10.72 KB 0644
ipa_service.py File 7.15 KB 0644
ipa_subca.py File 7.54 KB 0644
ipa_sudocmd.py File 4.65 KB 0644
ipa_sudocmdgroup.py File 6.13 KB 0644
ipa_sudorule.py File 18.58 KB 0644
ipa_user.py File 13.82 KB 0644
ipa_vault.py File 7.93 KB 0644
ipify_facts.py File 2.91 KB 0644
ipinfoio_facts.py File 3.61 KB 0644
ipmi_boot.py File 6.45 KB 0644
ipmi_power.py File 8.27 KB 0644
iptables_state.py File 21.49 KB 0644
ipwcli_dns.py File 10.97 KB 0644
irc.py File 9.31 KB 0644
iso_create.py File 10.63 KB 0644
iso_customize.py File 11.19 KB 0644
iso_extract.py File 6.48 KB 0644
jabber.py File 4.56 KB 0644
java_cert.py File 19.97 KB 0644
java_keystore.py File 21.66 KB 0644
jboss.py File 5.84 KB 0644
jenkins_build.py File 9.01 KB 0644
jenkins_job.py File 11.73 KB 0644
jenkins_job_info.py File 7.49 KB 0644
jenkins_plugin.py File 27.48 KB 0644
jenkins_script.py File 6.6 KB 0644
jira.py File 26.18 KB 0644
kdeconfig.py File 8.16 KB 0644
kernel_blacklist.py File 4.04 KB 0644
keycloak_authentication.py File 19.1 KB 0644
keycloak_authz_authorization_scope.py File 9.72 KB 0644
keycloak_client.py File 36.33 KB 0644
keycloak_client_rolemapping.py File 12.5 KB 0644
keycloak_clientscope.py File 18.03 KB 0644
keycloak_clientscope_type.py File 8.93 KB 0644
keycloak_clientsecret_info.py File 4.47 KB 0644
keycloak_clientsecret_regenerate.py File 4.78 KB 0644
keycloak_clienttemplate.py File 16.01 KB 0644
keycloak_group.py File 16.42 KB 0644
keycloak_identity_provider.py File 22.37 KB 0644
keycloak_realm.py File 27.68 KB 0644
keycloak_realm_info.py File 3.82 KB 0644
keycloak_role.py File 11.54 KB 0644
keycloak_user_federation.py File 38.33 KB 0644
keycloak_user_rolemapping.py File 14.9 KB 0644
keyring.py File 8.28 KB 0644
keyring_info.py File 4.1 KB 0644
kibana_plugin.py File 7.94 KB 0644
launchd.py File 17.04 KB 0644
layman.py File 7.67 KB 0644
lbu.py File 2.88 KB 0644
ldap_attrs.py File 10.93 KB 0644
ldap_entry.py File 8.73 KB 0644
ldap_passwd.py File 3.95 KB 0644
ldap_search.py File 5.42 KB 0644
librato_annotation.py File 5.65 KB 0644
linode.py File 24.74 KB 0644
linode_v4.py File 9.45 KB 0644
listen_ports_facts.py File 14.46 KB 0644
lldp.py File 2.54 KB 0644
locale_gen.py File 7.23 KB 0644
logentries.py File 4.44 KB 0644
logentries_msg.py File 2.34 KB 0644
logstash_plugin.py File 4.82 KB 0644
lvg.py File 12.66 KB 0644
lvol.py File 21.61 KB 0644
lxc_container.py File 54.26 KB 0644
lxca_cmms.py File 4.56 KB 0644
lxca_nodes.py File 5.57 KB 0644
lxd_container.py File 30.1 KB 0644
lxd_profile.py File 17.68 KB 0644
lxd_project.py File 14.49 KB 0644
macports.py File 9.77 KB 0644
mail.py File 14.63 KB 0644
make.py File 6.44 KB 0644
manageiq_alert_profiles.py File 11.22 KB 0644
manageiq_alerts.py File 12.87 KB 0644
manageiq_group.py File 22.44 KB 0644
manageiq_policies.py File 6.58 KB 0644
manageiq_policies_info.py File 3.87 KB 0644
manageiq_provider.py File 35.9 KB 0644
manageiq_tags.py File 5.49 KB 0644
manageiq_tags_info.py File 3.41 KB 0644
manageiq_tenant.py File 17.7 KB 0644
manageiq_user.py File 9.6 KB 0644
mas.py File 8.77 KB 0644
matrix.py File 4 KB 0644
mattermost.py File 5.77 KB 0644
maven_artifact.py File 31.46 KB 0644
memset_dns_reload.py File 5.95 KB 0644
memset_memstore_info.py File 5.01 KB 0644
memset_server_info.py File 8.51 KB 0644
memset_zone.py File 10.9 KB 0644
memset_zone_domain.py File 9.23 KB 0644
memset_zone_record.py File 13.82 KB 0644
mksysb.py File 4.93 KB 0644
modprobe.py File 10.7 KB 0644
monit.py File 11.61 KB 0644
mqtt.py File 7.82 KB 0644
mssql_db.py File 7.14 KB 0644
mssql_script.py File 10.34 KB 0644
nagios.py File 41.18 KB 0644
netcup_dns.py File 8.16 KB 0644
newrelic_deployment.py File 5.7 KB 0644
nexmo.py File 3.65 KB 0644
nginx_status_info.py File 4.6 KB 0644
nictagadm.py File 5.97 KB 0644
nmcli.py File 103.39 KB 0644
nomad_job.py File 8.35 KB 0644
nomad_job_info.py File 12.15 KB 0644
nosh.py File 17.21 KB 0644
npm.py File 10.47 KB 0644
nsupdate.py File 19.44 KB 0644
ocapi_command.py File 8.68 KB 0644
ocapi_info.py File 6.5 KB 0644
oci_vcn.py File 7.99 KB 0644
odbc.py File 5.2 KB 0644
office_365_connector_card.py File 9.69 KB 0644
ohai.py File 1.38 KB 0644
omapi_host.py File 11.68 KB 0644
one_host.py File 9.92 KB 0644
one_image.py File 11.22 KB 0644
one_image_info.py File 7.71 KB 0644
one_service.py File 25.03 KB 0644
one_template.py File 7.79 KB 0644
one_vm.py File 59.44 KB 0644
oneandone_firewall_policy.py File 18.35 KB 0644
oneandone_load_balancer.py File 22.49 KB 0644
oneandone_monitoring_policy.py File 33.48 KB 0644
oneandone_private_network.py File 14.33 KB 0644
oneandone_public_ip.py File 9.74 KB 0644
oneandone_server.py File 22.31 KB 0644
onepassword_info.py File 16.47 KB 0644
oneview_datacenter_info.py File 4.82 KB 0644
oneview_enclosure_info.py File 7.85 KB 0644
oneview_ethernet_network.py File 8.95 KB 0644
oneview_ethernet_network_info.py File 5.95 KB 0644
oneview_fc_network.py File 4.03 KB 0644
oneview_fc_network_info.py File 3.55 KB 0644
oneview_fcoe_network.py File 3.83 KB 0644
oneview_fcoe_network_info.py File 3.47 KB 0644
oneview_logical_interconnect_group.py File 5.99 KB 0644
oneview_logical_interconnect_group_info.py File 4.01 KB 0644
oneview_network_set.py File 5.25 KB 0644
oneview_network_set_info.py File 5.14 KB 0644
oneview_san_manager.py File 7.77 KB 0644
oneview_san_manager_info.py File 4.17 KB 0644
online_server_info.py File 5.08 KB 0644
online_user_info.py File 1.88 KB 0644
open_iscsi.py File 14.72 KB 0644
openbsd_pkg.py File 26.47 KB 0644
opendj_backendprop.py File 6.99 KB 0644
openwrt_init.py File 5.92 KB 0644
opkg.py File 6.9 KB 0644
osx_defaults.py File 14.2 KB 0644
ovh_ip_failover.py File 8.7 KB 0644
ovh_ip_loadbalancing_backend.py File 11.29 KB 0644
ovh_monthly_billing.py File 5.03 KB 0644
pacemaker_cluster.py File 6.99 KB 0644
packet_device.py File 21.72 KB 0644
packet_ip_subnet.py File 10.73 KB 0644
packet_project.py File 7.07 KB 0644
packet_sshkey.py File 8.76 KB 0644
packet_volume.py File 9.13 KB 0644
packet_volume_attachment.py File 9.01 KB 0644
pacman.py File 31.36 KB 0644
pacman_key.py File 10.91 KB 0644
pagerduty.py File 8.89 KB 0644
pagerduty_alert.py File 8.91 KB 0644
pagerduty_change.py File 6.14 KB 0644
pagerduty_user.py File 9.15 KB 0644
pam_limits.py File 10.85 KB 0644
pamd.py File 30.43 KB 0644
parted.py File 25.85 KB 0644
pear.py File 11.32 KB 0644
pids.py File 6.7 KB 0644
pingdom.py File 3.88 KB 0644
pip_package_info.py File 4.3 KB 0644
pipx.py File 12.34 KB 0644
pipx_info.py File 6.58 KB 0644
pkg5.py File 5.2 KB 0644
pkg5_publisher.py File 5.47 KB 0644
pkgin.py File 11.7 KB 0644
pkgng.py File 18.61 KB 0644
pkgutil.py File 8.98 KB 0644
pmem.py File 21.09 KB 0644
portage.py File 16.14 KB 0644
portinstall.py File 6.74 KB 0644
pritunl_org.py File 5.52 KB 0644
pritunl_org_info.py File 3.6 KB 0644
pritunl_user.py File 10.08 KB 0644
pritunl_user_info.py File 4.65 KB 0644
profitbricks.py File 21.55 KB 0644
profitbricks_datacenter.py File 7.57 KB 0644
profitbricks_nic.py File 8.26 KB 0644
profitbricks_volume.py File 13.07 KB 0644
profitbricks_volume_attachments.py File 7.76 KB 0644
proxmox.py File 32.89 KB 0644
proxmox_disk.py File 27.7 KB 0644
proxmox_domain_info.py File 3.56 KB 0644
proxmox_group_info.py File 3.94 KB 0644
proxmox_kvm.py File 58.01 KB 0644
proxmox_nic.py File 10.28 KB 0644
proxmox_snap.py File 13.66 KB 0644
proxmox_storage_info.py File 5.61 KB 0644
proxmox_tasks_info.py File 5.1 KB 0644
proxmox_template.py File 8.66 KB 0644
proxmox_user_info.py File 7.99 KB 0644
pubnub_blocks.py File 23.72 KB 0644
pulp_repo.py File 25.61 KB 0644
puppet.py File 8.55 KB 0644
pushbullet.py File 5.82 KB 0644
pushover.py File 4.57 KB 0644
python_requirements_info.py File 6.21 KB 0644
rax.py File 32.63 KB 0644
rax_cbs.py File 7.03 KB 0644
rax_cbs_attachments.py File 7.05 KB 0644
rax_cdb.py File 7.99 KB 0644
rax_cdb_database.py File 4.8 KB 0644
rax_cdb_user.py File 6.31 KB 0644
rax_clb.py File 9.61 KB 0644
rax_clb_nodes.py File 8.63 KB 0644
rax_clb_ssl.py File 9.9 KB 0644
rax_dns.py File 5.25 KB 0644
rax_dns_record.py File 11.75 KB 0644
rax_facts.py File 4.52 KB 0644
rax_files.py File 12.19 KB 0644
rax_files_objects.py File 17.24 KB 0644
rax_identity.py File 3 KB 0644
rax_keypair.py File 5.14 KB 0644
rax_meta.py File 5.06 KB 0644
rax_mon_alarm.py File 7.66 KB 0644
rax_mon_check.py File 11.26 KB 0644
rax_mon_entity.py File 6.12 KB 0644
rax_mon_notification.py File 5.21 KB 0644
rax_mon_notification_plan.py File 6.09 KB 0644
rax_network.py File 3.74 KB 0644
rax_queue.py File 3.49 KB 0644
rax_scaling_group.py File 14.15 KB 0644
rax_scaling_policy.py File 8.91 KB 0644
read_csv.py File 6.36 KB 0644
redfish_command.py File 30.56 KB 0644
redfish_config.py File 13.2 KB 0644
redfish_info.py File 19.79 KB 0644
redhat_subscription.py File 47.28 KB 0644
redis.py File 10.67 KB 0644
redis_data.py File 7.41 KB 0644
redis_data_incr.py File 5.98 KB 0644
redis_data_info.py File 2.87 KB 0644
redis_info.py File 7.3 KB 0644
rhevm.py File 49.79 KB 0644
rhn_channel.py File 6.45 KB 0644
rhn_register.py File 15.37 KB 0644
rhsm_release.py File 4.1 KB 0644
rhsm_repository.py File 9.19 KB 0644
riak.py File 7.26 KB 0644
rocketchat.py File 7.85 KB 0644
rollbar_deployment.py File 4.1 KB 0644
rpm_ostree_pkg.py File 4.48 KB 0644
rundeck_acl_policy.py File 7.45 KB 0644
rundeck_job_executions_info.py File 5.52 KB 0644
rundeck_job_run.py File 10.55 KB 0644
rundeck_project.py File 5.46 KB 0644
runit.py File 7.88 KB 0644
sap_task_list_execute.py File 11.85 KB 0644
sapcar_extract.py File 7.38 KB 0644
say.py File 2.48 KB 0644
scaleway_compute.py File 23.75 KB 0644
scaleway_compute_private_network.py File 5.95 KB 0644
scaleway_container.py File 12.53 KB 0644
scaleway_container_info.py File 4.25 KB 0644
scaleway_container_namespace.py File 9.25 KB 0644
scaleway_container_namespace_info.py File 4.14 KB 0644
scaleway_container_registry.py File 8.03 KB 0644
scaleway_container_registry_info.py File 4.03 KB 0644
scaleway_database_backup.py File 11.92 KB 0644
scaleway_function.py File 11.85 KB 0644
scaleway_function_info.py File 4.16 KB 0644
scaleway_function_namespace.py File 9.21 KB 0644
scaleway_function_namespace_info.py File 4.11 KB 0644
scaleway_image_info.py File 3.79 KB 0644
scaleway_ip.py File 7.17 KB 0644
scaleway_ip_info.py File 2.8 KB 0644
scaleway_lb.py File 10.42 KB 0644
scaleway_organization_info.py File 3.02 KB 0644
scaleway_private_network.py File 6.74 KB 0644
scaleway_security_group.py File 7.27 KB 0644
scaleway_security_group_info.py File 3.08 KB 0644
scaleway_security_group_rule.py File 7.77 KB 0644
scaleway_server_info.py File 6.75 KB 0644
scaleway_snapshot_info.py File 3.16 KB 0644
scaleway_sshkey.py File 4.86 KB 0644
scaleway_user_data.py File 5.17 KB 0644
scaleway_volume.py File 5.14 KB 0644
scaleway_volume_info.py File 2.96 KB 0644
sefcontext.py File 13.65 KB 0644
selinux_permissive.py File 4.13 KB 0644
selogin.py File 7.24 KB 0644
sendgrid.py File 9.14 KB 0644
sensu_check.py File 12.81 KB 0644
sensu_client.py File 8.96 KB 0644
sensu_handler.py File 9.12 KB 0644
sensu_silence.py File 8.55 KB 0644
sensu_subscription.py File 4.92 KB 0644
seport.py File 8.93 KB 0644
serverless.py File 6.85 KB 0644
shutdown.py File 2.25 KB 0644
sl_vm.py File 12.47 KB 0644
slack.py File 19.4 KB 0644
slackpkg.py File 6.36 KB 0644
smartos_image_info.py File 3.45 KB 0644
snap.py File 13.94 KB 0644
snap_alias.py File 5.61 KB 0644
snmp_facts.py File 15.6 KB 0644
solaris_zone.py File 16.76 KB 0644
sorcery.py File 20.13 KB 0644
spectrum_device.py File 10.58 KB 0644
spectrum_model_attrs.py File 20.53 KB 0644
spotinst_aws_elastigroup.py File 49.74 KB 0644
ss_3par_cpg.py File 9.22 KB 0644
ssh_config.py File 11.22 KB 0644
stackdriver.py File 6.68 KB 0644
stacki_host.py File 10.32 KB 0644
statsd.py File 4.89 KB 0644
statusio_maintenance.py File 16.93 KB 0644
sudoers.py File 8.21 KB 0644
supervisorctl.py File 9.26 KB 0644
svc.py File 9.21 KB 0644
svr4pkg.py File 7.71 KB 0644
swdepot.py File 6.04 KB 0644
swupd.py File 8.82 KB 0644
syslogger.py File 5.62 KB 0644
syspatch.py File 4.1 KB 0644
sysrc.py File 7.22 KB 0644
sysupgrade.py File 4.25 KB 0644
taiga_issue.py File 11.1 KB 0644
telegram.py File 4.17 KB 0644
terraform.py File 25.6 KB 0644
timezone.py File 36.39 KB 0644
twilio.py File 5.86 KB 0644
typetalk.py File 3.41 KB 0644
udm_dns_record.py File 7.01 KB 0644
udm_dns_zone.py File 7.03 KB 0644
udm_group.py File 5.04 KB 0644
udm_share.py File 18.8 KB 0644
udm_user.py File 18.57 KB 0644
ufw.py File 22.58 KB 0644
uptimerobot.py File 3.85 KB 0644
urpmi.py File 6.32 KB 0644
utm_aaa_group.py File 7.3 KB 0644
utm_aaa_group_info.py File 3.58 KB 0644
utm_ca_host_key_cert.py File 4.62 KB 0644
utm_ca_host_key_cert_info.py File 2.99 KB 0644
utm_dns_host.py File 4.86 KB 0644
utm_network_interface_address.py File 3.9 KB 0644
utm_network_interface_address_info.py File 2.81 KB 0644
utm_proxy_auth_profile.py File 12.12 KB 0644
utm_proxy_exception.py File 7.56 KB 0644
utm_proxy_frontend.py File 9.02 KB 0644
utm_proxy_frontend_info.py File 4.33 KB 0644
utm_proxy_location.py File 6.69 KB 0644
utm_proxy_location_info.py File 3.66 KB 0644
vdo.py File 31.63 KB 0644
vertica_configuration.py File 6.42 KB 0644
vertica_info.py File 9.15 KB 0644
vertica_role.py File 8.03 KB 0644
vertica_schema.py File 11.41 KB 0644
vertica_user.py File 14.03 KB 0644
vexata_eg.py File 5.77 KB 0644
vexata_volume.py File 5.06 KB 0644
vmadm.py File 24.5 KB 0644
wakeonlan.py File 3.72 KB 0644
wdc_redfish_command.py File 10.37 KB 0644
wdc_redfish_info.py File 6.29 KB 0644
webfaction_app.py File 5.92 KB 0644
webfaction_db.py File 5.88 KB 0644
webfaction_domain.py File 5.06 KB 0644
webfaction_mailbox.py File 4.08 KB 0644
webfaction_site.py File 6.59 KB 0644
xattr.py File 6.81 KB 0644
xbps.py File 11.18 KB 0644
xcc_redfish_command.py File 30.16 KB 0644
xenserver_facts.py File 5.27 KB 0644
xenserver_guest.py File 97.16 KB 0644
xenserver_guest_info.py File 7.63 KB 0644
xenserver_guest_powerstate.py File 9.96 KB 0644
xfconf.py File 9.96 KB 0644
xfconf_info.py File 5.29 KB 0644
xfs_quota.py File 14.61 KB 0644
xml.py File 35.6 KB 0644
yarn.py File 12.68 KB 0644
yum_versionlock.py File 5.37 KB 0644
zfs.py File 9.46 KB 0644
zfs_delegate_admin.py File 9.46 KB 0644
zfs_facts.py File 7.84 KB 0644
znode.py File 9.07 KB 0644
zpool_facts.py File 6.11 KB 0644
zypper.py File 20.8 KB 0644
zypper_repository.py File 16.99 KB 0644