CIS Ansible Automation Platform Benchmark

Security configuration recommendations for Ansible Automation Platform

v1.0.0 01-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for Ansible Automation Platform deployments. It covers installation security, inventory protection, playbook hardening, role and collection verification, privilege escalation controls, logging, and AWX/Controller security using ansible CLI, ansible-vault, ansible-lint, and the AWX API.

16Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1Installation SecurityVersion management, ansible.cfg hardening, and vault password protection
2Inventory SecurityFile permissions and vault encryption for sensitive variables
3Playbook Securityno_log usage, module selection, and ansible-lint validation
4Role & Collection SecurityVersion pinning and signature verification for dependencies
5Execution SecurityTargeted privilege escalation and SSH configuration
6Logging & AuditingAnsible logging and callback plugin recording
7AWX / ControllerSession security, authentication, and external credential integration

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all Ansible Automation Platform deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — Installation Security

▶

1.1 Core Configuration

▶
1.1.1 Ensure Ansible is up to date (Automated)
L1 Auto
Description

This recommendation verifies that Ansible is up to date on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Ansible version:
ansible --version
ansible-playbook --version
pip show ansible-core | grep Version
Remediation
# Update Ansible to latest stable:
pip install --upgrade ansible-core
# or via package manager:
sudo dnf update -y ansible-core
1.1.2 Ensure ansible.cfg is securely configured (Automated)
L1 Auto
Description

This recommendation verifies that ansible.cfg is securely configured on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check ansible.cfg location and settings:
ansible-config dump --only-changed
ansible-config view
ls -la /etc/ansible/ansible.cfg ~/.ansible.cfg ./ansible.cfg
Remediation
# Secure ansible.cfg:
[defaults]
forks = 20
host_key_checking = True
no_log = False
retry_files_enabled = False

[privilege_escalation]
become = False
become_method = sudo
become_ask_pass = True

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=yes
1.1.3 Ensure vault passwords are not stored in plaintext (Automated)
L1 Auto
Description

This recommendation verifies that vault passwords are not stored in plaintext on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check vault configuration:
ansible-vault --version
ls -la ~/.vault_pass* 2>/dev/null
grep 'vault_password_file' ansible.cfg
Remediation
# Never store vault password in plaintext files:
# Use environment-based or prompt-based vault password:
export ANSIBLE_VAULT_PASSWORD_FILE=/path/to/vault-pass-client.py

# vault-pass-client.py should fetch from secrets manager:
#!/usr/bin/env python3
import subprocess
print(subprocess.check_output(['aws', 'secretsmanager', 'get-secret-value', '--secret-id', 'ansible-vault']).decode().strip())

2 — Inventory Security

▶

2.1 Inventory Hardening

▶
2.1.1 Ensure inventory files have restricted permissions (Automated)
L1 Auto
Description

This setting ensures that inventory files have restricted permissions on the Ansible Automation Platform configuration management tool. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Ansible Automation Platform configuration management tool is essential for defense in depth.

Audit
# Check inventory file permissions:
ls -la /etc/ansible/hosts ./inventory/ ./hosts
stat -c '%a %U:%G %n' /etc/ansible/hosts 2>/dev/null
Remediation
# Restrict inventory file access:
chmod 640 /etc/ansible/hosts
chown root:ansible /etc/ansible/hosts

# Use dynamic inventory instead of static files:
# ansible.cfg: inventory = ./dynamic_inventory.py
2.1.2 Ensure sensitive inventory variables are vault-encrypted (Automated)
L1 Auto
Description

This recommendation verifies that sensitive inventory variables are vault-encrypted on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check for plaintext passwords in inventory:
grep -rn 'ansible_password\|ansible_ssh_pass\|ansible_become_pass' inventory/ /etc/ansible/hosts
Remediation
# Encrypt sensitive inventory variables:
ansible-vault encrypt inventory/group_vars/all/vault.yml

# Use vault-encrypted variables:
# vault.yml:
# vault_db_password: encrypted_value
# main.yml:
# db_password: "{{ vault_db_password }}"

3 — Playbook Security

▶

3.1 Playbook Hardening

▶
3.1.1 Ensure no_log is used for sensitive tasks (Automated)
L1 Auto
Description

This recommendation verifies that no_log is used for sensitive tasks on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check for no_log usage on sensitive tasks:
grep -rn 'no_log' playbooks/ roles/
grep -rn 'password\|secret\|token\|key' playbooks/ roles/ | grep -v no_log | grep -v '.vault'
Remediation
# Add no_log to tasks handling sensitive data:
# - name: Set database password
#   mysql_user:
#     name: admin
#     password: "{{ vault_db_password }}"
#   no_log: true
3.1.2 Ensure shell and command modules are minimized (Automated)
L1 Auto
Description

This setting ensures that shell and command modules are minimized on the Ansible Automation Platform configuration management tool. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Ansible Automation Platform configuration management tool is essential for defense in depth.

Audit
# Check for shell/command module usage:
grep -rn 'shell:\|command:\|raw:' playbooks/ roles/ | wc -l
grep -rn 'shell:\|command:' playbooks/ roles/ | head -20
Remediation
# Replace shell/command with specific modules:
# BAD:
# - shell: useradd -m newuser
# GOOD:
# - user:
#     name: newuser
#     create_home: yes
#     state: present

# Use ansible-lint to catch these:
ansible-lint playbooks/ -R -r ~/.ansible/rules/
3.1.3 Ensure ansible-lint is used for playbook validation (Automated)
L1 Auto
Description

