Aurora Store now runs its automation from AWX: a project synced from Gitea, an inventory imported from the repository and three job templates. But so far you've done everything as admin, the superuser, and the three credentials from Lesson 7.3 were created by filling in just the bare minimum. This lesson completes the two pieces that turn AWX into a team platform: credentials, which let people use secrets without knowing them (their types, how they're injected into each job, why whoever launches a job can't see them and how to create your own types), and role-based access control (RBAC), with which you'll give each person at Aurora exactly the permissions they need. You'll finish with a workflow (Workflow Template) that chains together the project sync, a check, a human approval and the website deployment, so that Development can request a deployment and Operations decides when it's applied.

Contents

  1. What a credential is in AWX
  2. Credential types
  3. Aurora's credentials in detail
  4. How credentials are injected into a job
  5. Why whoever launches can't see the secret (and the limits of that)
  6. Custom credential types
  7. RBAC: organizations, teams, users and roles
  8. Aurora's permission design
  9. Creating users and teams, and assigning roles
  10. Checking the permissions
  11. Workflows: concepts
  12. The Aurora - Release web version workflow
  13. Launching the workflow and approving

  1. What a credential is in AWX

A credential is an AWX object that stores one or more secrets (an SSH key, a password, a token) encrypted in the database, along with non-secret data (a username, a URL). Each credential has a type that defines which fields it has and how it's delivered to the job: as a command-line option, as an environment variable, as a temporary file or as an Ansible variable.

The central idea is to separate using a secret from knowing it: Marc can launch a template that connects to db1 over SSH without ever having the private key on his computer.

  1. Credential types

AWX comes with many predefined types. The most common ones:

Type What it stores What for
Machine Username, password and/or private SSH key (with its passphrase), privilege escalation method, username and password Connecting to the inventory hosts (SSH or WinRM) and using become
Source Control Username and password or token, or SSH key Cloning projects from Git
Vault Vault password and its identifier (vault ID) Decrypting Ansible Vault files and values
Ansible Galaxy/Automation Hub API Token Server URL and token Downloading roles and collections (attached to the organization)
Container Registry URL, username and password of a container registry Pulling execution environments from private registries (Lesson 7.6)
Cloud: Amazon Web Services, Microsoft Azure Resource Manager, Google Compute Engine, VMware vCenter, OpenStack… Access keys or service accounts Dynamic inventories and cloud modules (Lessons 8.4 and 10.2)
OpenShift or Kubernetes API Bearer Token API URL and token Container groups and Kubernetes automation (Lesson 8.2)
Network Username, password or key, enable password Network devices with legacy connections
External managers: HashiCorp Vault Secret Lookup, CyberArk, Azure Key Vault… How to connect to the manager Fetching another credential's value from an external secrets manager at run time
GitHub/GitLab Personal Access Token Token Letting AWX report status back to those platforms when a template is launched by webhook

A template can carry several credentials at once, with one limitation: at most one of each type, except for Vault credentials, of which there can be several as long as they have different identifiers (for example, staging and production once Lesson 9.1 separates the environments).

  1. Aurora's credentials in detail

Review the three credentials from Lesson 7.3 with all their fields:

Aurora - SSH lab (Machine):

Field Value Comment
Username vagrant Equivalent to remote_user / -u
Password (empty) Aurora uses a key, not a password
SSH Private Key Contents of ~/.ssh/aurora_ed25519 Pasted in full, with the BEGIN/END lines
Private Key Passphrase (empty) The lab key has no passphrase (Lesson 1.3)
Privilege Escalation Method sudo Equivalent to become_method
Privilege Escalation Username (empty = root)
Privilege Escalation Password (empty) vagrant has passwordless sudo in the lab

The password fields have a Prompt on launch checkbox: if you check it, AWX doesn't store the value and asks for it on every launch. It's useful for secrets nobody wants left stored, at the cost of not being able to schedule those runs.

Security: the aurora_ed25519 key is a lab key without a passphrase that gives access to all the servers. In a company, each environment would have its own Machine credential with its own key, and the remote user would be a dedicated automation user with limited sudo permissions, not vagrant. Managing service users and keys is covered in Lesson 9.2; also check your organization's security policies.

