-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybook_debug.yml
More file actions
42 lines (36 loc) · 1.27 KB
/
playbook_debug.yml
File metadata and controls
42 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# debug.yml
- name: "Debug network and environment as root"
hosts: localhost
connection: local
tasks:
- name: "1. Confirm user"
become: yes
ansible.builtin.command: whoami
register: whoami_output
- name: "2. Print all environment variables"
become: yes
ansible.builtin.command: env
register: env_output
- name: "3. Check DNS resolver configuration"
become: yes
ansible.builtin.command: cat /etc/resolv.conf
register: resolv_output
ignore_errors: yes
- name: "4. Test DNS lookup with dig"
become: yes
ansible.builtin.command: dig github.com
register: dig_output
ignore_errors: yes
- name: "5. Test HTTPS connection with curl (verbose)"
become: yes
ansible.builtin.command: curl -v https://github.com
register: curl_output
ignore_errors: yes
- name: "--- DEBUG RESULTS ---"
ansible.builtin.debug:
msg:
- "Running as user: {{ whoami_output.stdout }}"
- "Environment Vars: {{ env_output.stdout_lines }}"
- "/etc/resolv.conf: {{ resolv_output.stdout_lines }}"
- "Dig Output: {{ dig_output.stdout_lines }}"
- "Curl Output: {{ curl_output.stderr_lines }}" # Curl's verbose output goes to stderr