sedi.openaudit.get (2.1.0) — module

Request a given field/attribute of an existing device in Open-AudIT

| "added in version" 2.1.0 of sedi.openaudit"

Authors: Thomas Fischer (@se-di)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install sedi.openaudit:==2.1.0


Add to requirements.yml

  collections:
    - name: sedi.openaudit
      version: 2.1.0

Description

Returns the value of a requested field/attribute in Open-AudIT.

This plugin is B(not) developed by Firstwave (was Opmantek until 2021) nor has any commercial relationship to them.

It is simply a contribution to the community in the hope it is useful and of course without any warranties.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
For more examples and details check L(documentation,https://github.com/secure-diversITy/ansible_openaudit_inventory/wiki)

---
- name: Request a field in OA
  gather_facts: false
  hosts: all

  tasks:
    - name: "Get status info for {{ inventory_hostname }}"
      connection: local
      become: no
      sedi.openaudit.get:
        api_server: my.openauditserver.local
        api_protocol: https
        username: "{{ vault_api_server_user }}"
        password: "{{ vault_api_server_password }}"
        return_content: true
        validate_certs: false
        collection: devices
        attributes:
            - fqdn: "{{ inventory_hostname }}"
              field: oa.status

Inputs

    
password:
    description:
    - Password for logging into the API.
    - Avoid storing sensitive data in clear text by using e.g. Ansible Vault
    required: true

username:
    description:
    - Username for logging into the API.
    - Avoid storing sensitive data in clear text by using e.g. Ansible Vault
    required: true

api_server:
    description: FQDN or IP of the Open-AudIT server API
    required: true

attributes:
    description: A valid Open-AudIT field/attribute name of a collection type (see collection)
    required: true
    suboptions:
      field:
        description:
        - The requested field/attribute. Must be available in Open-AudIT as predefined
          attribute or
        - from your own field mappings in "oa_fieldsTranslate" (e.g. in ./inventories/dynamic/inventory.openaudit.yml).
        - The easiest way to get a list of all valid Open-AudIT fields is specifying an
          invalid key
        - (e.g. set C(oa.invalidkey)) and it will print all available (internal, i.e.
          not custom) field names.
        - Important is that you have to set exactly the value(!)/value store(!) as it
          is defined in Open-AudIT.
        - For custom field lists C(fields -> List -> Values) or internal lists in C(attributes
          -> list -> Value store)
        required: true
      fqdn:
        description: The FQDN of the device to be updated (must match the field 'FQDN'
          of that device within Open-AudIT)
        required: true

collection:
    choices:
    - devices
    description:
    - The collection name/type.
    - For details & examples check the L(documentation,https://github.com/secure-diversITy/ansible_openaudit_inventory/wiki).
    required: true

api_protocol:
    choices:
    - http
    - https
    description: Protocol to be used for accessing the Open-AudIT server API
    required: true

Outputs

value:
  description: The value of the requested field/attribute or if invalid a list of
    valid fields/attributes
  returned: success
  sample: 10.1.1.123
  type: str

See also