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: template:
src: /srv/newsblur/docker/haproxy/haproxy.consul.cfg.j2 src: /srv/newsblur/docker/haproxy/haproxy.consul.cfg.j2
dest: /srv/newsblur/docker/haproxy/haproxy.consul.cfg 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 register: updated_config_consul
- name: Copy staging haproxy.cfg file - name: Copy staging haproxy.cfg file
copy: copy:
src: /srv/newsblur/docker/haproxy/haproxy.staging.cfg src: /srv/newsblur/docker/haproxy/haproxy.staging.cfg
dest: /srv/newsblur/docker/haproxy/haproxy.consul.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 register: updated_config_staging
- name: Merge facts - name: Merge facts

View file

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

View file

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

View file

@ -35,12 +35,12 @@
- /srv/newsblur/docker/nginx/nginx.consul.conf:/etc/nginx/conf.d/default.conf - /srv/newsblur/docker/nginx/nginx.consul.conf:/etc/nginx/conf.d/default.conf
- /srv/newsblur/:/srv/newsblur - /srv/newsblur/:/srv/newsblur
with_items: with_items:
- disable_consul_services: no - disable_consul_services_ie_staging: no
port: 80 port: 80
- disable_consul_services: yes - disable_consul_services_ie_staging: yes
port: 81 port: 81
when: 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 - name: Register nginx in consul
tags: consul tags: consul
@ -50,4 +50,4 @@
dest: /etc/consul.d/nginx.json dest: /etc/consul.d/nginx.json
notify: notify:
- reload consul - 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 port: 8088
notify: notify:
- reload consul - 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 - name: Link disk usage sanity checker
become: yes become: yes

View file

@ -2,7 +2,7 @@
- name: Template file for prometheus - name: Template file for prometheus
vars: 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: template:
src: /srv/newsblur/docker/prometheus/prometheus.consul.yml.j2 src: /srv/newsblur/docker/prometheus/prometheus.consul.yml.j2
dest: /srv/newsblur/docker/prometheus/prometheus.yml dest: /srv/newsblur/docker/prometheus/prometheus.yml

View file

@ -77,7 +77,7 @@
template: template:
src: consul_service.json src: consul_service.json
dest: /etc/consul.d/newsblur_web.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: notify:
- reload consul - reload consul

View file

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