At the end of the previous lesson, aurora-infra was left in a fragile state: its playbooks use the geerlingguy.node_exporter role and version 4.2.2 of community.postgresql, but the repository contains neither of them (galaxy_roles/ and collections/ aren't versioned) and nothing indicates that they're needed. A colleague cloning the project, the continuous integration server or AWX would fail on the first attempt or, worse, would work with versions different from yours. In this lesson you'll learn to declare all of a project's external dependencies in the requirements.yml file: its format (roles and collections in a single file), the different sources (Galaxy, Git, URL, files, private servers), how to pin versions or use ranges, how to install everything with a single command and what to do to make the result reproducible. You'll finish by creating Aurora Store's requirements.yml and checking that a freshly cloned copy of the repository works exactly like yours.
Contents
- The problem: "it works on my machine"
- The
requirements.ymlfile - Declaring roles
- Declaring collections
- Versions: pinning or using ranges
- Installing the dependencies
- Upgrading and forcing:
--upgradeand--force - Reproducibility: there's no lockfile
- Private servers and Automation Hub:
[galaxy] server_list - Aurora Store's
requirements.yml - The workflow in a fresh clone of the repository
- Updating a dependency methodically
- The problem: "it works on my machine"
Think back to how each piece of third-party code reached Aurora's environment:
| Dependency | How it got there | Problem |
|---|---|---|
community.general, ansible.posix |
Included in the ansible package you installed with pipx (Lesson 1.2) |
Each person has the version from their own ansible package; when it's upgraded, they change without warning |
community.postgresql 4.2.2 |
A one-off command in Lesson 6.2 | Only exists in your collections/ |
geerlingguy.node_exporter 2.2.0 |
A one-off command in Lesson 6.2 | Only exists in your galaxy_roles/ |
Any other environment (a colleague, the CI/CD server from Lesson 8.3, AWX in Module 7) would have other versions or simply nothing at all. The solution is the same as in any software ecosystem (Python's requirements.txt, Node.js's package.json): declare the dependencies in a versioned file and have a tool install them from it.
flowchart LR
R["requirements.yml<br/>(versioned in Git)"] -->|ansible-galaxy install -r| G["galaxy_roles/<br/>(not versioned)"]
R -->|ansible-galaxy install -r| C["collections/<br/>(not versioned)"]
G --> P["ansible-playbook site.yml"]
C --> P
RO["roles/<br/>(own, versioned)"] --> P
The repository stores the list (requirements.yml) and your own code (roles/); third-party code is regenerated from the list in each environment.
- The
requirements.yml file
requirements.yml filerequirements.yml is a YAML file with two optional lists at the root, roles and collections:
---
roles:
- name: geerlingguy.node_exporter
version: "2.2.0"
collections:
- name: community.postgresql
version: "4.2.2"This is the unified format, available since Ansible 2.10: a single file for both types of content. You'll also come across other formats in older projects or in documentation:
| Format | What it looks like | Comment |
|---|---|---|
| Unified | Dictionary with roles: and collections: |
The recommended one; the one Aurora uses |
| Legacy, roles only | A list at the root of the file (- src: ...) |
Only supports roles; you'll still see it in many READMEs |
| Collections only | Dictionary with only collections: |
A special case of the unified format |
Where does it go? The name and path are up to you (you pass them with -r), but there are conventions:
requirements.ymlat the root of the project: the clearest option for anyone arriving at the repository. It's Aurora's choice.roles/requirements.ymlandcollections/requirements.yml: paths that some tools look for on their own; in particular, AWX processes them automatically when it syncs a project. You'll see how this fits with Aurora in Lesson 7.4.
Note: Aurora can't simply use
collections/requirements.yml, becausecollections/is the installation directory and it's in.gitignore(Lesson 6.2). That's why its file lives at the root.
- Declaring roles
Each item under roles: accepts these fields:
| Field | Meaning | Default |
|---|---|---|
name |
Name it's installed under (and the one you'll use in roles:) |
The Galaxy name, or the repository name if it comes from Git |
src |
Source: Galaxy name (author.role), Git URL or archive URL |
The value of name |
version |
Git tag, branch or commit (on Galaxy, one of its versions) | The most recent (Galaxy) or the default branch (Git) |
scm |
Version control system if src is a repository |
git |
Examples of each source:
---
roles:
# From Galaxy: the name and the version are enough
- name: geerlingguy.node_exporter
version: "2.2.0"
# Equivalent, with an explicit src (the form you'll see in many READMEs)
- src: geerlingguy.ntp
version: "3.0.0"
# From a Git repository (HTTPS). The git+ prefix means it must be cloned.
- name: nginx
src: git+https://git.example.com/ops/ansible-role-nginx.git
version: "1.0.0"
# From Git over SSH (private repository; uses your SSH keys)
- name: backup
src: [email protected]:ops/ansible-role-backup.git
scm: git
version: "2.1.0"
# From an archive published on an internal web server
- name: hardening
src: https://artifacts.example.com/roles/hardening-1.4.0.tar.gzImportant details:
- With Git sources,
nameis all but mandatory: without it, the role would be installed asansible-role-nginx. - With Git,
versioncan be a tag, a branch or a commit. Use tags (or commits) so the result doesn't change; a branch points to something different every time someone pushes. - With an archive URL there's no version: the version is in the URL itself.
- Remember that all these role sources are really Git or archives: even for a Galaxy role, the download comes from the author's repository (Lesson 6.2).
- Declaring collections
Each item under collections: accepts these fields:
| Field | Meaning | Default |
|---|---|---|
name |
namespace.collection name, or the URL/path if the source isn't a Galaxy server |
Required |
version |
Exact version or range (>=1.0.0,<2.0.0); for Git, tag, branch or commit |
The most recent |
type |
Source type: galaxy, git, url, file, dir or subdirs |
galaxy |
source |
URL of the specific Galaxy server to download it from | The configured servers (section 9) |
signatures |
Signatures that must be verified on installation | None |
Examples:
---
collections:
# From Galaxy (or from the configured servers), exact version
- name: community.postgresql
version: "4.2.2"
# From Galaxy with a range
- name: community.docker
version: ">=4.0.0,<5.0.0"
# From a specific server
- name: community.general
version: "12.6.7"
source: https://galaxy.ansible.com/
# From a Git repository (its root must contain galaxy.yml)
- name: https://git.example.com/ops/ansible-collection-infra.git
type: git
version: "1.0.0"
# From an artifact published at a URL
- name: https://artifacts.example.com/collections/example-util-1.2.0.tar.gz
type: url
# From a local artifact (path relative to the directory you run from)
- name: ./artifacts/example-util-1.2.0.tar.gz
type: fileA fundamental difference from roles: collections declare their own dependencies in their galaxy.yml (Lesson 6.5), and ansible-galaxy installs them automatically. For example, version 14 of community.general depends on the community.library_inventory_filtering_v1 collection: when you install it, that other one would show up too, even though it isn't in your requirements.yml. These are transitive dependencies (Lesson 6.1, section 8).
- Versions: pinning or using ranges
Galaxy requires collections to use semantic versioning (SemVer): MAJOR.MINOR.PATCH.
| What changes | Meaning | Example | Can it break your project? |
|---|---|---|---|
| PATCH | Bug fixes | 4.2.1 → 4.2.2 | It shouldn't |
| MINOR | New backward-compatible features | 4.1.0 → 4.2.0 | It shouldn't, although things do change |
| MAJOR | Breaking changes (removed options, different behavior) | 3.14.3 → 4.0.0 | Yes: read the changelog |
"It shouldn't" doesn't mean "it can't": a fix can change a behavior you relied on. That's why the rule depends on who declares the dependency:
| Who | What to use | Why |
|---|---|---|
A project that gets run (aurora-infra, the "application") |
Exact versions | It must behave the same today, tomorrow and in any environment. Upgrades are deliberate decisions |
| A collection or role that others consume (a "library", like the collection in Lesson 6.5) | Compatible ranges (>=4.0.0,<5.0.0) |
If it pinned exact versions, it would clash with the ones its consumers pin; the range says "I work with any 4.x" |
Remember the syntax quirks: for roles, version is a single Git reference (no ranges); for collections, it accepts exact versions (4.2.2 or ==4.2.2), minimums (>=4.2.0), exclusions (!=4.2.1) and comma-separated combinations. In YAML, always write versions in quotes: version: 1.10 would be the number 1.1 (as you saw with min_ansible_version in Lesson 6.2).
- Installing the dependencies
There are three ways to process a requirements.yml:
| Command | What it installs |
|---|---|
ansible-galaxy install -r requirements.yml |
Roles and collections (the short form from section 1 of Lesson 6.2) |
ansible-galaxy role install -r requirements.yml |
Only the roles section |
ansible-galaxy collection install -r requirements.yml |
Only the collections section |
For everyday use, the first one: a single command sets up the whole project. Roles go to the first path in roles_path (galaxy_roles/) and collections to the first in collections_path (collections/), just as with the one-off commands. The options from Lesson 6.2 still apply (-p for another destination, -n/--no-deps to skip dependencies…).
- Upgrading and forcing:
--upgrade and --force
--upgrade and --forceWhat happens when you change a version in requirements.yml and install again? Roles and collections behave differently, and it's worth being clear about it:
| Situation | Roles | Collections |
|---|---|---|
| Already installed at the requested version | is already installed, skipping. |
Nothing to do. All requested collections are already installed. |
| Exact version requested different from the installed one | Doesn't change: [WARNING]: ... is already installed - use --force to change version to ... |
Replaces it with the requested one |
| Requested range already satisfied by the installed one | (no ranges) | Does nothing, even if there are newer versions in the range |
With --upgrade |
Doesn't exist for roles | Installs the most recent version that satisfies the request |
With --force |
Reinstalls (and changes version) | Reinstalls even if already installed |
Practical consequence: after changing a role's version in requirements.yml, install with --force:
--force downloads everything again, including what hasn't changed; it's slower, but the result matches the file exactly. --force-with-deps does the same, including the dependencies of each role or collection.
- Reproducibility: there's no lockfile
Other ecosystems have a lockfile (package-lock.json, poetry.lock) that records the exact version of everything installed, including transitive dependencies, and lets you reproduce it bit for bit. ansible-galaxy has no lockfile. That means:
- If you use ranges, two installations on different days can produce different versions.
- Even if you pin your direct dependencies, the transitive ones are resolved on every installation according to the ranges each collection declares.
- A role from Git with a branch, or a moved tag, can bring in different code.
The alternatives, from least to most effort:
| Technique | What it achieves |
|---|---|
| Pin exact versions of everything you declare (and tags or commits for Git) | Reproducibility of direct dependencies. It's the bare minimum |
| Also declare the transitive dependencies you care about, with exact versions | You pin them yourself instead of letting them resolve on their own |
Record what's installed: ansible-galaxy collection list --format yaml > installed.yml |
A "snapshot" of the real versions to compare across environments |
Keep the artifacts: ansible-galaxy collection download -r requirements.yml -p artifacts/ |
An exact copy that installs without Internet access (and without relying on Galaxy still serving it) |
| Private server with the approved versions (section 9) | Centralized control over what can be installed |
| Execution environments (container images with Ansible and all the collections inside) | The whole environment is an immutable artifact. You'll see this in Lesson 7.6 |
For now, Aurora will apply the first technique: exact versions for everything it declares. Its current collections have no transitive dependencies, so for now that's enough.
- Private servers and Automation Hub:
[galaxy] server_list
[galaxy] server_listBy default, ansible-galaxy uses https://galaxy.ansible.com. If your company has a private server or an Automation Hub subscription (Lesson 6.1, section 5), they're configured in ansible.cfg with the [galaxy] section:
[galaxy]
# Servers in order of preference: for each collection, the first one that has it is used.
server_list = automation_hub, internal_hub, galaxy
[galaxy_server.automation_hub]
url = https://console.redhat.com/api/automation-hub/content/published/
auth_url = https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
[galaxy_server.internal_hub]
url = https://hub.aurora-store.example/api/galaxy/content/published/
[galaxy_server.galaxy]
url = https://galaxy.ansible.com/How it works:
server_listlists server identifiers, in order. For each collection,ansible-galaxytries the servers in order and uses the first one that has it. In a strict corporate environment, the list would contain only the internal server.- Each identifier has its own
[galaxy_server.<id>]section with itsurland, if needed,auth_url(Automation Hub uses Red Hat single sign-on),validate_certsor credentials. - Standalone roles only exist on Galaxy: for them, the first server on the list that supports them is used. Roles from Git don't depend on this configuration.
- With
--server <url>(or-s) on the command line, or withsource:in arequirements.ymlentry, you force a specific server.
Tokens never go in ansible.cfg, which lives in the repository. Each server accepts its token in an environment variable named ANSIBLE_GALAXY_SERVER_<ID>_TOKEN (the identifier in uppercase):
export ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN='...token obtained from console.redhat.com...'
export ANSIBLE_GALAXY_SERVER_INTERNAL_HUB_TOKEN='...token for the internal server...'
ansible-galaxy install -r requirements.ymlIn CI/CD and in AWX, those tokens are stored as secrets or credentials of the system itself (Lessons 7.5 and 8.3), just like the Vault password.
Aurora Store has neither a private server nor a subscription: it uses Galaxy, the default, and does not add the [galaxy] section to its ansible.cfg.
- Aurora Store's
requirements.yml
requirements.ymlChoosing the versions
For each collection you need to pick a specific version. Besides the evaluation from Lesson 6.1, there's a technical requirement: each collection version declares which ansible-core versions it works with (requires_ansible, on its Galaxy page). The course guarantees ansible-core 2.17 or later, so all of them must support 2.17. For community.general, at the time of writing:
community.general series |
requires_ansible |
Valid for Aurora? |
|---|---|---|
| 14.x | >=2.19.0 |
No: it would leave out anyone with ansible-core 2.17 or 2.18 |
| 13.x | >=2.18.0 |
No, for the same reason |
| 12.x | >=2.17.0 |
Yes: the most recent compatible series |
12.6.7, the latest in the 12 series, is chosen. For the others: community.postgresql 4.2.2 (the one you installed and tested in Lesson 6.2; the 4 series supports ansible-core 2.9.10 or later) and ansible.posix 2.2.2 (requires 2.16 or later). If you installed a collection that doesn't support your ansible-core version, ansible-galaxy would install it anyway, but at run time you'd see an unsupported collection warning and things might fail.
Note: by the time you read this, there will be newer versions. Use the course's versions to follow along without surprises; upgrading them is precisely the procedure in section 12.
The file
Create ~/aurora-infra/requirements.yml:
---
# External dependencies of aurora-infra (Lesson 6.3).
#
# Install after cloning the repository or after changing this file:
# ansible-galaxy install -r requirements.yml
# (after changing the version of a ROLE, add --force)
#
# Roles -> galaxy_roles/ Collections -> collections/ (neither is versioned)
# PINNED versions: only changed after testing them in the lab.
roles:
# Prometheus metrics agent. Evaluated in Lesson 6.1; used in monitoring.yml.
- name: geerlingguy.node_exporter
version: "2.2.0"
collections:
# ufw and timezone. The 12 series is the latest compatible with ansible-core 2.17.
- name: community.general
version: "12.6.7"
# PostgreSQL users, databases and checks.
- name: community.postgresql
version: "4.2.2"
# timer, profile_tasks and profile_roles callbacks.
- name: ansible.posix
version: "2.2.2"Each decision has its reason:
- A single source of truth: everything the project needs from outside is here, with its version and a comment explaining what it's used for. Anyone who wants to know why a dependency exists can see it in the file itself.
- Exact versions, in quotes, because
aurora-infrais the project that gets run (section 5). - The three collections Aurora uses, even though they come in the
ansiblepackage: that way they no longer depend on each person'sansibleversion. - Not included:
ansible.builtin(it comes withansible-coreand isn't installed separately) and the project's own roles (they're inroles/).
Installing
Starting galaxy role install process
- geerlingguy.node_exporter (2.2.0) is already installed, skipping.
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-12.6.7.tar.gz to /home/student/.ansible/tmp/...
Installing 'community.general:12.6.7' to '/home/student/aurora-infra/collections/ansible_collections/community/general'
community.general:12.6.7 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-posix-2.2.2.tar.gz to /home/student/.ansible/tmp/...
Installing 'ansible.posix:2.2.2' to '/home/student/aurora-infra/collections/ansible_collections/ansible/posix'
ansible.posix:2.2.2 was installed successfullyThe role and community.postgresql were already there (from Lesson 6.2) and are left alone; the two missing collections are installed. (If you did Exercise 3 in Lesson 6.2, ansible.posix isn't reinstalled either.) Check what the project now uses:
# /home/student/aurora-infra/collections/ansible_collections
Collection Version
-------------------- -------
ansible.posix 2.2.2
community.general 12.6.7
community.postgresql 4.2.2And that everything still works with the pinned versions:
It should finish with changed=0 on every server (and with the total time line from the timer callback, which now comes from ansible.posix 2.2.2).
Commit the file:
git add requirements.yml
git commit -m "requirements.yml: geerlingguy.node_exporter role and collections with pinned versions"
- The workflow in a fresh clone of the repository
The acid test of reproducibility is starting from scratch. Simulate a new colleague arriving by cloning the repository into another directory:
ansible.cfg common.yml dbservers.yml inventory lab loadbalancers.yml monitoring.yml requirements.yml roles site.yml upgrade.yml webservers.ymlThere's no galaxy_roles/ or collections/. If you try to run something now:
[ERROR]: the role 'geerlingguy.node_exporter' was not found in /home/student/aurora-infra-clone/galaxy_roles:/home/student/aurora-infra-clone/roles:/home/student/aurora-infra-cloneThe error is clear and immediate, which is exactly what you want (the exact format of the message varies between ansible-core versions). Set up the environment with a single command:
Starting galaxy role install process
- downloading role 'node_exporter', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-node_exporter/archive/2.2.0.tar.gz
- extracting geerlingguy.node_exporter to /home/student/aurora-infra-clone/galaxy_roles/geerlingguy.node_exporter
- geerlingguy.node_exporter (2.2.0) was installed successfully
Starting galaxy collection install process
...
community.general:12.6.7 was installed successfully
...
community.postgresql:4.2.2 was installed successfully
...
ansible.posix:2.2.2 was installed successfullyAnd check that the clone manages the infrastructure just like your copy:
It should finish without errors and with changed=0. Notice what wasn't in the repository and still worked: the Vault password, which is read from ~/.ansible/vault/aurora-lab.pass (outside the repository, Lesson 5.4), and the SSH key ~/.ssh/aurora_ed25519. A real colleague would need you to hand those over through a secure channel; they aren't part of the code dependencies.
sequenceDiagram
participant D as Colleague
participant G as Git
participant GA as ansible-galaxy
participant GX as Galaxy / GitHub
D->>G: git clone aurora-infra
D->>GA: ansible-galaxy install -r requirements.yml
GA->>GX: download pinned versions
GX-->>GA: role and collections
GA-->>D: galaxy_roles/ and collections/ ready
D->>D: ansible-playbook site.yml --check (changed=0)
The whole workflow fits in three commands: clone, install dependencies and run. Delete the test clone:
- Updating a dependency methodically
Pinning versions doesn't mean never upgrading: it means upgrading on purpose. The procedure Aurora will follow:
- Review what's new: the Galaxy page and the changelog (especially the breaking changes if the major version goes up) or, for a role, the changes between tags in its repository.
- Create a Git branch:
git switch -c update-community-general. - Change the version in
requirements.ymland install (with--forceif it's a role). - Test in the lab:
ansible-playbook site.yml --check --diffand then a real run; the second one must givechanged=0. Later on, with Molecule (Lesson 9.5) and CI/CD (Lesson 8.3), these tests will be automated. - Merge the branch with a commit that explains the version change.
Do it once with a patch upgrade of ansible.posix if one is available, or simply go over the steps: you'll practice it in Exercise 2.
Common Mistakes and Tips
- Versioning
galaxy_roles/orcollections/: the repository grows with third-party code and you lose clarity about what's yours. Check that they're in.gitignore(Lesson 6.2). - Changing a role's version and forgetting
--force: the[WARNING]tells you exactly what's going on. Collections, on the other hand, are replaced automatically. version: 1.10without quotes: YAML turns it into 1.1. Always put versions in quotes.- Using
latest, branches or wide ranges in the project that gets run: it works until the day a new version breaks something without anyone having changed anything in the repository. - A token in
ansible.cfgor inrequirements.yml: it will end up in Git. UseANSIBLE_GALAXY_SERVER_<ID>_TOKEN. - Thinking that pinning the direct dependencies pins everything: transitive dependencies are resolved on every installation. Check what's actually been installed with
ansible-galaxy collection list. - Tip: when someone reports strange behavior, the first question is "did you run
ansible-galaxy install -r requirements.ymlafter updating the repository?". Many teams automate it in a setup script or in the CI itself.
Exercises
Exercise 1: Read a requirements.yml
Explain exactly what this file installs, where it would install it in Aurora and what reproducibility problems it has:
---
- src: geerlingguy.docker
- src: https://github.com/example/ansible-role-backup.git
scm: git
version: mainExercise 2: Upgrade ansible.posix
Simulate an upgrade: change ansible.posix in requirements.yml to version 2.2.1, install it and check which version the project uses. Run ansible-playbook site.yml --check. Then go back to 2.2.2 (as in the reference file) and leave the repository with no pending changes.
Exercise 3: A range for a test
A colleague wants to try the community.docker collection on a branch, without pinning a specific version yet, but without accepting breaking changes from the 4 series. Write the requirements.yml entry and the command that would install the most recent version in that range even if an older one were already installed, and explain why it shouldn't reach the main branch like that.
Solutions
Exercise 1. It's the legacy format (a list at the root), which only supports roles. It installs geerlingguy.docker from Galaxy at its latest version and the Git role under the repository name (ansible-role-backup, because there's no name) from the main branch. In Aurora they'd go to galaxy_roles/. Problems: no pinned versions (Galaxy would give the latest and main changes with every push), and the name of the second role probably doesn't match the one the playbooks use. Corrected version:
---
roles:
- name: geerlingguy.docker
version: "7.4.1"
- name: backup
src: git+https://github.com/example/ansible-role-backup.git
version: "1.3.0"(The versions are examples: they'd be chosen after evaluating each role.)
Exercise 2.
sed -i 's/version: "2.2.2"/version: "2.2.1"/' requirements.yml # or edit it by hand
ansible-galaxy install -r requirements.yml
ansible-galaxy collection list ansible.posix
ansible-playbook site.yml --check
git checkout requirements.yml
ansible-galaxy install -r requirements.yml
git status --shortWhen you ask for a different exact version, ansible-galaxy replaces the collection without --force (Installing 'ansible.posix:2.2.1'), and collection list shows 2.2.1 in the project. site.yml --check should work the same (it's a patch change). git checkout restores the file, the new installation goes back to 2.2.2, and git status shows nothing because collections/ isn't versioned. If the sed had changed another line with the same text, git diff before installing would have shown you: always review the diff of requirements.yml.
Exercise 3.
Without --upgrade, if a 4.x were already installed, nothing would happen even if a newer 4.x existed. It shouldn't reach the main branch like that because aurora-infra is the project that gets run: with a range, each environment could end up with a different 4.x. When the test is over, you pin the exact version that was tested.
Conclusion
You now know how to declare an Ansible project's dependencies in requirements.yml: the unified format with roles and collections, the possible sources (Galaxy, Git with version, URLs, local files and specific servers with source), the difference between pinning exact versions (for the project that gets run) and using ranges (for what others consume), the ansible-galaxy install -r, role install -r and collection install -r commands, and when --force and --upgrade are needed. You know there's no lockfile and what the alternatives are, and how to configure private servers or Automation Hub with [galaxy] server_list and tokens in environment variables. Aurora Store now has its requirements.yml with the geerlingguy.node_exporter 2.2.0 role and the community.general 12.6.7, community.postgresql 4.2.2 and ansible.posix 2.2.2 collections, and you've checked that a fresh clone can be set up with a single command. So far Aurora has only consumed other people's content; but its nginx role is generic enough for other teams to benefit from it. In the next lesson, Creating and Sharing Roles, you'll prepare that role for sharing (metadata, documentation, license and versions), learn how it's published on Galaxy and extract it into its own ansible-role-nginx repository, from which aurora-infra will consume it through requirements.yml.
Ansible Course: From Beginner to Advanced
Module 1: Introduction to Ansible
- What Is Ansible?
- Installing Ansible
- Setting Up the Practice Lab
- Ansible Architecture
- Basic Ansible Commands
Module 2: Ansible Fundamentals
- Inventory Files
- Inventory Variables: group_vars and host_vars
- Configuring Ansible (ansible.cfg)
- Ad Hoc Commands
- Ansible Modules
- Collections and Fully Qualified Names (FQCN)
Module 3: Playbooks
- Introduction to Playbooks
- Essential YAML for Ansible
- Writing Your First Playbook
- Playbook Structure
- Variables and Facts
- Conditionals and Loops
- Registering Results and Debugging Playbooks
Module 4: Roles
- Introduction to Roles
- Creating Roles
- Role Directory Structure
- Using Roles in Playbooks
- Reusing Tasks: include and import
- Role Dependencies and Argument Validation
Module 5: Advanced Playbook Techniques
- Handlers
- Jinja2 Templates
- Filters and Lookups
- Ansible Vault
- Error Handling
- Tags and Selective Execution
- Rolling Deployments and Delegation
- Optimizing Playbooks
Module 6: Ansible Galaxy
- What Is Ansible Galaxy?
- Using Ansible Galaxy
- Managing Dependencies with requirements.yml
- Creating and Sharing Roles
- Creating Your Own Collections
Module 7: Ansible Tower, AWX and Automation Platform
- Introduction to Ansible Tower and AWX
- Installing AWX
- Using AWX: Job Templates and Jobs
- Managing Projects and Inventories
- Credentials, Permissions (RBAC) and Workflows
- Execution Environments and ansible-navigator
Module 8: Ansible for DevOps
- Ansible and Docker
- Ansible and Kubernetes
- CI/CD with Ansible
- Ansible in Cloud Environments
- Ansible and Terraform
Module 9: Ansible Best Practices
- Code Organization
- Security Best Practices
- Performance Tuning
- Code Quality: ansible-lint and yamllint
- Testing Ansible Code with Molecule
Module 10: Advanced Ansible Topics
- Custom Modules
- Dynamic Inventory
- Ansible Plugins
- The Ansible API and ansible-runner
- Event-Driven Ansible
