Filetree_create does not include extra_data on workflow nodes

Back with another question :slight_smile:

Summary

Executing infra.controller_configuration.filetree_create does not produce extra_vars that are attached to nodes in a workflow. For example, I have a workflow node which has this var passed in extra_vars in the gui:


(in code)

inv_update_action: create-group

When using ansible.controller.export, these extra_vars are exported as extra_data and within the node (excerpt):

assets:
    workflow_job_templates:
    -   allow_simultaneous: false
        ask_inventory_on_launch: false
        ask_labels_on_launch: false
        ask_limit_on_launch: false
        ask_scm_branch_on_launch: false
        ...
        workflow_nodes:
          - all_parents_must_converge: false
            diff_mode: null
            execution_environment: null
            extra_data:
              inv_update_action: create-group
            forks: null
            identifier: d3a1d05c-00a7-46ef-b825-5634c2c8a9fb
            inventory: null
            job_slice_count: null
            ...

STEPS TO REPRODUCE

---
- name: Export content from AAP as CasC files
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    controller_username: "{{ vault_controller_username | default(lookup('env', 'CONTROLLER_USERNAME')) }}"
    controller_password: "{{ vault_controller_password | default(lookup('env', 'CONTROLLER_PASSWORD')) }}"
    controller_hostname: "{{ vault_controller_hostname | default(lookup('env', 'CONTROLLER_HOST')) }}"
    controller_validate_certs: "{{ vault_controller_validate_certs | default(lookup('env', 'CONTROLLER_VERIFY_SSL')) }}"

  pre_tasks:
    - name: "Setup authentication (block)"
      no_log: "{{ controller_configuration_filetree_create_secure_logging | default('false') }}"
      tags:
        - always
      block:
        - name: "Get the Authentication Token for the future requests"
          when: controller_oauthtoken is not defined
          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 }}"

  roles:
    - role: infra.controller_configuration.filetree_create
      vars:
        organization_filter: "<Org Name>"

  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
...

TIA

Thanks for bringing this up. I’ve created this issue to address the problem: Filetree_create does not include extra_data on workflow nodes · Issue #893 · redhat-cop/controller_configuration · GitHub

1 Like

Thank you @adonisgarciac