Why Ansible include_tasks Variables Are Not Defined in the Parent Play

Why Ansible include_tasks Variables Are Not Defined in the Parent Play You define a variable inside an include_tasks file. The task runs successfully. Then the very next task in your parent play fails with variable is undefined. What just happened? This is one of the most confusing Ansible behaviors, and it bites people repeatedly because it looks like a bug. It’s not — it’s a scoping decision — but understanding why it works this way helps you fix it fast. ...

April 15, 2026 Â· 5 min Â· 853 words Â· Rob Washington

Why Ansible register Variable Is Undefined in the Next Task

Why Ansible register Variable Is Undefined in the Next Task You registered a variable in one task, and the next task fails with "msg": "The task includes an option with an undefined variable". The variable is right there — you can see it in the task above. What’s going on? This is one of the most common Ansible debugging rabbit holes. There are four distinct causes, and they look identical until you know what to look for. ...

April 14, 2026 Â· 5 min Â· 968 words Â· Rob Washington

How to Troubleshoot Ansible Playbook Failures When Syncing Databases with PAM Integration

How to Troubleshoot Ansible Playbook Failures When Syncing Databases with PAM Integration Automating database synchronization in environments with Privileged Access Management (PAM) systems like CyberArk can be a powerful way to streamline operations. However, when things go wrong, Ansible playbook failures can be frustrating and time-consuming to debug. Common issues include credential retrieval errors, connection timeouts, permission problems, and data inconsistency. In this post, we’ll dive into practical steps to troubleshoot these failures, complete with code examples and best practices. This guide is based on real-world scenarios I’ve encountered while setting up PAM-integrated DB sync roles. ...

April 13, 2026 Â· 5 min Â· 877 words Â· Rob Washington

How to Query the ServiceNow Table API with Ansible

ServiceNow’s Table API is how you read and write records programmatically — incidents, change requests, service catalog items, CMDB entries. Here’s how to query it from Ansible using the uri module. Authentication ServiceNow uses basic auth for API calls. Store your credentials as variables, not hardcoded values: 1 2 3 4 # group_vars/all.yml or vault snow_instance: "company.service-now.com" snow_user: "svc_automation" snow_password: "{{ vault_snow_password }}" Test your connection first: 1 2 3 4 5 6 7 8 9 10 - name: Test ServiceNow connectivity ansible.builtin.uri: url: "https://{{ snow_instance }}/api/now/table/incident?sysparm_limit=1" method: GET user: "{{ snow_user }}" password: "{{ snow_password }}" force_basic_auth: true status_code: 200 validate_certs: true register: snow_test Basic Table Query The Table API endpoint is /api/now/table/{table_name}. Common tables: ...

April 10, 2026 Â· 5 min Â· 932 words Â· Rob Washington

CyberArk REST API Returns 401 Even with Valid Session Token (How to Fix)

You authenticate to CyberArk’s PVWA API, get a session token back with HTTP 200, then immediately call GET /PasswordVault/api/Accounts and get a 401 Unauthorized. The token looks valid. You confirmed it’s being passed in the request. The account has the right permissions. Here’s why it’s happening and how to fix it. The Problem: Wrong Authorization Header Format CyberArk’s PVWA API (v9.x and earlier) does not use the standard Bearer token format. Sending: ...

April 9, 2026 Â· 4 min Â· 802 words Â· Rob Washington

Ansible include_role Variables Not Available Inside the Role (How to Fix)

You set a variable with set_fact. You call include_role. Inside the role, the variable is undefined. You check the task order — it’s definitely set first. You add debug statements. The variable exists in the play but not inside the role. This is one of the most confusing variable scoping issues in Ansible. Here’s what’s happening and how to fix it. The Problem 1 2 3 4 5 6 7 8 9 - name: Set environment ansible.builtin.set_fact: MY_REGION: "us-east" - name: Run the role ansible.builtin.include_role: name: my_role vars: some_param: "value" Inside my_role/tasks/main.yml: ...

April 8, 2026 Â· 4 min Â· 772 words Â· Rob Washington

Why Ansible set_fact Persists Between Roles (And How to Reset It)

You set a variable with set_fact inside a role. It works perfectly. Then you run the same role again — either in a loop, or later in the same playbook — and it behaves differently. The variable has a value from the previous run that you didn’t expect. This is one of Ansible’s most common gotchas. Here’s exactly why it happens and how to fix it. Why set_fact Persists In Ansible, set_fact sets a variable at the host level for the duration of the play. It is not scoped to the role or task file that created it. Once set, it stays set until: ...

April 7, 2026 Â· 4 min Â· 820 words Â· Rob Washington

Docker Container Exits Immediately After Starting (How to Fix It)

You run docker run myimage or docker compose up and the container vanishes instantly. docker ps shows nothing. docker ps -a shows the container with status Exited (0) or Exited (1) seconds ago. Here’s how to figure out what’s happening and fix it. Step 1: Check the logs first Before anything else: 1 docker logs <container_id_or_name> If the container is already gone, use the container ID from docker ps -a: ...

April 6, 2026 Â· 5 min Â· 905 words Â· Rob Washington

Fix Python SSL: CERTIFICATE_VERIFY_FAILED Error

You’re making an HTTP request in Python and suddenly: s s l . S S L C e r t V e r i f i c a t i o n E r r o r : [ S S L : C E R T I F I C A T E _ V E R I F Y _ F A I L E D ] c e r t i f i c a t e v e r i f y f a i l e d : u n a b l e t o g e t l o c a l i s s u e r c e r t i f i c a t e Or with requests: ...

April 5, 2026 Â· 5 min Â· 963 words Â· Rob Washington

Fix: Shell Script Works Manually But Fails in Cron

You’ve written a shell script. It works perfectly when you run it manually. You add it to cron, and… nothing. No output, no errors, just silence. This is one of the most common and frustrating problems in Linux administration. Here’s why it happens and how to fix it. The Root Cause: Environment Differences When you run a script manually, you get your full shell environment: $PATH, environment variables, your working directory, and all the context you’re used to. ...

April 4, 2026 Â· 4 min Â· 678 words Â· Rob Washington