ee_utilities icon indicating copy to clipboard operation
ee_utilities copied to clipboard

'Gather results from pip_freeze based on conditions' task fails

Open ansiblejunky opened this issue 1 year ago • 0 comments

Summary

The 'Gather results from pip_freeze based on conditions' task fails when running a playbook using this collection/role to extract info about current venvs on an existing Tower node. The specific when clause here causes the following error:

TASK [infra.ee_utilities.virtualenv_migrate : Gather results from pip_freeze based on conditions] ******************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'not __venv_migrate_freeze_results_default.skipped | bool' failed. The error was: error while evaluating conditional (not __venv_migrate_freeze_results_default.skipped | bool): 'dict object' has no attribute 'skipped'\n\nThe error appears to be in '/app/collections/ansible_collections/infra/ee_utilities/roles/virtualenv_migrate/tasks/00_gather_custom_requirements.yml': line 35, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Gather results from pip_freeze based on conditions\n  ^ here\n"}

The problem appears to be that the var has an array of items, each with a skipped parameter. So doing the when clause format to access the skipped parameter will not work.

Issue Type

  • Bug Report

Ansible, Collection, Docker/Podman details

ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Oct 20 2022, 09:31:56) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]

ansible-galaxy collection list
(not supported in this version)

podman --version
Client:       Podman Engine
Version:      4.2.0
API Version:  4.2.0
Go Version:   go1.18.4
Built:        Mon Dec 12 06:41:56 2022
OS/Arch:      linux/amd64

  • ansible installation method: one of source, pip, OS package, EE Traditional Tower installation, with 3 custom virt envs in a custom location.

OS / ENVIRONMENT

Desired Behavior

I'm not sure what the task is trying to do, to be honest. I'm not sure when a venv would be skipped. This functionality may also not be working well, because the list of items in the array all show "skipped: true". Not sure why.

Actual Behavior

see above

STEPS TO REPRODUCE

- name: Playbook to create custom EE
  hosts: localhost
  gather_facts: false
  collections:
    - infra.ee_utilities
  vars:
    # venv_migrate_default_ee_url: registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest
    venv_migrate_default_ee_url: registry.redhat.io/ansible-automation-platform-23/ee-29-rhel8:latest
    venv_migrate_show_diff_with_default: true
  tasks:
    - name: Include venv_migrate role
      include_role:
        name: infra.ee_utilities.virtualenv_migrate

    - name: Display ee_list
      debug:
        var: ee_list

    - name: Export python virtual enviroment list to file
      copy:
        content: "{{ ee_list | to_nice_yaml(width=50, explicit_start=True, explicit_end=True) }}"
        dest: venv_migrate_ee_python.yaml
...

ansiblejunky avatar May 08 '23 21:05 ansiblejunky