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

Filetree_create role failing with Unexpected templating type error when using input tag of teams or roles against my AAP instance #34

Open
a083138 opened this issue Nov 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@a083138
Copy link

a083138 commented Nov 20, 2024

Summary

When running the filetree_create role against my AAP instance, it is failing ("Unexpected templating type error occurred...") when using the 'teams' or 'roles' input tag.

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
ansible [core 2.17.4]
  config file = None
  configured module search path = ['/Users/a083138/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/a083138/.ansible/collections:/usr/share/ansible/collections
  executable location = /Library/Frameworks/Python.framework/Versions/3.11/bin/ansible
  python version = 3.11.2 (v3.11.2:878ead1ac1, Feb  7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] (/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True


ansible-galaxy collection list
# /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ansible_collections
Collection                               Version
---------------------------------------- -------
amazon.aws                               8.2.1  
ansible.netcommon                        6.1.3  
ansible.posix                            1.5.4  
ansible.utils                            4.1.0  
ansible.windows                          2.5.0  
arista.eos                               9.0.0  
awx.awx                                  24.6.1 
azure.azcollection                       2.7.0  
check_point.mgmt                         5.2.3  
chocolatey.chocolatey                    1.5.1  
cisco.aci                                2.10.1 
cisco.asa                                5.0.1  
cisco.dnac                               6.18.0 
cisco.intersight                         2.0.17 
cisco.ios                                8.0.0  
cisco.iosxr                              9.0.0  
cisco.ise                                2.9.3  
cisco.meraki                             2.18.1 
cisco.mso                                2.9.0  
cisco.nxos                               8.1.0  
cisco.ucs                                1.11.0 
cloud.common                             3.0.0  
cloudscale_ch.cloud                      2.4.0  
community.aws                            8.0.0  
community.ciscosmb                       1.0.9  
community.crypto                         2.22.0 
community.digitalocean                   1.27.0 
community.dns                            3.0.4  
community.docker                         3.12.1 
community.general                        9.4.0  
community.grafana                        1.9.1  
community.hashi_vault                    6.2.0  
community.hrobot                         2.0.1  
community.library_inventory_filtering_v1 1.0.1  
community.libvirt                        1.3.0  
community.mongodb                        1.7.6  
community.mysql                          3.10.3 
community.network                        5.0.3  
community.okd                            3.0.1  
community.postgresql                     3.5.0  
community.proxysql                       1.6.0  
community.rabbitmq                       1.3.0  
community.routeros                       2.19.0 
community.sap_libs                       1.4.2  
community.sops                           1.9.0  
community.vmware                         4.7.0  
community.windows                        2.3.0  
community.zabbix                         2.5.1  
containers.podman                        1.15.4 
cyberark.conjur                          1.3.0  
cyberark.pas                             1.0.27 
dellemc.enterprise_sonic                 2.5.0  
dellemc.openmanage                       9.6.0  
dellemc.powerflex                        2.5.0  
dellemc.unity                            2.0.0  
f5networks.f5_modules                    1.30.1 
fortinet.fortimanager                    2.7.0  
fortinet.fortios                         2.3.7  
frr.frr                                  2.0.2  
google.cloud                             1.4.1  
grafana.grafana                          5.5.0  
hetzner.hcloud                           3.1.1  
ibm.qradar                               3.0.0  
ibm.spectrum_virtualize                  2.0.0  
ibm.storage_virtualize                   2.4.1  
ieisystem.inmanage                       2.0.0  
infinidat.infinibox                      1.4.5  
infoblox.nios_modules                    1.6.1  
inspur.ispim                             2.2.3  
inspur.sm                                2.3.0  
junipernetworks.junos                    8.0.0  
kaytus.ksmanage                          1.2.2  
kubernetes.core                          3.2.0  
kubevirt.core                            1.5.0  
lowlydba.sqlserver                       2.3.3  
microsoft.ad                             1.7.1  
netapp.cloudmanager                      21.22.1
netapp.ontap                             22.12.0
netapp.storagegrid                       21.12.0
netapp_eseries.santricity                1.4.0  
netbox.netbox                            3.19.1 
ngine_io.cloudstack                      2.4.0  
ngine_io.exoscale                        1.1.0  
openstack.cloud                          2.2.0  
openvswitch.openvswitch                  2.1.1  
ovirt.ovirt                              3.2.0  
purestorage.flasharray                   1.31.1 
purestorage.flashblade                   1.18.0 
sensu.sensu_go                           1.14.0 
splunk.es                                3.0.0  
t_systems_mms.icinga_director            2.0.1  
telekom_mms.icinga_director              2.1.2  
theforeman.foreman                       4.2.0  
vmware.vmware                            1.5.0  
vmware.vmware_rest                       3.1.0  
vultr.cloud                              1.13.0 
vyos.vyos                                4.1.0  
wti.remote                               1.0.8  

# /Users/a083138/.ansible/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
ansible.controller                       4.4.2  
ansible.tower                            3.8.6  
awx.awx                                  24.6.1 
config_automation.ee_builder             1.0.8  
containers.podman                        1.10.1 
infra.controller_configuration           2.11.0 


Controller version
Ansible Automation Platform Controller 4.4.2

OS / ENVIRONMENT

AAP OS Version: RHEL 18.10

Desired Behavior

Role builds out file/folder structure with no failures

Actual Behavior

$ ansible-playbook -i localhost, filetree_create.yml -e '{controller_validate_certs: false, controller_hostname: ansible1mp.prci.com:443, controller_username: XXXXXX, controller_password: XXXXXXXXX}'

***Output hidden to fit in maximum character length of form***


TASK [infra.controller_configuration.filetree_create : Match objects with roles] **************************************************************************************************************************************
task path: /Users/a083138/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/team_roles.yml:19
ok: [localhost] => (item=['Read', 'job_template']) => {
    "ansible_facts": {
        "object_roles": "[{'Read': {'resource_names': ['Create Execution Environment', \"Migrate EE's to AAP Controller\"], 'resource_type': 'job_template'}}]\""
    },
    "ansible_loop_var": "item",
    "changed": false,
    "item": [
        "Read",
        "job_template"
    ]
}
fatal: [localhost]: FAILED! => {
    "msg": "Unexpected templating type error occurred on ({{ object_roles +\n  [{ item.0:\n    {\n      'resource_names': (team_roles_lookvar |\n                        selectattr('name','equalto', item.0) |\n                        selectattr('summary_fields.resource_type','equalto', item.1) |\n                        map(attribute='summary_fields.resource_name')),\n      'resource_type': item.1,\n    }\n  }]\n}}\"): can only concatenate str (not \"list\") to str. can only concatenate str (not \"list\") to str"
}



PLAY RECAP ************************************************************************************************************************************************************************************************************
localhost                  : ok=63   changed=2    unreachable=0    failed=1    skipped=12   rescued=0    ignored=0  



Please give some details of what is actually happening.
Include a [minimum complete verifiable example] with:

  • playbook / task
---
- hosts: localhost
  connection: local
  gather_facts: true

  vars:
    controller_hostname: "ansible1mp.prci.com"
    controller_validate_certs: false
    output_path: /tmp/filetree_output
    input_tag: ['teams']

  pre_tasks:
    - name: "Setup authentication (block)"
      block:
        - name: "Get the Authentication Token for the future requests"
          ansible.builtin.uri:
            url: "https://{{ controller_hostname }}/api/v2/tokens/"
            user: "{{ controller_username }}"
            password: "{{ controller_password }}"
            method: POST
            force_basic_auth: true
            validate_certs: "{{ controller_validate_certs }}"
            status_code: 201
          register: authtoken_res

        - name: "Set the oauth token to be used since now"
          ansible.builtin.set_fact:
            controller_oauthtoken: "{{ authtoken_res.json.token }}"
            controller_oauthtoken_url: "{{ authtoken_res.json.url }}"
      no_log: "{{ controller_configuration_filetree_create_secure_logging | default('false') }}"
      when: controller_oauthtoken is not defined
      tags:
        - always

  roles:
    - infra.controller_configuration.filetree_create

  post_tasks:
    - name: "Delete the Authentication Token used"
      ansible.builtin.uri:
        url: "https://{{ controller_hostname }}{{ controller_oauthtoken_url }}"
        user: "{{ controller_username }}"
        password: "{{ controller_password }}"
        method: DELETE
        force_basic_auth: true
        validate_certs: "{{ controller_validate_certs }}"
        status_code: 204
      when: controller_oauthtoken_url is defined
...

  • configuration file / list
    N/a
  • error:
    TASK [infra.controller_configuration.filetree_create : Match objects with roles] **************************************************************************************************************************************
    task path: /Users/a083138/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create/tasks/team_roles.yml:19
    ok: [localhost] => (item=['Read', 'job_template']) => {
    "ansible_facts": {
    "object_roles": "[{'Read': {'resource_names': ['Create Execution Environment', "Migrate EE's to AAP Controller"], 'resource_type': 'job_template'}}]""
    },
    "ansible_loop_var": "item",
    "changed": false,
    "item": [
    "Read",
    "job_template"
    ]
    }
    fatal: [localhost]: FAILED! => {
    "msg": "Unexpected templating type error occurred on ({{ object_roles +\n [{ item.0:\n {\n 'resource_names': (team_roles_lookvar |\n selectattr('name','equalto', item.0) |\n selectattr('summary_fields.resource_type','equalto', item.1) |\n map(attribute='summary_fields.resource_name')),\n 'resource_type': item.1,\n }\n }]\n}}"): can only concatenate str (not "list") to str. can only concatenate str (not "list") to str"
    }

STEPS TO REPRODUCE

Run playbook to call role with 'teams' and/or 'roles' set as input_tag against AAP instance.

@a083138 a083138 added the bug Something isn't working label Nov 20, 2024
@djdanielsson
Copy link
Contributor

@a083138 please pay attention to what repo you are posting in, I already moved your last issue to the correct repo.

@djdanielsson djdanielsson transferred this issue from redhat-cop/infra.aap_configuration Nov 20, 2024
@przemkalit
Copy link
Contributor

Hi, I believe it is already fixed here: #19

@ivarmu
Copy link
Contributor

ivarmu commented Nov 29, 2024

@a083138 Could you please confirm if the issue is fixed in the latest version?

@cassanellicarlo
Copy link

I had the same issue using the role in the https://github.com/redhat-cop/infra.controller_configuration collection.
Tried also with the code in #19 but didn't solve it.

BTW, is this aap_configuration_extended in Ansible Galaxy? I haven't found it.

@ivarmu
Copy link
Contributor

ivarmu commented Dec 11, 2024

I had the same issue using the role in the https://github.com/redhat-cop/infra.controller_configuration collection. Tried also with the code in #19 but didn't solve it.

BTW, is this aap_configuration_extended in Ansible Galaxy? I haven't found it.

We still haven't created the first release of this collection. Pinging @djdanielsson @sean-m-sullivan @Tompage1994.

@djdanielsson
Copy link
Contributor

djdanielsson commented Dec 11, 2024

I have seen a lot of PR's and issues still so I was not sure it was in a state thought to be good enough for 1.0.0. like #44 seems like that needs to be solved before a release

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2025
@djdanielsson djdanielsson reopened this Jan 18, 2025
@github-actions github-actions bot removed the inactive label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants