Ansible Interview Questions

Tower/AWX Enterprise Automation

questions
Scroll to track progress

Your organization deployed Ansible Tower for centralized automation. 500 teams need access to run playbooks, but Tower's RBAC is complex with custom organizations, teams, and credentials. Developers don't understand permissions. Access requests pile up, and security gets concerned. How do you design scalable RBAC?

Implement hierarchical RBAC aligned with organization structure. Create Tower organizations per department (Engineering, Finance, Operations). Within each org, create teams per function (Platform, Database, Security). Define three permission levels: viewer (read-only), operator (execute playbooks), admin (modify playbooks). Use organization-level credentials for shared services, team-level for team-specific services. Implement credential sharing policies: teams inherit parent org credentials but can't access sibling teams' credentials. Use Tower's inventory sharing to segregate: production inventory is read-only for most teams, writable only for platform team. Document RBAC with matrix: rows=teams, columns=inventory/playbook access levels. Implement self-service onboarding: new team member requests access via form, platform team grants permissions using documented policy. Use Tower's audit logs to monitor access: alert on privilege escalation attempts. Implement regular access reviews: teams audit their members' permissions quarterly. Use LDAP integration to sync teams from directory service automatically.

Follow-up: How would you implement just-in-time access where temporary elevated permissions expire automatically?

Your Ansible Tower processes 10,000 playbook jobs daily. Job execution dashboard shows 20% failure rate, but debugging failures is manual: engineers review job logs one-by-one. How do you implement automated failure analysis and remediation?

Implement Tower workflow engine to add automatic recovery steps. Create workflows where job failure triggers remediation playbook: if deploy fails, run rollback playbook automatically. Use Tower's conditional branching: on_success/on_failure to route jobs to recovery paths. Implement notification webhook on job failure that triggers external analysis: parse job output, identify failure pattern, check knowledge base for solutions. Create Tower smart inventory that marks failed hosts: subsequent playbooks treat them differently (diagnostic mode vs. deployment mode). Implement Tower API integration to query failed job data programmatically. Create analysis playbook that correlates failures: same failure from 5 hosts suggests infrastructure issue rather than application issue. Use Tower's built-in analytics dashboard to visualize failure trends. Implement automatic job retry with backoff: simple failures (network) retry; systemic failures (configuration) don't retry. Create escalation workflow: after 3 failures, page on-call engineer. Implement job output analysis using ML: cluster similar failure messages and group for batch investigation.

Follow-up: How would you implement Tower job logging to external system with full audit trail?

Your Tower cluster spans two data centers for HA. During datacenter failover, Tower jobs in progress are lost. Jobs don't persist state, so recovery is manual. You need automatic failover that preserves job state. How do you design resilient Tower infrastructure?

Implement Tower with external database for shared state: PostgreSQL with replication across datacenters. Configure Tower HA cluster with database at primary datacenter, replicas at secondary. Use Tower's HA setup: multiple Tower instances sharing database via load balancer. During failover, database replicates to standby: standing up Tower instances at secondary DC resumes jobs from database state. Implement job persistence: Tower stores job metadata in database automatically, survives instance failure. Configure Tower to retry failed jobs: failed jobs can be automatically restarted from Tower API. Implement monitoring of Tower cluster health: alert on instance failures. Use load balancer to direct traffic to healthy instances. For data center failover, implement DNS failover or manual cutover process. Backup Tower configuration and settings regularly: `awx-manage export` to export config, restore at standby. Implement job queue durability: use persistent messaging queue (RabbitMQ with clustering) for job dispatch. Test failover procedure monthly to catch issues before production incident.

Follow-up: How would you implement Tower multi-site deployment across regions with load balancing?

Your team uses Tower for deployment automation. Security audit requires change tracking: who ran what job, when, with what parameters, and what changed. Tower's audit log has limited retention (30 days). You need 7-year audit trail for compliance. How do you implement comprehensive audit and compliance?

Implement Tower audit logging to long-term storage. Configure Tower to send job events to external system: Splunk, ELK, or syslog. Capture full context: job template, parameters, user, timestamp, exit code, changed resources. Implement job output archival: Tower stores stdout, but also archive to S3/GCS with immutable retention. Use Tower's API to export job history regularly for long-term storage. Implement event enrichment: job events include approval chain, change ticket reference, business context. Create Tower webhook that triggers on job completion, sends detailed event data to compliance system. For compliance reporting, query long-term storage to generate audit trail: show all changes to specific resource over time. Implement immutable audit: use WORM (Write-Once-Read-Many) storage for audit logs to prevent tampering. Implement audit log integrity: calculate hashes of logs, verify hashes unchanged. Use Tower's RBAC audit: log all permission changes. Implement automated compliance checks: query audit logs to verify policies are followed (e.g., prod deployments require approval).

Follow-up: How would you implement Tower integration with external approval systems for production deployments?

