# How to call infra.controller\_configuration.filetree\_create with organization filter

**URL:** <https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686>\
**Category:** Get Help\
**Tags:** infra-config-as-code, playbook, collections\
**Created:** [August 6, 2024, 8:32pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686 "2024-08-06T20:32:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![derb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/derb/32/4385_2.png) [@derb](https://forum.ansible.com/u/derb)\
**Post date:** [August 6, 2024, 8:32pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/1 "2024-08-06T20:32:06Z")

</div>

**Passing organization filter**.  
Hi everyone, I ma trying to call the file\_tree\_create role in the infra.controller\_configuration collection. My playbook is the same as the example on the info page with the exception of the vars passed below.

If I do not include the organization\_filter, the playbook executes successfully. However, running with the organization\_filter I get an error that it is not a supported parameter.

```auto
# in playbook...
  roles:
    - role: infra.controller_configuration.filetree_create
      input_tag:
        - 'job_templates'
        - 'workflow_job_templates'
        - 'schedules'
      output_path: /tmp/filetree_output
      organization_filter: "Infrastructure Operations"

output:
TASK [infra.controller_configuration.filetree_create : Validating arguments against arg spec 'main' - An Ansible Role to create a local file tree of objects existing in Controller] ***
fatal: [localhost]: FAILED! => {"argument_errors": ["organization_filter. Supported parameters include:...

```

Is this a bug, or is there a different manner in which I should call this role with the organization\_filter parameter?

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [August 7, 2024, 1:57am UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/2 "2024-08-07T01:57:10Z")

</div>

It’s a pity you chose to show us your [mis]interpretation of the error but not the relevant part of the error itself.

Still — a shot in the dark — if you want to include `organization_filter:`, then you probably need to include `'organizations'` in your `input_tag:` list (or omit `input_tag:` altogether and let it default to `'all'`).

---

<div class="post-metadata">

**Author:** ![derb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/derb/32/4385_2.png) [@derb](https://forum.ansible.com/u/derb)\
**Post date:** [August 7, 2024, 1:45pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/3 "2024-08-07T13:45:35Z")

</div>

@utoddl, thanks for your [somewhat snarky] response. I apologize for not including the full error. I added organizations to the input\_tag as you suggested but still receive the same error. Here is the full error:

```auto
TASK [infra.controller_configuration.filetree_create : Validating arguments against arg spec 'main' - An Ansible Role to create a local file tree of objects existing in Controller] ******************
fatal: [localhost]: FAILED! => {"argument_errors": ["organization_filter. Supported parameters include: controller_configuration_async_delay, controller_configuration_async_retries, controller_configuration_filetree_create_secure_logging, controller_configuration_secure_logging, controller_hostname, controller_oauthtoken, controller_password, controller_state, controller_username, controller_validate_certs, input_tag, output_path, query_controller_api_max_objects."], "argument_spec_data": {"controller_configuration_async_delay": {"default": 1, "description": "This variable sets delay between retries across all roles as a default.", "required": false}, "controller_configuration_async_retries": {"default": 30, "description": "This variable sets number of retries across all roles as a default.", "required": false}, "controller_configuration_filetree_create_secure_logging": {"default": false, "description": "Whether or not to include the sensitive tasks from this role in the log. Set this value to `true` if you will be providing your sensitive values from elsewhere.", "required": false, "type": "bool"}, "controller_configuration_secure_logging": {"default": false, "description": "This variable enables secure logging across all roles as a default.", "required": false, "type": "bool"}, "controller_hostname": {"default": "None", "description": "URL to the Ansible Controller Server.", "required": false, "type": "str"}, "controller_oauthtoken": {"default": "None", "description": "Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.", "required": false, "type": "str"}, "controller_password": {"default": "None", "description": "Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.", "required": false, "type": "str"}, "controller_state": {"default": "present", "description": "The state all objects will take unless overridden by object default", "required": false, "type": "str"}, "controller_username": {"default": "None", "description": "Admin User on the Ansible Controller Server. Either username / password or oauthtoken need to be specified.", "required": false, "type": "str"}, "controller_validate_certs": {"default": true, "description": "Whether or not to validate the Ansible Controller Server's SSL certificate.", "required": false, "type": "str"}, "input_tag": {"default": ["all"], "description": "The tags which are applied to the 'sub-roles'. If 'all' is in the list (the default value) then all roles will be called.", "elements": "str", "required": false, "type": "list"}, "output_path": {"default": "/tmp/filetree_output", "description": "The path to the output directory where all the generated `yaml` files with the corresponding Objects as code will be written to.", "required": false, "type": "str"}, "query_controller_api_max_objects": {"default": 10000, "description": "Maximum number of objects to return from the list. If a list view returns more an max_objects an exception will be raised", "required": false, "type": "int"}}, "changed": false, "msg": "Validation of arguments failed:\norganization_filter. Supported parameters include: controller_configuration_async_delay, controller_configuration_async_retries, controller_configuration_filetree_create_secure_logging, controller_configuration_secure_logging, controller_hostname, controller_oauthtoken, controller_password, controller_state, controller_username, controller_validate_certs, input_tag, output_path, query_controller_api_max_objects.", "validate_args_context": {"argument_spec_name": "main", "name": "filetree_create", "path": "/home/dave/.ansible/collections/ansible_collections/infra/controller_configuration/roles/filetree_create", "type": "role"}}

```

**The relevant part is this** :  
“Validation of arguments failed:\norganization\_filter. Supported parameters include: controller\_configuration\_async\_delay controller\_configuration\_async\_retries, controller\_configuration\_filetree\_create\_secure\_logging, controller\_configuration\_secure\_logging, controller\_hostname, controller\_oauthtoken, controller\_password, controller\_state, controller\_username, controller\_validate\_certs, input\_tag, output\_path, query\_controller\_api\_max\_objects.”

organization\_filter is not on the list of valid arguments, yet it is clearly listed as a Role Variable in the [documentation](https://galaxy.ansible.com/ui/repo/published/infra/controller_configuration/content/role/filetree_create/).

Comparing the list of Role Variables to the valid arguments, I noticed that flatten\_output is also not supported and remembered there was an example of flatten\_output where it is passed in the -e command line parameter in the documentation. I was able to run the following successfully:

```auto
ansible-playbook export.yml -e '{organization_filter: "Infrastructure Operations"}'

```

Forgive my ignorance as I am fairly new to using these modules, but is this common practice for vars to be passed outside of the call to the role (in -e) and not allowed within the call (in the playbook roles: as vars) or is this a bug?

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [August 7, 2024, 1:58pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/4 "2024-08-07T13:58:19Z")

</div>

The issue is you’re trying to use a variable as an argument. Most roles expect you to pass vars to the role to set parameters, but some also accept arguments in their argument spec.

```auto
roles:
  - role: role_with_vars
    vars:
      organization_filter: my_org
  - role: role_with_args
    organization_filter: my_org

```

Any argument defined in [controller\_configuration/roles/filetree\_create/meta/argument\_specs.yml](https://github.com/redhat-cop/controller_configuration/blob/devel/roles/filetree_create/meta/argument_specs.yml) can be set at the argument level, but anything else must be a variable.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [August 7, 2024, 2:02pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/5 "2024-08-07T14:02:55Z")

</div>

Sorry about the snark, @derb . I need to work on my “talking in public to friends I don’t know yet” filter. […] And as I’m typing I see @Denney-tech jumped in with _actual_ information. Cheers!

---

<div class="post-metadata">

**Author:** ![derb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/derb/32/4385_2.png) [@derb](https://forum.ansible.com/u/derb)\
**Post date:** [August 7, 2024, 4:24pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/6 "2024-08-07T16:24:34Z")

</div>

@utoddl & @Denney-tech,

Thank you both! This helps my understanding immensely!

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [August 7, 2024, 4:30pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/7 "2024-08-07T16:30:40Z")

</div>

@derb You’re welcome!

@utoddl I’m sorry if I stole your thunder. 🙂

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [August 7, 2024, 6:00pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/8 "2024-08-07T18:00:14Z")

</div>

Not at all! I was sliding down rabbit hole.

I was just going to say, I usually glaze over and hear “parameter”, “variable”, and “argument” as generic speak for “names for values”, but this is a case where the distinctions really matter. This was flying right over my head and I wasn’t going to see it. So thanks for stepping in.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 6, 2024, 6:00pm UTC](https://forum.ansible.com/t/how-to-call-infra-controller-configuration-filetree-create-with-organization-filter/7686/9 "2024-09-06T18:00:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
