[ansible-project] Complex set of default variables with custom plugin?

2016-12-20 Thread Kamil Demecki
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: 3 }


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: 3 }

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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
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.


[ansible-project] Remove stderr/stdout from json output on failure as plugin handles already pretty printing

2016-07-11 Thread Kamil Demecki
Hi All,

I'm using plugin described here 

 
to display pretty printed output. It is working very well on successful 
execution. 
However on failure ansible also displays json with keys "stdout", "stderr" 
duplicating my output. 
Json is quite big and unreadable as I log hundreds lines in some places.

Is there a way to "mask" keys from json output presented when ansible 
fails? I would like to have a dict with something like replaced 
stderr="Already printed". 
I've tried to modify dictionary in callback plugin but it doesn't take 
effect. Is any good example on github 
?

I'm using Ansible 2.0.0.1.

Thanks

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b678185e-f66c-4155-b90e-157b577f860d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.