def main():
    module = AnsibleModule(
        argument_spec=dict(
            host=dict(required=True, type='str'),
            login=dict(default='Administrator', type='str'),
            password=dict(default='admin', type='str', no_log=True),
            iso_url=dict(required=True, type='str'),
            boot_on_next_server_reset=dict(default=True, type='bool'),
            state=dict(default='present', choices=['present', 'absent'])
        ),
        supports_check_mode=True
    )

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    iso_url = module.params['iso_url']
    boot_on_next_server_reset = module.params['boot_on_next_server_reset']
    state = module.params['state']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    if module.check_mode:
        check_mount_iso(module, REST_OBJ, iso_url, boot_on_next_server_reset, state)

    mount_iso(module, REST_OBJ, iso_url, boot_on_next_server_reset, state)
def main():
    module = AnsibleModule(argument_spec=dict(host=dict(required=True,
                                                        type='str'),
                                              login=dict(
                                                  default='Administrator',
                                                  type='str'),
                                              password=dict(default='admin',
                                                            type='str',
                                                            no_log=True),
                                              timezone=dict(required=True,
                                                            type='str'),
                                              ntp_server_1=dict(required=True,
                                                                type='str'),
                                              ntp_server_2=dict(required=True,
                                                                type='str')),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    timezone = module.params['timezone']
    ntp_server_1 = module.params['ntp_server_1']
    ntp_server_2 = module.params['ntp_server_2']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    configure_datetime(module, REST_OBJ, timezone, ntp_server_1, ntp_server_2)
def main():
    module = AnsibleModule(argument_spec=dict(
        host=dict(required=True, type='str'),
        login=dict(default='Administrator', type='str'),
        password=dict(default='admin', type='str', no_log=True),
        action=dict(default='ForceSystemReset',
                    choices=[
                        'GracefulReset', 'GracefulPowerOff', 'PowerOn',
                        'ForcePowerOff', 'ForceSystemReset', 'ColdBoot'
                    ])),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    action = module.params['action']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    if module.check_mode:
        module.exit_json(changed=True,
                         msg="Server power state would be changed (" + action +
                         ")")

    server_power(module, REST_OBJ, action)
Пример #4
0
def main():
    module = AnsibleModule(argument_spec=dict(
        host=dict(required=True, type='str'),
        login=dict(default='Administrator', type='str'),
        password=dict(default='admin', type='str', no_log=True),
        ipv4=dict(default=True, type='bool'),
        ipv4_address=dict(default='DHCP', type='str'),
        ipv4_subnet_mask=dict(type='str'),
        ipv4_gateway=dict(type='str'),
        ipv6=dict(default=False, type='bool'),
        hostname=dict(required=True, type='str'),
        domain=dict(required=True, type='str'),
        dns_server_1=dict(required=True, type='str'),
        dns_server_2=dict(required=True, type='str')),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    ipv4 = module.params['ipv4']
    ipv4_address = module.params['ipv4_address']
    ipv4_subnet_mask = module.params['ipv4_subnet_mask']
    ipv4_gateway = module.params['ipv4_gateway']
    ipv6 = module.params['ipv6']
    hostname = module.params['hostname']
    domain = module.params['domain']
    dns_server_1 = module.params['dns_server_1']
    dns_server_2 = module.params['dns_server_2']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    if module.check_mode:
        check_network_setting(module, REST_OBJ, ipv4, ipv4_address,
                              ipv4_subnet_mask, ipv4_gateway, ipv6, hostname,
                              domain, dns_server_1, dns_server_2)

    set_network_setting(module, REST_OBJ, ipv4, ipv4_address, ipv4_subnet_mask,
                        ipv4_gateway, ipv6, hostname, domain, dns_server_1,
                        dns_server_2)
def main():
    """Main"""
    module = AnsibleModule(
        argument_spec=dict(
            host=dict(required=True, type='str'),
            login=dict(default='Administrator', type='str'),
            password=dict(default='admin', type='str', no_log=True)
        ),
        supports_check_mode=True
    )

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    get_bios_settings(module, REST_OBJ)
Пример #6
0
def main():
    module = AnsibleModule(argument_spec=dict(
        host=dict(required=True, type='str'),
        login=dict(default='Administrator', type='str'),
        password=dict(default='admin', type='str', no_log=True),
        login_name=dict(required=True, type='str'),
        user_name=dict(required=True, type='str'),
        user_password=dict(required=True, type='str', no_log=True),
        update_password=dict(required=False, type='bool'),
        irc=dict(required=True, type='bool'),
        cfg=dict(required=True, type='bool'),
        virtual_media=dict(required=True, type='bool'),
        usercfg=dict(required=True, type='bool'),
        vpr=dict(required=True, type='bool'),
        state=dict(default='present', choices=['present', 'absent'])),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    login_name = module.params['login_name']
    user_name = module.params['user_name']
    user_password = module.params['user_password']
    update_password = module.params['update_password']
    irc = module.params['irc']  # Integrated Remote Console
    cfg = module.params['cfg']  # Configure iLO Settings
    virtual_media = module.params['virtual_media']  # Virtual Media
    usercfg = module.params['usercfg']  # Administer User Accounts
    vpr = module.params['vpr']  # Virtual Power and Reset
    state = module.params['state']

    ilo_url = "https://" + ilo_hostname

    # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    configure_user_account(module, REST_OBJ, login_name, user_name,
                           user_password, update_password, irc, cfg,
                           virtual_media, usercfg, vpr, state)
Пример #7
0
def main():
    module = AnsibleModule(argument_spec=dict(host=dict(required=True,
                                                        type='str'),
                                              login=dict(
                                                  default='Administrator',
                                                  type='str'),
                                              password=dict(default='admin',
                                                            type='str',
                                                            no_log=True)),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    if module.check_mode:
        module.exit_json(changed=True, msg="iLO would be reset")

    reset_ilo(module, REST_OBJ)
Пример #8
0
def main():
    module = AnsibleModule(argument_spec=dict(
        host=dict(required=True, type='str'),
        login=dict(default='Administrator', type='str'),
        password=dict(default='admin', type='str', no_log=True),
        bios_property=dict(required=True, type='str'),
        property_value=dict(required=True, type='str')),
                           supports_check_mode=True)

    ilo_hostname = module.params['host']
    ilo_login = module.params['login']
    ilo_password = module.params['password']
    change_property = module.params['bios_property']
    change_value = module.params['property_value']

    ilo_url = "https://" + ilo_hostname

    # # Create a REST object
    REST_OBJ = RestObject(module, ilo_url, ilo_login, ilo_password)

    if module.check_mode:
        check_bios_setting(module, REST_OBJ, change_property, change_value)

    set_bios_setting(module, REST_OBJ, change_property, change_value)