-
Notifications
You must be signed in to change notification settings - Fork 0
Action Module Configuration
TF edited this page Jan 10, 2023
·
8 revisions
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.
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) |
collection |
at the moment the only supported option is devices here, might get extended to other collections (locations, orgs, etc) |
attributes |
ansible type = list. Content depends on the defined collection. |
The following describes possible options for the collection: devices beyond the option attributes.
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:
- "Name": above option name has to be 100% identical (when using special chars they must be quoted)
- "Organisation": a field is only available for devices belonging to the same org
- "Group": device must be part of the group where this field belongs to (not 100% about that one though)
- "Type": if it is set to a list you can set the here defined values only
- name: Update my hosts
gather_facts: false
hosts: all
become: no
tasks:
- name: "Update device attributes"
connection: local
sedi.openaudit.set:
api_server: openaudit.myserver.com
api_protocol: https
username: "{{ vault_api_server_user }}"
password: "{{ vault_api_server_password }}"
validate_certs: false
collection: devices
attributes:
- 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