Skip to content

filetree_create fails to export workflow job templates #89

Closed
@l3acon

Description

@l3acon

Summary

failed: [localhost] (item=/tmp/filetree_output/Default/controller_workflow_job_templates/58_Deploy Cloud Stack in AWS.yaml) =>
{
  "ansible_loop_var": "current_workflow_job_templates_asset_value",
  "changed": false,
  "current_workflow_job_templates_asset_value": {
    "allow_simultaneous": false,
    "ask_inventory_on_launch": false,
    "ask_labels_on_launch": false,
    "ask_limit_on_launch": false,
    "ask_scm_branch_on_launch": false,
    "ask_skip_tags_on_launch": false,
    "ask_tags_on_launch": false,
    "ask_variables_on_launch": false,
    "created": "2025-03-25T13:42:35.453481Z",
    "description": "A workflow to deploy a cloud stack",
    "extra_vars": "{\"vm_deployment\": \"cloud_stack\"}",
    "id": 58,
    "inventory": null,
    "job_tags": null,
    "last_job_failed": false,
    "last_job_run": null,
    "limit": null,
    "modified": "2025-03-25T13:42:35.453489Z",
    "name": "Deploy Cloud Stack in AWS",
    "next_job_run": null,
    "organization": 1,
    "related": {
      "access_list": "/api/controller/v2/workflow_job_templates/58/access_list/",
      "activity_stream": "/api/controller/v2/workflow_job_templates/58/activity_stream/",
      "copy": "/api/controller/v2/workflow_job_templates/58/copy/",
      "created_by": "/api/controller/v2/users/1/",
      "labels": "/api/controller/v2/workflow_job_templates/58/labels/",
      "launch": "/api/controller/v2/workflow_job_templates/58/launch/",
      "modified_by": "/api/controller/v2/users/1/",
      "notification_templates_approvals": "/api/controller/v2/workflow_job_templates/58/notification_templates_approvals/",
      "notification_templates_error": "/api/controller/v2/workflow_job_templates/58/notification_templates_error/",
      "notification_templates_started": "/api/controller/v2/workflow_job_templates/58/notification_templates_started/",
      "notification_templates_success": "/api/controller/v2/workflow_job_templates/58/notification_templates_success/",
      "object_roles": "/api/controller/v2/workflow_job_templates/58/object_roles/",
      "organization": "/api/controller/v2/organizations/1/",
      "schedules": "/api/controller/v2/workflow_job_templates/58/schedules/",
      "survey_spec": "/api/controller/v2/workflow_job_templates/58/survey_spec/",
      "webhook_key": "/api/controller/v2/workflow_job_templates/58/webhook_key/",
      "webhook_receiver": "",
      "workflow_jobs": "/api/controller/v2/workflow_job_templates/58/workflow_jobs/",
      "workflow_nodes": "/api/controller/v2/workflow_job_templates/58/workflow_nodes/"
    },
    "scm_branch": null,
    "skip_tags": null,
    "status": "never updated",
    "summary_fields": {
      "created_by": {
        "first_name": "",
        "id": 1,
        "last_name": "",
        "username": "admin"
      },
      "labels": {
        "count": 0,
        "results": []
      },
      "modified_by": {
        "first_name": "",
        "id": 1,
        "last_name": "",
        "username": "admin"
      },
      "object_roles": {
        "admin_role": {
          "description": "Can manage all aspects of the workflow job template",
          "id": 142,
          "name": "Admin"
        },
        "approval_role": {
          "description": "Can approve or deny a workflow approval node",
          "id": 145,
          "name": "Approve"
        },
        "execute_role": {
          "description": "May run the workflow job template",
          "id": 143,
          "name": "Execute"
        },
        "read_role": {
          "description": "May view settings for the workflow job template",
          "id": 144,
          "name": "Read"
        }
      },
      "organization": {
        "description": "The default organization for Ansible Automation Platform",
        "id": 1,
        "name": "Default"
      },
      "recent_jobs": [],
      "survey": {
        "description": "",
        "title": ""
      },
      "user_capabilities": {
        "copy": true,
        "delete": true,
        "edit": true,
        "schedule": true,
        "start": true
      }
    },
    "survey_enabled": true,
    "type": "workflow_job_template",
    "url": "/api/controller/v2/workflow_job_templates/58/",
    "webhook_credential": null,
    "webhook_service": ""
  },
  "msg": "AnsibleUndefinedVariable: list object has no element 0"
}

Issue Type

  • Bug Report

Ansible, Collection, Controller details

ansible --version
ansible [core 2.18.3]
  config file = /home/matt/projects/github/ansible/filetree/ansible.cfg
  configured module search path = ['/home/matt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/matt/.local/lib/python3.13/site-packages/ansible
  ansible collection location = /home/matt/projects/github/ansible/filetree/collections
  executable location = /usr/bin/ansible
  python version = 3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True


ansible-galaxy collection list

# /home/matt/projects/github/ansible/filetree/collections/ansible_collections
Collection                               Version    
---------------------------------------- -----------
ansible.controller                       4.6.10     
infra.aap_configuration                  3.1.0      
infra.aap_configuration_extended         1.0.0-devel


Controller version
  • ansible installation method: one of source, pip, OS package, EE

OS / ENVIRONMENT

fedora

Desired Behavior

Actual Behavior

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

  • playbook / task
  • configuration file / list
  • error

STEPS TO REPRODUCE

fairly basic playbook

---
- name: do filetree
  hosts: localhost
  vars:
    aap_validate_certs: false
    controller_validate_certs: false
    filetree_create_output_dir: /tmp/filetree_output

  tasks:
    - name: Use token auth
      block:
        - name: Generate token
          ansible.controller.token:
            scope: "write"
            state: present
            controller_username: admin
            controller_password: "{{ aap_password }}"
            controller_host: "{{ aap_hostname }}"
            validate_certs: false
    
        - name: set token
          ansible.builtin.set_fact:
            controller_oauthtoken: "{{ controller_token.token }}"
            aap_oauthtoken: "{{ controller_token.token }}"

        - name: Output token
          ansible.builtin.debug:
            msg: "controller_oauthtoken: {{ controller_oauthtoken}}"

        - name: include filetree create
          ansible.builtin.import_role:
            name: infra.extended.filetree_create
          tags:
            - all

      always:
        - name: Delete token we created
          ansible.controller.token:
            controller_username: admin
            controller_password: "{{ aap_password }}"
            controller_host: "{{ aap_hostname }}"
            existing_token: "{{ controller_token }}"
            validate_certs: false
            state: absent
          when: controller_token is defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions