Roots Discourse

Provisioning: "conditional check 'ubuntu_release.stdout | trim == 'bionic'' failed"

I’m having this error message when wanting to re-provision the remote server, and don’t really understand what it means. The server is indeed Ubuntu 18.04. So what could cause the condition to fail ?

  TASK [python_interpreter : Set ansible_python_interpreter for Ubuntu 18.04 Bionic] ***********************************************************
    task path: /Users/me/GITHUB/projects/new.domain.org/trellis/roles/python_interpreter/tasks/main.yml:6
    System info:
      Ansible 2.8.11; Darwin
      Trellis Head
    ---------------------------------------------------
    The conditional check 'ubuntu_release.stdout | trim == 'bionic'' failed. The
    error was: error while evaluating conditional (ubuntu_release.stdout | trim
    == 'bionic'): 'dict object' has no attribute 'stdout'

    The error appears to be in '/Users/me/GITHUB/
    projects/new.domain.org/trellis/roles/python_interpreter/tasks/main.yml':
    line 6, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

        changed_when: false
      - name: Set ansible_python_interpreter for Ubuntu 18.04 Bionic
        ^ here

Ansible version:

ansible 2.8.11
  config file = /Users/me/GITHUB/projects/new.domain.org/trellis/ansible.cfg
  configured module search path = ['/Users/me/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/me/.pyenv/versions/3.7.7/lib/python3.7/site-packages/ansible
  executable location = /Users/me/.pyenv/versions/3.7.7/bin/ansible
  python version = 3.7.7 (default, May 21 2020, 13:10:15) [Clang 11.0.0 (clang-1100.0.33.8)]

Looks like it’s failed on python_interpreter role - try jumping onto the remote and running the command the task is failing on: lsb_release -cs

thank you for your guidance. This is what it outputs

$ lsb_release -cs
bionic

That’s pretty weird… it’s coming from here: https://github.com/roots/trellis/blob/6465b7d7f7b8ff860ff4b7ce957f5b188973b0ea/roles/python_interpreter/tasks/main.yml

The task before the one that fails registers the ubuntu_release variable. Could you edit that file to add to look like this and re-provision?

- block:
  - name: Get Ubuntu release
    raw: lsb_release -cs
    register: ubuntu_release
    changed_when: false
  - name: debug
     debug:
       var: ubuntu_release
  - name: Set ansible_python_interpreter for Ubuntu 18.04 Bionic
    set_fact:
      ansible_python_interpreter: python3
    when: ubuntu_release.stdout | trim == 'bionic'
  when: ansible_python_interpreter is not defined
  tags: always

I just added that debug task to output the variable.

And provide the output here please?