Aurora - Gitea (read) (Source Control): Username awx and, as the Password, the Gitea token with the read:repository scope. Using a token belonging to a read-only service user, instead of your personal password, lets you revoke it without affecting anyone and limits the damage if it leaks.

Aurora - Vault lab (Vault): Vault Password with the contents of aurora-lab.pass and Vault Identifier lab. The identifier must match the label in the header of the encrypted files ($ANSIBLE_VAULT;1.2;AES256;lab, Lesson 5.4). If the template has a Vault credential with an identifier that doesn't appear in any file, nothing happens; if a file uses an identifier with no credential, the job fails when decrypting it.

  1. How credentials are injected into a job

Each credential type is delivered to the job in its own way. Knowing how will help you understand errors and design your own types:

Type How it reaches the job Equivalent in your terminal
Machine The username, as the -u option; the private key, loaded into an SSH agent (ssh-agent) inside the container; the connection and become passwords, by automatically answering the prompt ansible-playbook shows (as if you were using -k/-K) ssh-add ~/.ssh/aurora_ed25519 + -u vagrant
Vault The --vault-id lab@prompt option, with AWX answering the prompt with the password --vault-id lab@~/.ansible/vault/aurora-lab.pass
Source Control Only during the project sync, when cloning Your Git credential.helper
Cloud (for example AWS) Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY…) or a temporary file export AWS_...
Custom types Whatever their injector configuration says: environment variables, extra variables or files —

All of this happens in the job's private directory and inside its container. When it finishes, the container is destroyed, and the decrypted secrets with it.

  1. Why whoever launches can't see the secret (and the limits of that)

Three mechanisms protect credentials:

  1. Encryption in the database. Secret fields are encrypted with the installation's secret key (the awx-aurora-secret-key secret from Lesson 7.2). A copy of the database without that key reveals nothing.
  2. The API never returns secrets. In the interface and in the API they appear as $encrypted$. Not even an administrator can read them; they can only replace them.
  3. RBAC distinguishes using from administering. To launch a template, no permission on its credentials is needed. To add a credential to a template, you need the Use role on it. To modify it, the Admin role. Nobody but the administrators touches the credentials.

But there's a limit you need to be aware of: the playbook does receive the secret, because it needs it to do its work. Anyone who can modify the code AWX runs (for example, by pushing to main in aurora-infra) could write a task that displays a decrypted variable, copies the key to a server or sends it to another machine. That's why:

  • Controlling who can write to the repository (protected branches, pull request reviews) is part of AWX security.
  • no_log: true on tasks that handle secrets (Lesson 5.4) is still essential: AWX stores the output of every job, and anyone with read permission on the template can read it.
  • Allow Branch Override (Lesson 7.4) makes it possible to run code from unreviewed branches with the real credentials: enable it only on lab projects and templates, and never for anyone who doesn't already have write permission on main.

Warning: the security design of an automation platform with access to every server deserves a review by security professionals. What's presented here are the basic practices for a lab.

  1. Custom credential types

When an automation needs a secret that doesn't fit the predefined types (a token for an internal API, a key for a paid service…), you can create a custom credential type in Administration → Credential Types → Add. It's defined with two YAML blocks.

As an example, Aurora plans to integrate its automation with the store's internal API (for example, to put the store into maintenance mode during a deployment). Create the Aurora - Store API type:

Input configuration (the form fields):

fields:
  - id: api_url
    type: string
    label: API URL
    help_text: For example, https://api.aurora-store.example
  - id: api_token
    type: string
    label: Access token
    secret: true
required:
  - api_url
  - api_token
  • fields: each field has an identifier (id), a type (string or boolean) and a label.
  • secret: true makes the field encrypted and displayed as $encrypted$.
  • required: mandatory fields.

Injector configuration (how they reach the job):

env:
  AURORA_API_TOKEN: "{{ api_token }}"
