Yep, I think that is a good pattern as well. With your permission, when I have enough time I will add that example to the repo, or you can do it by yourself if you want :-)
2015-06-13 7:46 GMT+02:00 Barry Kaplan <[email protected]>: > On the topic patterns, something I have been experiment with is to not try > to define attributes for config files that are then substituted via a > template by the role. Rather I have been using native configuration. > > It seems to me that there is little value trying to turn every type of > config into native yaml only to have to regenerate the native format. By > using the native format directly the configuration is much clearer with > less cognitive load due the the translation. > > Here's an example using my logstash role: > > roles: > - role: logstash > logstash_configs: > 00_mesos: | > input { > file { > path => ["/var/log/mesos/mesos-slave.INFO"] > exclude => ["*.log.*", "*.gz"] > tags => ["infra", "mesos", "mesos-slave"] > add_field => { "level" => "INFO" } > } > file { > path => ["/var/log/mesos/mesos-slave.WARN"] > exclude => ["*.log.*", "*.gz"] > tags => ["infra", "mesos", "mesos-slave"] > add_field => { "level" => "WARN" } > } > file { > path => ["/var/log/mesos/mesos-slave.ERROR"] > exclude => ["*.log.*", "*.gz"] > tags => ["infra", "mesos", "mesos-slave"] > add_field => { "level" => "ERROR" } > } > } > > > 00_consul: | > input { > file { > type => "consul" > path => ["/var/log/consul.log"] > exclude => ["*.log.*", "*.gz"] > tags => ["consul"] > } > } > > > 00_vimana: | > input { > file { > type => "vimana" > path => ["{{vi_log_dir}}/*.log"] > exclude => ["*.log.*", "*.gz"] > tags => ["vimana"] > codec => json > } > } > > > 50_env_filter: | > filter { > add_field => { "env", "{{env}}" } > } > > > 99_rabbitmq_output: | > output { > rabbitmq { > host => "rabbitmq.service.ops.consul" > port => {{rabbitmq_port}} > user => "{{elk_rabbitmq_logstash_user}}" > password => "{{elk_rabbitmq_logstash_password}}" > vhost => "logstash" > exchange => "logs_json" > exchange_type => "direct" > durable => true > } > } > > > 99_debug_output: | > output { > stdout { > codec => rubydebug > } > } > > > -- > 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/e62754db-0316-46c9-b983-c5cf85719493%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/e62754db-0316-46c9-b983-c5cf85719493%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- José Riguera López <[email protected]> -- 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/CALL8wccqGXkg5YQPWc7pi8mLj-Vy45GeZmAJW6741mvg2m%2BmrA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
