Skip to content
TF edited this page Dec 19, 2022 · 20 revisions

Install

ansible-galaxy collection install git+https://github.com/secure-diversITy/ansible_openaudit [-p <collection-path>]

Uninstall

  1. rm -rf <collection-path>/ansible_collections/sedi/openaudit/
  2. remove sedi.openaudit.inventory from the [inventory] stanza of your ansible.cfg

Upgrade

Follow the above steps to upgrade:

  1. Uninstall (but skip step-2, i.e skip the ansible.cfg removal)
  2. Install

Module configuration

It is recommended to encrypt your credentials for accessing the Open-AudIT API.
Due to the nature of how Ansible works this can be done inline only (i.e. not a full encrypted vault file).

Example:

  1. ansible-vault encrypt_string 'this-is-my-username' --name oa_username --ask-vault-pass
  2. ansible-vault encrypt_string 'this-is-my-password' --name oa_password --ask-vault-pass

Example inventory file ( e.g. named: inventory.openaudit.yaml):

plugin: sedi.openaudit.inventory
oa_api_server: openaudit.myserver.com
oa_api_proto: https
oa_username: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          37613130323132393165303666656339343436666437383165653333643466636537633830656236
          3331393866363762303061393564643663626366663839300a306435383232623061373730353737
          38353536336463636430336337353531633737396531636535333738303165643631333238393936
          3238626537636536650a356536393164306633656539316464393265663136623066636330663364
          38386461393135633636636138353433333134373034316232633935383162316462
oa_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          30333461363261633939656530633836373661663465666263633664616266373734336662363261
          3832343361653132306464393162633532333438383531650a666138646135316239316434336435
          37306535393365663736326264396436623534343465323737316635316237653566363364633430
          6434313164326461340a663138356137366365666638316239303135643234303662393839376132
          62373835363736323561356165373230656537343032633563363361633162373135

oa_fieldsTranslate:
    cmdb_foo: 7
    myvar_for_ansible: 13
    my_other_var: 21

groups:
    edge_devices: "'edge' in inventory_hostname"
    backup_servers: inventory_hostname.startswith('backup')
    non_gigabyte_devices: cmdb_manufacturer.upper() != "GIGABYTE"

keyed_groups:
    - prefix: FAI_profile
      key: cmdb_fai_profile
    - prefix: VENDOR
      key: cmdb_manufacturer.lower()

compose:
   ansible_host: cmdb_ip

Check Variables for details regarding the meaning of oa_fieldsTranslate and the module documentation for the rest.

Ansible configuration

add this module to your ansible.cfg

[inventory]
enable_plugins = sedi.openaudit.inventory

Clone this wiki locally