avantra.core.server module – manage Avantra servers

Note

This module is part of the avantra.core collection (version 23.0.3).

To install it, use: ansible-galaxy collection install avantra.core.

To use it in a playbook, specify: avantra.core.server.

New in avantra.core 23.0.0

Synopsis

  • You can create, delete or update servers in Avantra.

  • Start, stop, restart servers using Avantra functionality.

  • A server is always identified with its server_name and customer_name.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

application_type

string

The application type for this monitored system.

More information can be found here https://docs.avantra.com/product-guide/latest/avantra/glossary/a.html#application-type.

avantra_api_password

string

The password or API key for the selected Avantra user.

We highly recommend to use Ansible Vaults to protect you sensitive content.

avantra_api_url

string / required

A valid URL pointing to an Avantra UI.

For example https://avantra-ui/xn

avantra_api_user

string

Valid Avantra user principal.

credentials

dictionary

Add credentials to this server. See the examples for more information on how to set the different credential types. The key for the child objects is one of the credential keys found in Avantra.

custom_attributes

dictionary

Define custom attributes for the monitored system as key value pairs. See https://docs.avantra.com/product-guide/latest/avantra/custom-attributes.html for an explanation.

Default: {}

customer_name

string / required

The customer name to identify the server.

description

string

The description for the server.

dns_domain

string

Configures the DNS domain for this server.

This has to a domain registered in Avantra.

exists_state

string

If present the server with the given parameter is created in case is does not exist or modified in case it exists.

If absent the server identified by the server_name and customer_name is deleted if it exists.

Choices:

  • "present" ← (default)

  • "absent"

fqdn_or_ip_address

string

Configures how the server can be reached over the network. Can be an IP address or a host name.

If exists_state=present and the server has to be created this parameter is mandatory.

host_aliases

list / elements=string

A list of valid host aliases.

monitoring

boolean

Should the monitoring be turned on or off.

This applies only to exists_state=present.

For exists_state=absent this parameter will be ignored.

Choices:

  • false

  • true

notes

string

The notes for the server.

run_options

dictionary

Allows you to configure the behaviour of the run_state changes.

Default: {}

always_execute

boolean

Ignore the current state and just execute the start/stop.

Choices:

  • false ← (default)

  • true

execution_name

string

Defines a name for the action to be executed.

force_stop

boolean

Avantra checks for known running applications (ie. applications with monitoring turned on) and cancels a stop if some are found. With force_stop=true, the server will be stopped in any case.

Choices:

  • false

  • true ← (default)

monitoring

boolean

If run_state=started this parameter defaults to true.

If run_state=stopped this parameter defaults to false.

If run_state=restarted this parameter is ignored.

Choices:

  • false

  • true

wait_seconds

integer

Defines the wait time in seconds after a server start before executing next steps.

Default: 60

run_state

string

If started and the current state is run_state=stopped or run_state=unknown the server will be started.

If stopped and the current state is run_state=started or run_state=unknown the server will be started.

Note: if exists_state=absent and the server exists the run state change will be applied before the server is deleted. If exists_state=present the run state change will be executed after the server has been created.

Choices:

  • "started"

  • "stopped"

server_name

string / required

The name to identify the server.

system_role

string

Configures the system role.

If exists_state=present and the system has to be created this parameter is mandatory.

By default the following roles are available: Consolidation, Development, Education, Integration, Production, Quality assurance, Sandpit, Test. The can be customized in Avantra.

timezone

string

Configures the timezone for the system.

token

string

The token used to authenticate during the task execution. A token can be fetched with the avantra.core.login module. If token is defined avantra_api_user and avantra_api_password are not necessary.

Notes

Note

  • This module does NOT support check_mode.

  • We highly recommend to use Ansible Vaults to protect your sensitive content.

See Also

See also

Avantra Documentation

The official Avantra documentation.

Examples

- name: Create Server if it doesn't exist
  avantra.core.server:
    exists: present
    server_name: "agent_5432"
    customer_name: "Avantra 1"
    fqdn_or_ip_address: "host5432"
    system_role: "Test"
    host_aliases:
      - host-5432
    credentials:
      avantra.basic:
        cred_type: basic
        username: <username>
        password: <password>
      avantra.abc:
        cred_type: ssh
        username: <username>
        password: <password>
        hostname: home
        port: 4321
        config:
          ssh_option1: <value>

# Start an existing server
- name: Start Server
  avantra.core.server:
    server_name: "agent_54323"
    customer_name: "Avantra 1"
    run_state: started
    run_options:
      always_execute: true

Return Values

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

Key

Description

server

dictionary

If exists_state=present and the server can be identified the system information is returned.

Returned: present

Authors

  • Michael Szediwy (@avantra-mis)