extra_vars:
  aurora_api_url: "{{ api_url }}"
  • env: environment variables for the Ansible process. This is the recommended approach for secrets: they don't show up among the job's variables.
  • extra_vars: Ansible variables with extra variable precedence. Suitable for non-secret data such as the URL.
  • There's also file, for writing a temporary file from a template and passing its path (useful for tools that read configuration files).

In a playbook, the token would be read with an environment lookup (Lesson 5.3), which runs on the control node, that is, inside the job's container:

- name: Enable the store's maintenance mode
  ansible.builtin.uri:
    url: "{{ aurora_api_url }}/maintenance"
    method: POST
    headers:
      Authorization: "Bearer {{ lookup('ansible.builtin.env', 'AURORA_API_TOKEN') }}"
  no_log: true

This type is created as an example: Aurora doesn't have that API yet and no playbook uses it.

  1. RBAC: organizations, teams, users and roles

AWX's RBAC (Role-Based Access Control) answers the question "who can do what with which object?". It has four pieces:

  • Organization: a container of objects and people (Aurora Store).
  • User: a person (or a service account). There are three user types: Normal (no permissions except those assigned), System Auditor (can read everything in every organization) and System Administrator (can do everything, like admin).
  • Team: a group of users in an organization. Permissions are preferably assigned to teams, not to people: when someone changes jobs, you just move them to another team.
  • Role: a set of permissions on a specific object. For example, "Execute on the Aurora - Deploy web template".

The main roles:

Role On which objects Allows
Admin All Everything on that object: viewing, modifying, deleting it and granting permissions on it
Execute Job and workflow templates Launching (and relaunching) the template and viewing its jobs
Use Projects, inventories, credentials, execution environments Using the object when creating or editing templates (without viewing it in detail or modifying it)
Read All Viewing the object (and, for templates, their jobs and output)
Update Projects, inventories Launching syncs
Ad Hoc Inventories Running ad hoc commands against the inventory from AWX
Approve Workflow templates Approving or denying the workflow's approval nodes
Member Organizations, teams Belonging to them
Auditor Organizations Reading everything in the organization
Project/Inventory/Credential/Job Template/Workflow/Notification/Execution Environment Admin Organizations Administering all objects of that type within the organization

Roles are inherited downwards: an organization Admin is Admin of all its objects, and whoever has Admin on a template also has Execute and Read on it.

Version note: recent versions of AWX and AAP are evolving their permission system towards configurable role definitions (you can create your own roles by combining permissions), and some interface names may vary. The concepts (per-object permissions, assigned to users and teams, inherited from the organization) remain the same.

  1. Aurora's permission design

Before clicking anything, you design. Aurora's people and what they need:

Person Needs Solution
Alex Admin (you) Administer everything at Aurora User alex, Admin of the Aurora Store organization. admin is kept for emergencies only
Marc Soler (Operations) Apply the configuration, check, deploy, sync and approve deployments Operations team
Laura Gómez (Development) Only deploy the website, choosing the version Development team
Inés Prat (Audit) See what has been run, when and by whom, without being able to launch anything User ines, Auditor of the organization

Team permissions:

Team Object Role
Operations Templates Aurora - Configure infrastructure, Aurora - Check configuration, Aurora - Deploy web Execute
Operations Workflow template Aurora - Release web version (section 12) Execute and Approve
Operations Project aurora-infra and inventory Aurora - Lab Update (sync on demand)
Development Template Aurora - Deploy web (temporary: replaced by the workflow in section 12) Execute
Development Workflow template Aurora - Release web version Execute (without Approve)

Notice what doesn't appear: nobody but Alex has Use or Admin on the credentials, nobody but Alex can create or modify templates, and Development can't change anything in the template except the survey answer (aurora_app_version), because no other field has Prompt on launch. Laura's power is limited by two mechanisms at once: the Execute permission on a single template, and the design of that template.

  1. Creating users and teams, and assigning roles

As admin:

1. Users (Access → Users → Add), all four with User Type Normal user and Organization Aurora Store:

Username First / Last name Email
alex Alex / Admin [email protected]
marc Marc / Soler [email protected]
laura Laura / Gómez [email protected]
ines Inés / Prat [email protected]

