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

Allow Alloy to Create Config File directly from File #285

Closed
wants to merge 2 commits into from

Conversation

aybrl-edu
Copy link

@aybrl-edu aybrl-edu commented Oct 24, 2024

#284

I want to enhance the configuration setup for Alloy to either accept a direct file from downstream or, if no file is provided, fall back to the existing template mechanism that uses a variable.

Current Behavior

Currently, the config.alloy.j2 template is used to generate the /etc/alloy/config.alloy file, with the file content entirely dependent on the variable {{ alloy_config }} that holds the content from downstream

Requested Behavior

Add the ability to provide a file directly from downstream {{ alloy_config_file }}

If alloy_config_file is provided, copy this file directly to /etc/alloy/config.alloy.
If alloy_config_file is not provided, continue using the existing template mechanism with the variable to populate /etc/alloy/config.alloy.

@CLAassistant
Copy link

CLAassistant commented Oct 24, 2024

CLA assistant check
All committers have signed the CLA.

@aybrl-edu aybrl-edu force-pushed the 284-alloy-config-file branch 2 times, most recently from fc85078 to e0329ef Compare October 24, 2024 13:35
@gardar
Copy link
Collaborator

gardar commented Oct 24, 2024

I don't think it's a good idea to add this to the role.

If you really want this then you can do it already with a lookup, or you can skip the configuration in the role and do this task in your playbook.

alloy_config: "{{ lookup('ansible.builtin.template', '/path/to/your/custom/template.j2') }}"
alloy_config: "{{ lookup('ansible.builtin.file', '/path/to/your/custom/config.file') }}"

@aybrl-edu aybrl-edu closed this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants