Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] tailscale status task output sometimes fails to parse as json #421

Closed
whysthatso opened this issue Jan 25, 2024 · 5 comments
Closed
Labels
bug This bug is confirmed and can be reproduced.

Comments

@whysthatso
Copy link

Describe the bug
I'm not certain if this is a bug. I'm running the role like this:

    - name: include tailscale role
      ansible.builtin.include_role:
        name: git.artis3n.tailscale

and I'm getting this error:

TASK [git.artis3n.tailscale : Install | Parse status JSON] ******************************************************************************************************************************************************
fatal: [docker-host-1]: FAILED! => {}                                                                                                                                                                            
                                                                                                                                                                                                                 
MSG:                                                                                                                                                                                                             
                                                                                                                                                                                                                 
The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'Self'. 'dict object' has no attribute 'Self'                                                              
                                                                                                                                                                                                                 
The error appears to be in '/home/user/ansible/roles/git.artis3n.tailscale/tasks/install.yml': line 67, column 3, but may                                                                    
be elsewhere in the file depending on the exact syntax problem.                                                                                                                                                  

The offending line appears to be:


- name: Install | Parse status JSON
  ^ here

Everything is dandy when i run it traditionally:

  roles:
    - git.artis3n.tailscale

Is this related on how facts get set, and that include_role works differently here?

@whysthatso whysthatso added the bug:needs-reproduction A reported bug that needs to be confirmed and reproduced. label Jan 25, 2024
@artis3n
Copy link
Owner

artis3n commented Jan 25, 2024

Hmm, I do have multiple integration tests using include_role, check out molecule/args/converge.yml and molecule/state-idempotent/converge.yml, for example. I suspect there's a variable issue at play.

Do you have a variable overriding status? Because the error seems to be that the variable isn't formatted correctly.

status: "{{ tailscale_status.stdout | from_json }}"

I should really modify that to a role-specific name anyway, that's too generic of a name... but let me know if you can isolate the issue into a reproducible minimal playbook.

@jsenecal
Copy link

jsenecal commented Jan 25, 2024

I actually have experienced the same issue. Let me know if/how I could help with troubleshooting/resolving this.

This is how it is invoked here:

- name: Install tools
  hosts:
    - qix_oob
  become: yes
  strategy: free
  vars_prompt:
    - name: tailscale_authkey 
      prompt: Tailscale authkey?
      private: true
  tasks:
    - name: Install a list of packages
      ansible.builtin.apt:
        pkg:
        - tcpdump
        - iperf3
        - netcat
  roles:
    - role: artis3n.tailscale

When ran the second time, the error message is gone.

@artis3n artis3n changed the title [BUG] [BUG] tailscale status task output intermittently fails to parse as json Jan 25, 2024
@artis3n artis3n changed the title [BUG] tailscale status task output intermittently fails to parse as json [BUG] tailscale status task output sometimes fails to parse as json Jan 25, 2024
@artis3n
Copy link
Owner

artis3n commented Feb 5, 2024

What distros/initial operating environments are people seeing this occur with?

@whysthatso
Copy link
Author

What distros/initial operating environments are people seeing this occur with?

Ubuntu 22.04

@artis3n
Copy link
Owner

artis3n commented Feb 24, 2024

This should be fixed by #431 , I'll publish a new release soon

@artis3n artis3n added bug This bug is confirmed and can be reproduced. and removed bug:needs-reproduction A reported bug that needs to be confirmed and reproduced. labels Mar 7, 2024
@artis3n artis3n closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This bug is confirmed and can be reproduced.
Projects
None yet
Development

No branches or pull requests

3 participants