From b86f458f945bef3355a32091c76c882e97c7d7c9 Mon Sep 17 00:00:00 2001 From: Emeka Apugo Date: Mon, 18 Apr 2016 17:26:24 -0400 Subject: [PATCH] added rhel logging and updated vagrant test for rhel support --- Vagrantfile | 13 +++++++-- templates/consul-template.cfg.j2 | 5 ++++ templates/consul-template.service.systemd.j2 | 2 +- testrhel.yml | 29 ++++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 testrhel.yml diff --git a/Vagrantfile b/Vagrantfile index 7d434ef..e2f30f3 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,8 +3,6 @@ Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/trusty64" - # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true @@ -14,6 +12,7 @@ Vagrant.configure(2) do |config| # end config.vm.define "test" do |test| + test.vm.box = "ubuntu/trusty64" test.vm.hostname = "test" test.vm.provision "ansible" do |ansible| ansible.playbook = "test.yml" @@ -21,4 +20,14 @@ Vagrant.configure(2) do |config| ansible.become = true end end + + config.vm.define "test02", autostart: false do |test02| + test02.vm.box = "centos/7" + test02.vm.hostname = "testrhel" + test02.vm.provision "ansible" do |ansible| + ansible.playbook = "testrhel.yml" + ansible.verbose = 'vv' + ansible.sudo = true + end + end end diff --git a/templates/consul-template.cfg.j2 b/templates/consul-template.cfg.j2 index 7a59ca5..7bdcca5 100644 --- a/templates/consul-template.cfg.j2 +++ b/templates/consul-template.cfg.j2 @@ -1,4 +1,9 @@ consul = "{{ consul_template_consul_server }}:{{ consul_template_consul_port }}" + +{% if consul_template_log_level %} +log_level = "{{consul_template_log_level}}" +{% endif %} + {% if consul_template_templates %} {% for template in consul_template_templates %} diff --git a/templates/consul-template.service.systemd.j2 b/templates/consul-template.service.systemd.j2 index 07015b2..d831aed 100644 --- a/templates/consul-template.service.systemd.j2 +++ b/templates/consul-template.service.systemd.j2 @@ -2,7 +2,7 @@ Description=consul-template [Service] -ExecStart={{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config/{{ consul_template_config_file }} +ExecStart=/bin/sh -c "{{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config/{{ consul_template_config_file }} >> {{ consul_template_log_file }} 2>&1" [Install] WantedBy=multi-user.target diff --git a/testrhel.yml b/testrhel.yml new file mode 100644 index 0000000..f645e02 --- /dev/null +++ b/testrhel.yml @@ -0,0 +1,29 @@ +--- + +- hosts: all + become: yes + pre_tasks: + - name: epel-repo + yum: + name: epel-release + state: present + roles: + - savagegus.consul + - ansible-consul-template + + + vars: + # Consul + consul_version: 0.6.0 + consul_is_server: true + consul_bootstrap_expect: 1 + consul_use_systemd: true + consul_install_nginx: false + + # Consul Template + consul_template_use_upstart: false + consul_template_use_systemd: true + consul_template_template_files: + - {src: ./test/fixture/template/consul.ctmpl} + consul_template_templates: + - {name: "consul.ctmpl", dest: "/tmp/service-consul", cmd: "touch /tmp/service-consul-updated"}