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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to