Disable consul services needs +ie staging.

This commit is contained in:
Samuel Clay 2021-06-15 11:12:03 -04:00
parent b9ed7dc7ed
commit cc7251610a
9 changed files with 16 additions and 16 deletions

View file

@ -1,2 +1,2 @@
---
disable_consul_services: yes
disable_consul_services_ie_staging: yes

View file

@ -13,14 +13,14 @@
template:
src: /srv/newsblur/docker/haproxy/haproxy.consul.cfg.j2
dest: /srv/newsblur/docker/haproxy/haproxy.consul.cfg
when: disable_consul_services is not defined
when: disable_consul_services_ie_staging is not defined
register: updated_config_consul
- name: Copy staging haproxy.cfg file
copy:
src: /srv/newsblur/docker/haproxy/haproxy.staging.cfg
dest: /srv/newsblur/docker/haproxy/haproxy.consul.cfg
when: disable_consul_services is defined
when: disable_consul_services_ie_staging is defined
register: updated_config_staging
- name: Merge facts

View file

@ -6,7 +6,7 @@
vars:
- update_apt_cache: yes
- motd_role: app
# - disable_consul_services: yes # Defined in group vars
# - disable_consul_services_ie_staging: yes # Defined in group vars
roles:
- {role: 'base', tags: 'base'}

View file

@ -18,7 +18,7 @@
dest: /etc/consul.d/haproxy.json
notify:
- reload consul
when: disable_consul_services is not defined
when: disable_consul_services_ie_staging is not defined
- name: Allow haproxy stats port
ufw: rule=allow port={{ item }}
@ -31,14 +31,14 @@
template:
src: /srv/newsblur/docker/haproxy/haproxy.consul.cfg.j2
dest: /srv/newsblur/docker/haproxy/haproxy.consul.cfg
when: disable_consul_services is not defined
when: disable_consul_services_ie_staging is not defined
register: updated_config_consul
- name: Copy staging haproxy.cfg file
copy:
src: /srv/newsblur/docker/haproxy/haproxy.staging.cfg
dest: /srv/newsblur/docker/haproxy/haproxy.consul.cfg
when: disable_consul_services is defined
when: disable_consul_services_ie_staging is defined
register: updated_config_staging
- name: Merge facts

View file

@ -35,12 +35,12 @@
- /srv/newsblur/docker/nginx/nginx.consul.conf:/etc/nginx/conf.d/default.conf
- /srv/newsblur/:/srv/newsblur
with_items:
- disable_consul_services: no
- disable_consul_services_ie_staging: no
port: 80
- disable_consul_services: yes
- disable_consul_services_ie_staging: yes
port: 81
when:
- disable_consul_services | default(false) | bool == item.disable_consul_services|bool
- disable_consul_services_ie_staging | default(false) | bool == item.disable_consul_services_ie_staging|bool
- name: Register nginx in consul
tags: consul
@ -50,4 +50,4 @@
dest: /etc/consul.d/nginx.json
notify:
- reload consul
when: disable_consul_services is not defined
when: disable_consul_services_ie_staging is not defined

View file

@ -93,7 +93,7 @@
port: 8088
notify:
- reload consul
when: item.target_host in inventory_hostname and disable_consul_services is not defined
when: item.target_host in inventory_hostname and disable_consul_services_ie_staging is not defined
- name: Link disk usage sanity checker
become: yes

View file

@ -2,7 +2,7 @@
- name: Template file for prometheus
vars:
monitor_server: "{{ 'staging.newsblur.com' if disable_consul_services is defined else 'beta.newsblur.com' }}"
monitor_server: "{{ 'staging.newsblur.com' if disable_consul_services_ie_staging is defined else 'beta.newsblur.com' }}"
template:
src: /srv/newsblur/docker/prometheus/prometheus.consul.yml.j2
dest: /srv/newsblur/docker/prometheus/prometheus.yml

View file

@ -77,7 +77,7 @@
template:
src: consul_service.json
dest: /etc/consul.d/newsblur_web.json
when: disable_consul_services is not defined
when: disable_consul_services_ie_staging is not defined
notify:
- reload consul

View file

@ -1,6 +1,6 @@
server {
{% if disable_consul_services is not defined %}
{% if disable_consul_services_ie_staging is not defined %}
listen 80;
{% else %}
listen 81;