Give each of them a long random password and hand it over through a secure channel, asking them to change it when they log in. In a company, users wouldn't be created by hand: AWX would be integrated with the corporate directory (LDAP, SAML or OIDC), and membership of organizations and teams would be derived from the directory groups.

2. Organization roles (Access → Organizations → Aurora Store → Access → Add): the Admin role to alex; the Auditor role to ines.

3. Teams (Access → Teams → Add), in the Aurora Store organization: Operations (with marc as a member, Access tab) and Development (with laura).

4. Team roles: in each team, Roles → Add tab, choose the resource type (Job templates, Workflow job templates, Projects, Inventories), the resources and the role, according to the table in section 8. You can also do it the other way round: from each template's Access tab, add the team with its role.

From now on, work as alex instead of admin.

  1. Checking the permissions

Permissions are checked by logging in as each user (use a private browser window so you don't close your own session):

  • laura: in Templates she sees only Aurora - Deploy web. She doesn't see the project, the inventory or the credentials in their lists. When launching, the wizard only asks her for the version. In the job details she sees the names of the credentials used, but not their contents.
  • marc: sees and launches the three templates, can change Limit and tags in Aurora - Configure infrastructure, can sync the project and the inventory, but can't edit any template (the edit button doesn't appear) or see the credentials.
  • ines: sees everything in the organization (templates, jobs with their output, inventories, credential names) but can't launch, edit or delete anything.

Also check Views → Activity Stream as alex: the creation of the users, teams and role assignments appears there, with author and date.

  1. Workflows: concepts

So far, deploying a version means launching a template. But a responsible deployment at Aurora should: (1) use the latest code, (2) check beforehand what's going to change, (3) have someone from Operations approve it after seeing that check and (4) only then deploy. That's a workflow template (Workflow Template): a graph of nodes joined by conditional links.

Node types:

Node What it does
Job Template Launches a job template
Project Sync Syncs a project
Inventory Source Sync Syncs an inventory source
Approval Pauses the workflow until someone with permission approves or denies it (with an optional timeout)
Workflow Template Launches another workflow (nested workflows)
Management Job AWX maintenance jobs

Link types (when the next node runs):

Link Followed when the previous node…
On Success (green) Finishes successfully (or the approval is granted)
On Failure (red) Fails (or the approval is denied or times out)
Always (blue) Finishes, however it ends

If a node receives several links, its convergence option decides whether it's enough for one to be satisfied (Any) or whether all of them must be (All). A workflow ends as Failed if a node fails and there's no On Failure link that "handles" that failure.

Variables and prompts in workflows: a workflow can have its own survey and extra variables, which are passed to all the jobs in the workflow. It can also prompt on launch for the inventory or the limit for all its nodes.

  1. The Aurora - Release web version workflow

This is the design:

flowchart LR
    S((Start<br/>survey:<br/>aurora_app_version)) --> P[Project Sync<br/>aurora-infra]
    P -->|On Success| C[Job Template<br/>Aurora - Check configuration<br/>check + diff]
    C -->|On Success| A{{Approval<br/>Approve the deployment<br/>timeout 4 h}}
    A -->|On Success<br/>approved| D[Job Template<br/>Aurora - Deploy web]
    A -.->|On Failure<br/>denied or timed out| F((End: not deployed))
    P -.->|On Failure| F2((End: workflow failed))
    C -.->|On Failure| F2
  • The Project Sync guarantees that the latest main is used (even though the templates already have Update Revision on Launch, in a workflow it's clearer to do it once at the start).
  • Aurora - Check configuration runs site.yml in Check mode with diff and receives aurora_app_version from the workflow survey: its output shows exactly what would change on web1 and web2 (the home page with the new version) and, along the way, any other drift. Today, with a single environment, this check plays the role of a "staging rehearsal"; when Lesson 9.1 creates the staging and production environments, this node will become a real deployment to staging.
  • The approval node pauses the workflow. Operations reviews the check's output and approves or denies.
  • Aurora - Deploy web performs the rolling deployment with the version from the survey.

Create it as alex. Templates → Add → Add workflow template:

Field Value
Name Aurora - Release web version
Organization Aurora Store
Inventory Aurora - Lab

Save: the visual editor (Workflow Visualizer) opens. Add the nodes by clicking Start and then each node's +:

  1. From Start: type Project Sync, project aurora-infra.
  2. From the previous one, On Success link: type Job Template, Aurora - Check configuration.
  3. From the previous one, On Success: type Approval, name Approve the deployment, description Review the diff from the previous node before approving, Timeout 4 hours.
  4. From the approval, On Success: Job Template, Aurora - Deploy web.

Save the workflow. Then, in the workflow's Survey tab, create the same question as in the template from Lesson 7.3 (Answer variable name aurora_app_version, text of 5 to 20 characters, required, defaulting to the repository's current value, 1.2.0) and enable it.

