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

Enhancement: allow to define common configurations from env vars #138

Open
saiello opened this issue Jul 26, 2022 · 1 comment
Open

Enhancement: allow to define common configurations from env vars #138

saiello opened this issue Jul 26, 2022 · 1 comment

Comments

@saiello
Copy link
Contributor

saiello commented Jul 26, 2022

Expected Behavior

Allow to define a default value from env var with the common configurations

Actual Behavior

Bootstap server configuration must be defined for each module separately even when is always the same.

Play to Reproduce the Problem

export KAFKA_ADMIN_BOOTSTRAP_SERVER="localhost:9094"
tasks:
- kafka_topic:
     name: my-topic
     partitions: 1
     replica_factor: 1
     state: present

- kafka_user:
     name: alice
     password: '{{ vaulted_secrets['alice'] }}
     state: present

- kafka_acl:
     acl_resource_type: 'topic'
     name: '*'
     acl_principal: 'User:alice'
     acl_operation: 'write'
     acl_permission: 'allow'
     acl_pattern_type: 'literal'
     state: present
  • A variable for each common configuration can be available ( i.e. KAFKA_ADMIN_ )
  • A value specified as module param take precedence over the env var.
@IanWhitney
Copy link

I think you can do this with built-in Ansible functionality.

We do things like set our SSL Password as an env var and then our playbooks look like this

ssl_password: "{{ lookup('ansible.builtin.env', 'SSL_PASSWORD') }}"

Right now we just have one playbook, but if we move to multiple playbooks then I'd probably extract that out to a vars file in Ansible and import that file in to all of my playbooks.

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

No branches or pull requests

2 participants