This recommendation verifies that ansible-lint is used for playbook validation on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Lint playbooks for security issues:
ansible-lint --version
ansible-lint playbooks/*.yml 2>&1 | head -30
Remediation
# Install and configure ansible-lint:
pip install ansible-lint

# Create .ansible-lint config:
# .ansible-lint:
# enable_list:
#   - no-changed-when
#   - no-jinja-when
#   - command-instead-of-shell
# warn_list:
#   - experimental

ansible-lint playbooks/ roles/

4 — Role & Collection Security

▶

4.1 Dependency Management

▶
4.1.1 Ensure collection and role versions are pinned (Automated)
L1 Auto
Description

This recommendation verifies that collection and role versions are pinned on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# List installed collections and roles:
ansible-galaxy collection list
ansible-galaxy role list
ls -la ~/.ansible/collections/ ~/.ansible/roles/
Remediation
# Pin collection versions in requirements.yml:
# requirements.yml:
# collections:
#   - name: community.general
#     version: ">=9.0.0,<10.0.0"
#   - name: ansible.posix
#     version: "1.5.4"

ansible-galaxy collection install -r requirements.yml --force
4.1.2 Ensure collection signatures are verified (Manual)
L2 Manual
Description

This recommendation verifies that collection signatures are verified on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check collection signature verification:
ansible-galaxy collection verify community.general 2>&1
grep 'gpg' ansible.cfg
Remediation
# Enable collection signature verification:
# ansible.cfg:
[galaxy]
gpg_keyring = ~/.ansible/pubring.kbx

# Import Ansible Galaxy signing key:
gpg --import ansible-galaxy-pubkey.asc

# Verify before install:
ansible-galaxy collection install community.general --keyring ~/.ansible/pubring.kbx

5 — Execution Security

▶

5.1 Privilege & Transport

▶
5.1.1 Ensure privilege escalation is targeted per task (Automated)
L1 Auto
Description

This recommendation verifies that privilege escalation is targeted per task on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check become/privilege escalation settings:
ansible-config dump | grep -i become
grep -rn 'become:' playbooks/ roles/ | head -20
Remediation
# Use targeted privilege escalation:
# Per-task become (not play-wide):
# - name: Install package
#   apt:
#     name: nginx
#   become: true
#   become_method: sudo

# Configure sudoers for least privilege:
# ansible ALL=(ALL) NOPASSWD: /usr/bin/apt-get, /usr/bin/systemctl
5.1.2 Ensure SSH keys and pipelining are properly configured (Automated)
L1 Auto
Description

This recommendation verifies that SSH keys and pipelining are properly configured on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check SSH key configuration:
ssh-add -l
grep 'private_key_file\|ssh_args' ansible.cfg
Remediation
# Configure SSH with strong keys:
# ansible.cfg:
[defaults]
private_key_file = ~/.ssh/ansible_ed25519

[ssh_connection]
ssh_args = -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=~/.ssh/known_hosts
pipelining = True

6 — Logging & Auditing

▶

6.1 Audit Trail

▶
6.1.1 Ensure Ansible logging is enabled (Automated)
L1 Auto
Description

This recommendation verifies that Ansible logging is enabled on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Ansible logging:
ansible-config dump | grep -i log
ls -la /var/log/ansible* 2>/dev/null
Remediation
# Enable logging in ansible.cfg:
[defaults]
log_path = /var/log/ansible/ansible.log

# Create log directory:
mkdir -p /var/log/ansible
chown ansible:ansible /var/log/ansible
chmod 750 /var/log/ansible

# Enable callback plugins for detailed logging:
[defaults]
callback_whitelist = timer, profile_tasks, log_plays
6.1.2 Ensure callback plugins record playbook runs (Automated)
L2 Auto
Description

This recommendation verifies that callback plugins record playbook runs on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check callback plugins:
ansible-config dump | grep callback
ansible-doc -t callback -l
Remediation
# Enable ARA callback for playbook recording:
pip install ara[server]

# ansible.cfg:
[defaults]
callback_plugins = $(python3 -m ara.setup.callback_plugins)

# View run history:
ara playbook list
ara result list

7 — AWX / Controller

▶

7.1 Controller Security

▶
7.1.1 Ensure AWX session and authentication settings are hardened (Automated)
L1 Auto
Description

This recommendation verifies that AWX session and authentication settings are hardened on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check AWX/Controller settings:
awx-manage --version 2>/dev/null
curl -sk https://awx.example.com/api/v2/settings/authentication/ -H 'Authorization: Bearer $AWX_TOKEN' | jq .
Remediation
# Configure AWX security settings:
# Via API:
curl -sk -X PATCH https://awx.example.com/api/v2/settings/authentication/ \
  -H 'Authorization: Bearer $AWX_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"SESSION_COOKIE_AGE": 1800, "SESSIONS_PER_USER": 3, "AUTH_BASIC_ENABLED": false}'
7.1.2 Ensure credentials use external vault integration (Manual)
L1 Manual
Description

This recommendation verifies that credentials use external vault integration on the Ansible Automation Platform configuration management tool. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Ansible Automation Platform configuration management tool vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check AWX credential types:
curl -sk https://awx.example.com/api/v2/credentials/ \
  -H 'Authorization: Bearer $AWX_TOKEN' | \
  jq '.results[] | {name, credential_type: .summary_fields.credential_type.name}'
Remediation
# Use external credential lookups:
# AWX > Settings > Jobs > External Credential Vault
# Configure HashiCorp Vault as external credential provider
# Use machine credentials over passwords
# Rotate credentials regularly via AWX credential API