sedi / sedi.openaudit / 2.1.0 / module / set Updates defined attributes for an existing device in Open-AudIT | "added in version" 1.2.0 of sedi.openaudit" Authors: Thomas Fischer (@se-di) This plugin has a corresponding action plugin.sedi.openaudit.set (2.1.0) — module
Install with ansible-galaxy collection install sedi.openaudit:==2.1.0
collections: - name: sedi.openaudit version: 2.1.0
Updates any field of an existing device object 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.
For more examples and details check L(documentation,https://github.com/secure-diversITy/ansible_openaudit_inventory/wiki) --- - name: Update OA gather_facts: false hosts: all tasks: - name: "Update CMDB info for {{ inventory_hostname }}" connection: local become: no sedi.openaudit.set: 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 }}" fields: oa.org_id: 2 oa.oae_manage: n oa.owner: sedi oa.class: server oa.type: computer oa.manufacturer: "Gigabyte" oa.status: staging # custom fields: network_configuration: 'true' my_other_custom_field: "{{ another_var }}"
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 list of device key/value pairs required: true suboptions: fields: description: - A dictionary of field names including their target values. - The field name is either specified in your own field mappings in "oa_fieldsTranslate" - (e.g. in ./inventories/dynamic/inventory.openaudit.yml) or is a valid internal Open-AudIT field. - 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. - You can set any (valid) field name you wish to update. - Important is that for drop-down lists in Open-AudIT you have to set exactly the value as it is defined! - For custom field lists C(fields -> List -> Values) or internal lists in C(attributes -> list -> Value store) - If you want to specify a boolean C(true|false) as value, you HAVE TO quote it so it gets not translated by Ansible. required: true type: dict 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
Changed Open-AudIT fields: description: Each (translated) Open-AudIT field with its changed value returned: always sample: Changed Open-AudIT fields: network_ip: changed to 10.1.1.124 type: dict