Hi,

I'm looking for a solution to limit size of required setup for set of 
environments.

Below it is small chunk of bigger setup where I'm defining variables having 
default values.


app_datasources:
  - Target: BackendDS
    Host: "{{ backed_db.host }}"
    Port: "{{ backend_db.port }}"
    Connection: "{{ backend_ds_connection }}"
  - Target: WebDS
    Host: "{{ web_db.host }}"
    Port: "{{ web_db.port }}"
    Connection: "{{ web_ds_connection }}"

backend_ds_connection: "{{ default_ds_connection }}"

web_ds_connection: "{{ default_ds_connection }}"

default_ds_connection:
  - { Name: TxQueryTimeout, Value: "true" }
  - { Name: BlockingTimeout, Value: 30000 }


I define variable backed_db and web_db variable for each inventory and I 
can re-define backend_ds_connection / web_ds_connection placeholders if I 
need. 

Unfortunately this pattern doesn't scale well. I need to create hundreds of 
"placeholders" where there is possibility to change that bit for 
environment.

I'm looking at vars_plugins or action plugins to generate default values if 
they are not defined per hosts.

For example if host define variable backend_ds.Connection.TxQueryTimeout = 
100 then I would override what is defined with default_ds_connection, 
otherwise it would use default values.

app_datasources:
  - "{{ backend_ds }}"
  - "{{ web_ds }}"

backend_ds:
    Target: BackendDS
    Host: "{{ backed_db.host }}"
    Port: "{{ backend_db.port }}"
    Connection: "{{ backend_ds_connection }}"

web_ds:
    Target: WebDS
    Host: "{{ web_db.host }}"
    Port: "{{ web_db.port }}"
    Connection: "{{ default_ds_connection }}"

default_ds_connection:
  - { Name: TxQueryTimeout, Value: "true" }
  - { Name: BlockingTimeout, Value: 30000 }

What do you think is the best way to achieve that? Are vars_plugins or 
action plugins right way to go?

Regards

Kamil Demecki

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/34103e4b-4642-4782-bbb3-06c026ddba7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to