Your Tower environment manages 50 cloud providers' credentials (AWS, Azure, GCP keys). Credential rotation every 90 days is manual nightmare. Rotated credentials break existing jobs. You need automatic credential rotation with zero downtime. How do you solve this?

Implement credential rotation automation using Tower's credential management. Create credential type that references external secret manager: HashiCorp Vault, AWS Secrets Manager. Tower will fetch credentials at job runtime from secret manager instead of storing statically. Implement secret rotation outside Tower: secret manager rotates credentials, Tower automatically picks up new credentials on next job run. For legacy credentials stored in Tower, implement automated rotation playbook: generate new credentials, update secret manager, test new credentials work, update Tower credentials. Use Tower's `credential_plugin` system to dynamically fetch credentials. Implement credential versioning: secret manager maintains credential history, Tower can access current version. For critical credentials, implement dual credentials: new credentials active while old credentials still work temporarily, allowing gradual migration. Implement validation: verify new credentials work before removing old ones. Use Tower's notification system to alert on credential rotation. Test credential rotation procedure in staging before production. Implement emergency access procedures if credential rotation fails: keep emergency credentials in sealed envelope.

Follow-up: How would you implement Tower scaling for 10,000+ concurrent jobs?

Your Tower deployment runs on 10 execution nodes. One node goes down unexpectedly, and 500 jobs in its queue are lost. Tower doesn't automatically redistribute jobs. You need resilient job distribution across execution nodes. How do you design job distribution?

Implement Tower with RabbitMQ clustering for resilient job queue. Configure Tower execution nodes with local queue copy: if node fails, jobs are redistributed to other nodes automatically. Use Tower's job queue priority: critical jobs queue ahead of routine jobs. Implement execution node monitoring: Tower health checks execution nodes, marks unhealthy nodes offline. Configure job retry policy: failed jobs automatically retry on different node. Use Tower's instance groups to organize execution nodes by capability: group 1 for large deployments, group 2 for quick tasks. Route jobs to appropriate group: large jobs → group 1, quick jobs → group 2. Implement execution node auto-scaling: use cloud infrastructure to spin up new nodes when queue depth exceeds threshold. Use persistent job queue with external broker: Kafka or RabbitMQ cluster ensures jobs survive node failures. Implement job checkpointing: long-running jobs periodically save state, can resume from checkpoint on different node. Monitor execution node health continuously: alert when node fails. Test node failure scenarios in staging: simulate node failures and verify jobs are redistributed.

Follow-up: How would you implement Tower job isolation where malicious or buggy playbooks can't affect other jobs?

Your Tower environment executes playbooks submitted by various teams. A newly added playbook has infinite loop, consuming all CPU on execution nodes and starving other jobs. How do you prevent resource exhaustion and implement job sandboxing?

Implement resource limits on jobs using cgroups/Docker containers. Configure Tower to run jobs in isolated containers with CPU limits (1 core), memory limits (2GB), disk limits (10GB). Use Tower's container mode which runs playbooks in ephemeral containers preventing resource leaks. Implement job timeout: all jobs timeout after 2 hours—infinite loops terminate automatically. Use Tower's job slicing: distribute tasks across multiple job processes to prevent single job from monopolizing resources. Monitor job resource usage: alert if job uses >80% CPU, >90% memory. Implement playbook linting in Tower: catch infinite loops statically before execution. Create playbook validation pipeline: code review requirement before playbooks can be used in Tower. Implement job isolation using Kubernetes: Tower executes jobs as K8s pods with resource limits. Use Tower's smart execution: detect runaway jobs (resource usage spikes), pause and alert. Configure per-job resource quotas: different teams get different limits based on usage needs. Implement job queue backpressure: if resource usage high, new jobs queue rather than execute immediately.

Follow-up: How would you implement Tower analytics to show automation ROI metrics?

Your Tower environment uses inventory from multiple sources (AWS, Azure, Kubernetes, custom CMDB). Inventory sync fails intermittently, causing playbooks to operate on stale data. Failed syncs aren't visible until playbook execution fails. How do you implement inventory health monitoring?

Implement Tower inventory source monitoring with automated health checks. Create verification playbook that runs after inventory sync: validate required hosts exist, test connectivity to sample hosts. Use Tower's status endpoint to check inventory source health: HTTP GET to verify source responded. Implement alerting on failed inventories: PagerDuty alert if inventory source unavailable for >5 minutes. Configure inventory source retry policy: automatic retries with exponential backoff for transient failures. Implement inventory rollback: if new inventory is significantly different (>50% hosts changed), investigate before applying. Use Tower's inventory cache to fall back to previous inventory if current sync fails. Create inventory validation playbook: ensure minimum hosts present, verify critical hosts are included. Implement inventory age tracking: alert if inventory hasn't been updated in >1 hour. Use Tower's activity stream to track inventory syncs: query to find failed syncs. Create dashboard showing inventory source health status. For multi-source inventory, implement health status by source: if one source fails, mark as unreliable but continue with other sources.

Follow-up: How would you implement Tower capacity planning to predict resource requirements?

Want to go deeper?