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

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: 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

Why Your Cron Job Isn't Running (And How to Fix It)

You added a cron job. It works when you run it manually. But cron just… doesn’t run it. No errors, no output, nothing. This is one of the most frustrating debugging experiences in Linux. Here’s a systematic checklist to find out what’s actually wrong. 1. Check If Cron Is Running First, make sure the cron daemon is actually running: 1 2 3 4 5 6 7 # systemd systems systemctl status cron # or systemctl status crond # Older init systems service cron status If it’s not running, start it: ...

April 2, 2026 Â· 5 min Â· 922 words Â· Rob Washington

Fix: Kubernetes Pod Stuck in CrashLoopBackOff

Your pod is stuck in CrashLoopBackOff. Kubernetes keeps restarting it, each time waiting longer before trying again. Here’s how to diagnose and fix it. What CrashLoopBackOff Actually Means CrashLoopBackOff isn’t the error itself — it’s Kubernetes telling you “this container keeps crashing, so I’m backing off on restarts.” The actual problem is that your container exits with a non-zero exit code. Kubernetes notices, restarts it, it crashes again, and the backoff timer increases: 10s, 20s, 40s, up to 5 minutes. ...

April 1, 2026 Â· 6 min Â· 1086 words Â· Rob Washington

Why Your Cron Job Isn't Running (And How to Fix It)

You added a cron job. You’re sure the syntax is right. But nothing happens. No output, no errors, just silence. Here’s how to figure out what’s wrong. Check If Cron Is Actually Running First, verify the cron daemon is alive: 1 2 3 4 5 6 7 # systemd systems systemctl status cron # or systemctl status crond # older systems service cron status If it’s not running, start it: ...

March 29, 2026 Â· 4 min Â· 759 words Â· Rob Washington

Why Does My Docker Container Exit Immediately? (And How to Fix It)

You run docker run myimage and… nothing. The container starts, exits immediately, and you’re left staring at a silent terminal. Sound familiar? This is one of the most common Docker frustrations, especially for beginners. Let’s fix it. Understanding Why Containers Exit A Docker container runs as long as its main process (PID 1) is running. When that process exits, the container exits. This is by design — containers aren’t VMs that sit around waiting for something to happen. ...

March 26, 2026 Â· 4 min Â· 755 words Â· Rob Washington

Docker Container Keeps Restarting: How to Debug and Fix

Your container is restarting. Over and over. docker ps shows it’s been up for 3 seconds, then 5, then 2. You’re stuck in a loop and the logs aren’t helping. Here’s how to debug it systematically. Step 1: Check the Exit Code 1 docker inspect --format='{{.State.ExitCode}}' container_name Common exit codes: 0: Clean exit (container finished its job) 1: Application error (check your code) 137: OOMKilled (out of memory) 139: Segfault 143: SIGTERM (graceful shutdown) If you see 137, your container is being killed for using too much memory. Skip to the OOM section below. ...

March 23, 2026 Â· 4 min Â· 662 words Â· Rob Washington