Skip to content

dispatch role not finding play variables #422

Open
@jce-redhat

Description

@jce-redhat

Summary

when running the following playbook from the controller, the dispatch role doesn't find the play variables:

---
- name: Private Hub Configuration as Code
  hosts: localhost
  connection: local
  gather_facts: false

  vars:
    ah_validate_certs: false
    ah_configuration_async_delay: 3

    ah_namespaces:
      - name: test_namespace
        description: 'Test Namespace'

    ah_ee_registries:
      - name: registry.redhat.io
        url: https://registry.redhat.io/


  tasks:
    - name: Run hub configuration dispatcher
      ansible.builtin.include_role:
        name: infra.ah_configuration.dispatch

...

the role conditionals are skipped because the dispatch role thinks they aren't set:

skipping: [aapdev0.example.org] => (item={'role': 'ee_registry', 'var': 'ah_ee_registries', 'tags': 'registries'})  => {
    "__role": {
        "role": "ee_registry",
        "tags": "registries",
        "var": "ah_ee_registries"
    },
    "ansible_loop_var": "__role",
    "changed": false,
    "false_condition": "hostvars[inventory_hostname][__role.var] is defined",
    "skip_reason": "Conditional result was False"
}

skipping: [aapdev0.example.org] => (item={'role': 'namespace', 'var': 'ah_namespaces', 'tags': 'namespaces'})  => {
    "__role": {
        "role": "namespace",
        "tags": "namespaces",
        "var": "ah_namespaces"
    },
    "ansible_loop_var": "__role",
    "changed": false,
    "false_condition": "hostvars[inventory_hostname][__role.var] is defined",
    "skip_reason": "Conditional result was False"
}

looking at the infra.controller_configuration.dispatch role, it looks for var[__role.var] whereas infra.ah_configuration.dispatch looks for hostvars[inventory_hostname][__role.var]. if i modify the hub dispatch role to use var[__role.var] like the controller dispatch role, the playbook works without issue.

Issue Type

  • Bug Report

Ansible, Collection, Private Automation Hub details

ansible --version
ansible [core 2.15.12]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.19 (main, May 16 2024, 08:45:40) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.9)
  jinja version = 3.1.4
  libyaml = True

ansible-galaxy collection list
# /usr/share/ansible/collections/ansible_collections
Collection                          Version
----------------------------------- -------
amazon.aws                          8.1.0
ansible.controller                  4.5.8
ansible.netcommon                   7.0.0
ansible.posix                       1.5.4
ansible.utils                       5.0.0
ansible.windows                     2.4.0
chocolatey.chocolatey               1.5.1
cisco.ios                           9.0.0
cisco.iosxr                         10.0.0
cisco.nxos                          9.0.0
community.general                   9.2.0
community.windows                   2.2.0
containers.podman                   1.15.4
infoblox.nios_modules               1.6.1
infra.ah_configuration              2.0.6
infra.controller_configuration      2.9.0
kubernetes.core                     5.0.0
redhat.insights                     1.3.0
redhat.openshift                    4.0.0
redhat.openshift_virtualization     1.5.0
redhat.rhel_system_roles            1.23.0
redhat.satellite                    4.0.0
redhat_cop.controller_configuration 2.3.1

Private Automation Hub version

automation-hub-4.7.3-1.el8ap.noarch (from the 2.4-2 containerized tech preview)
  • ansible installation method: one of source, pip, OS package, EE

EE, from quay.io/acme_corp/product_demos_ee:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions