3.10 Automation

The automation uses AWX, an OSS. Automation is an extension of the workflow, and by linking it with Playbook, it is possible to automatically execute jobs. The job execution results can also be confirmed.
Using the example of linking the Playbook called “Playbookβ.yaml” that is registered in the GitLab repository to AWX and executing it, the following section shows the procedure required in AWX.

  • Registering authentication information
  • Setting projects
  • Registering inventory
  • Registering templates
  • Checking job execution results

To perform these registration and configuration operations, you must be a user with a role assigned by the AWX organization that matches each operation.
For details on roles, see “Organization management” and the AWX manual. For information on the AWX manuals, versions and editions, see “OSS version/edition and reference manuals” in the Appendix. In addition, for organization outlines, information on creating organizations and assigning roles, see “Configuring organization” and “Organization management”.
For information on how to register Playbook files with a repository, see “Register YAML files with GitLab (GUI)” and “Register YAML files with GitLab (CUI)”.

Please note that this application does not support functions other than registering authentication information for job execution, registering inventory, setting projects, registering templates, checking execution results, and registering execution environments. Please do not attempt to use them. For information on registering an execution environment, see “Registering custom execution environments with AWX”.

An example of a Playbook definition is shown below. In this example, an Ops I token is obtained in order to execute the Ops API from the Playbook.
<Definition example>

- name: get_license_automation_usage
  hosts: all
  gather_facts: false

  tasks:
    - name: Get secret from Vault
      set fact:
        ## Obtain the value of opsi_token in the format {{ lookup('env', '<parameter name>') }}
        my_secret: "{{ lookup('env', 'opsi_token') }}"

    - name: Get job templates with token
      uri:
        url: "Ops I URL/api/v1/practice-contexts"
        method: GET
        headers:
          Content-Type: application/json
          ## Use the obtained token
          X-OpsI-Token: "{{ my_secret }}"
        validate_certs: no
        return_content: yes
      register: result

    - debug:
      var: result.content



Section structure

3.10.1 Registering authentication information
3.10.2 Setting projects
3.10.3 Registering inventory
3.10.4 Registering templates
3.10.5 Checking job execution results