Finally, adjust the permissions according to the design in section 8. In the workflow's Access tab: Operations with Execute and Approve, Development with Execute. And remove the Execute role on the Aurora - Deploy web template from Development: from now on, Laura can only deploy through the workflow, that is, always with a prior check and approval from Operations.

  1. Launching the workflow and approving

As laura, launch Aurora - Release web version and answer the survey with 1.3.0. The workflow job view opens, with the graph changing color as it progresses: the sync finishes in green, so does the check (in Check mode, pending changes aren't a failure), and the workflow stops at Approve the deployment with the Pending approval status. Laura can't approve it.

As marc, open Views → Workflow Approvals (or the approval notification, if you'd configured one). Before approving, open the check job and review its output: the diff for web1 and web2 shows the change from "Version 1.2.0" to "Version 1.3.0", and no other unexpected changes. Approve. The workflow continues with Aurora - Deploy web, which deploys 1.3.0 as a rolling deployment through lb1.

The workflow details and each job's details hold the complete trail: who launched it (laura), with which version, what the check showed, who approved it (marc) and when, and the result of the deployment. Exactly the auditing management was asking for in Lesson 7.1.

Remember the rule from Lesson 7.3: the deployed version has to end up in the repository, or the nightly check will flag it as drift. Record 1.3.0 in inventory/group_vars/webservers.yml:

cd ~/aurora-infra
git pull
sed -i 's/^aurora_app_version: "1.2.0"/aurora_app_version: "1.3.0"/' inventory/group_vars/webservers.yml
git commit -am "Website version 1.3.0, released with the AWX workflow"
git push

And update the default value of both surveys to 1.3.0. (Automating that record, so that the deployment starts from a change in Git rather than the other way round, is the goal of the continuous integration in Lesson 8.3.)

Also try the denial path: launch the workflow as laura with 1.3.1 and, as marc, deny (Deny) the approval. The workflow ends without running the deployment and the website stays on 1.3.0.

Common Mistakes and Tips

  • Assigning permissions to individual users instead of teams: it works until someone changes jobs and keeps permissions they should no longer have.
  • Granting Use on credentials "so they can launch": it isn't needed for launching. Use allows the credential to be added to other templates, including ones someone creates with their own playbook.
  • Forgetting to enable the survey: the question exists but isn't shown, and the job uses the inventory's value.
  • A survey on both the workflow and the template: the workflow's variables are passed to all its nodes and take precedence. Keep the default values consistent, or remove the template's survey if it's only used through the workflow.
  • A Vault credential with an identifier different from the files' (Lab instead of lab): Decryption failed (no vault secrets were found that could decrypt).
  • Approvals with no timeout: a workflow can sit waiting for days and block later runs (if the template doesn't allow concurrent jobs). Always set a reasonable Timeout.
  • Tip: when you design permissions, first write the person → need → role table, as in section 8. If it doesn't fit in a simple table, the design is too complex.

Exercises

Exercise 1: A credential of the custom type

Create an Aurora - Store API (lab) credential of the Aurora - Store API type, with the URL https://api.aurora-store.example and a made-up token. Create a test template that runs, against localhost, a playbook that checks that the aurora_api_url variable is defined and that the AURORA_API_TOKEN environment variable isn't empty, without showing its value. Where would you put that playbook?

Exercise 2: Who can do what?

With the design from section 8 applied (and Development no longer having Execute on the deployment template), answer: (a) Can Laura relaunch an Aurora - Deploy web job that Marc launched? (b) Can Marc create a new template that uses Aurora - SSH lab? (c) Can Inés see the output of the nightly check? (d) Can Marc approve a workflow he launched himself?

Exercise 3: Failure branch

Modify the workflow so that, if Aurora - Deploy web fails, Aurora - Check configuration is launched automatically (to leave the real state of the servers after the failure in the history). Which link type do you use? What state does the workflow end in if the deployment fails and the subsequent check succeeds?

Solutions

Exercise 1. A test playbook like this one, which can live on a test branch of aurora-infra (for example, tests/api-credential.yml) and isn't merged into main as long as the API doesn't exist:

---
- name: Check the store API credential
  hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - name: Check that the credential has been injected
      ansible.builtin.assert:
        that:
          - aurora_api_url is defined
          - lookup('ansible.builtin.env', 'AURORA_API_TOKEN') | length > 0
        fail_msg: "The API credential has not been injected"
        success_msg: "Credential injected for {{ aurora_api_url }}"

assert doesn't show the evaluated values, only the message, and the message only includes the URL. The template needs that credential (no Machine credential, because it runs on localhost, that is, inside the job's container; add Aurora - Vault lab if Ansible ends up loading the encrypted files in group_vars/all/), the Aurora - Lab inventory (which contains the implicit localhost) and the project with Allow Branch Override and the test branch. When you're done, delete the test template.

Exercise 2. (a) No: relaunching requires Execute on the template, and Laura no longer has it (only on the workflow). (b) No: creating templates requires being a template administrator in the organization and having Use on the project, the inventory and the credential; Marc has none of these. (c) Yes: the organization's Auditor role allows reading all jobs and their output. (d) Yes: he has Approve on the workflow, and AWX doesn't prevent people from approving what they launched themselves. If Aurora wanted a strict "four eyes" principle, it would have to reserve the Approve role for people who don't launch the workflow, or make it a team rule.

Exercise 3. In the visual editor, from the Aurora - Deploy web node, add an On Failure link to a new Job Template node with Aurora - Check configuration. If the deployment fails and the check succeeds, the workflow ends as Successful, because the failure has been "handled" by an On Failure link. This is an effect to keep in mind: the workflow's status no longer warns of the deployment failure, so it's a good idea to add a failure notification to the Aurora - Deploy web template, or to end the failure branch with a node that fails on purpose so the workflow reflects the problem.

Conclusion

You've completed the pieces that make AWX a team platform. You know the credential types (Machine, Source Control, Vault with its lab identifier, Galaxy, container registries, clouds, external managers), how each one is injected into the job (SSH agent, automatic answers to password prompts, --vault-id, environment variables), why whoever launches a job can't see them (encryption with the installation key, $encrypted$ in the API and the Use role) and where their limit lies: the playbook does receive the secret, so controlling who writes to the repository and using no_log are part of security. You've created the custom Aurora - Store API type. With RBAC, you've given each person at Aurora only what they need: alex administers the organization, the Operations team runs, syncs and approves, the Development team can only release website versions by choosing aurora_app_version, and ines audits without being able to touch anything. And you've built the Aurora - Release web version workflow, which chains sync, check with diff, approval and rolling deployment, and with which the website has reached version 1.3.0 with a complete trail of who requested it, who approved it and what changed. One piece remains to be brought under control: where all this runs. Jobs still use AWX's generic execution environment, with ansible-core and collection versions that Aurora hasn't chosen. In the next lesson, Execution Environments and ansible-navigator, you'll build the aurora-ee environment with exactly what Aurora needs and use it both in AWX and in your terminal.

Ansible Course: From Beginner to Advanced

Module 1: Introduction to Ansible

Module 2: Ansible Fundamentals

Module 3: Playbooks

Module 4: Roles

Module 5: Advanced Playbook Techniques

Module 6: Ansible Galaxy

Module 7: Ansible Tower, AWX and Automation Platform

Module 8: Ansible for DevOps

Module 9: Ansible Best Practices

Module 10: Advanced Ansible Topics

Module 11: Final Project

© Copyright 2026. All rights reserved