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

Support custom inventory filename through AnsibleRun CRD #245

Open
ggillies opened this issue Aug 21, 2023 · 0 comments
Open

Support custom inventory filename through AnsibleRun CRD #245

ggillies opened this issue Aug 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ggillies
Copy link

What problem are you facing?

I am attempting to use the ansible provider in crossplane as an execution engine for an existing ansible setup. This setup makes use of the gcp_compute ansible plugin https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_inventory.html

However, no matter what configuration I try (inline, executable, or sourced from secret), I cannot get ansible in the provider to accept the inventory as a gcp plugin and run it correctly. It always gives the error

[WARNING]:  * Failed to parse
/ansibleDir/733c9dbc-1b0b-4b44-ae41-e935f962b9a9/hosts with yaml plugin: Plugin
configuration YAML file, not YAML inventory

Turns out this is because ansible inventory plugins enforce a fixed structure on inventory filenames, and each plugin defines what the inventory files must be named (on disk) for the plugin to accept them.

For example the docs in gcp state

    Uses a YAML configuration file that ends with gcp_compute.(yml|yaml) or gcp.(yml|yaml).

How could Crossplane help solve your problem?

Expand the AnsibleRun CRD to support inventoryFilename either on inlineInventory or all inventory sources. Instead of hardcoding hosts at https://github.com/crossplane-contrib/provider-ansible/blob/main/pkg/runnerutil/runnerutil.go#L30

If we can specify the filename the provider loads the inlineInventory into, we should be able to leverage any and all inventory plugins

@ggillies ggillies added the enhancement New feature or request label Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant