Skip to content

Action Module Configuration

TF edited this page Dec 23, 2022 · 8 revisions

Action Module

It is highly recommended to store the previously created API credentials in an Ansible Vault and then using the vault variable(s) in your tasks.

Options

the following options are mandatory for a task:

option description
api_server the Open-AudIT server FQDN or IP
api_protocol how the API can be accessed, can be http or https only
username api username (pls add use a vault, see above)
password api password (pls add use a vault, see above)
device ansible type: list. at the moment the only supported option is device here, might get extended to other collections (locations, orgs, etc)

Option: device

The following describes possible options for the type: device. All mentioned options are mandatory.

option description
fqdn The FQDN matching the FQDN field in Open-AudIT
fields ansible type: dict. Any (really any) field name(!) which is available* for a device

* if you have an issue with custom fields not getting updated check the custom field:

  1. "Name": above option name has to be 100% identical (when using special chars they must be quoted)
  2. "Organisation": a field is only available for devices belonging to the same org
  3. "Group": device must be part of the group where this field belongs to (not 100% about that one though)
  4. "Type": if it is set to a list you can set the here defined values only

Example

- name: Update my hosts
  gather_facts: false
  hosts: all
  become: no

  tasks:
    - name: "Update device attributes"
      connection: local
      sedi.openaudit.update:
        api_server: openaudit.myserver.com
        api_protocol: https
        username: "{{ vault_api_server_user }}"
        password: "{{ vault_api_server_password }}"
        validate_certs: false
        device:
            - fqdn: "{{ inventory_hostname }}"
              fields:
                "my field definition in OA (yes exactly as shown as in name)": 9.9.9.9
                "ansible-var: network_configuration": 'false'
                "ansible-var: kiosk_base_url": "http://localhost:9800"
                org_id: 1
                manufacturer: "My custom Vendor"
                status: production

Clone this wiki locally