Add option block to ensure apache2 is enabled correctly

The apache2 monitoring process requires a couple interactions to deploy
successfully. This change will ensure that if the apache2 monitoring
fails, in any way, it does not block the deployment.

Change-Id: Ibe35197a1c65f4abe9e4870c07ee15f37f9a58ab
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-08-29 15:39:08 -05:00
parent 111fda8d87
commit 1c56b7f034
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
4 changed files with 41 additions and 27 deletions

View File

@ -258,8 +258,7 @@ filebeat.modules:
# If true, all fields created by this module are prefixed with # If true, all fields created by this module are prefixed with
# `osquery.result`. Set to false to copy the fields in the root # `osquery.result`. Set to false to copy the fields in the root
# of the document. The default is true. # of the document. The default is true.
# NOTE(cloudull): This option is commented out because it is broken var.use_namespace: true
#var.use_namespace: true
#----------------------------- PostgreSQL Module ----------------------------- #----------------------------- PostgreSQL Module -----------------------------
#- module: postgresql #- module: postgresql

View File

@ -17,7 +17,7 @@ temp_dir: /var/lib/logstash/tmp
logstash_pipelines: "{{lookup('template', 'logstash-pipelines.yml.j2') }}" logstash_pipelines: "{{lookup('template', 'logstash-pipelines.yml.j2') }}"
# Set processor cores fact # Set processor cores fact
q_storage: "{{ (ansible_processor_count | int) * (ansible_processor_threads_per_core | int) * 2 }}" q_storage: 1
# Set logstash facts # Set logstash facts
logstash_queue_size: "{{ ((((q_storage | int) >= 2) | ternary(q_storage, 2) | int) * 1024) // ((logstash_pipelines | from_yaml) | length) }}" logstash_queue_size: "{{ ((((q_storage | int) >= 2) | ternary(q_storage, 2) | int) * 1024) // ((logstash_pipelines | from_yaml) | length) }}"

View File

@ -157,33 +157,45 @@
uwsgi_sockets: "{{ uwsgi_find_sockets }}" uwsgi_sockets: "{{ uwsgi_find_sockets }}"
# Apache 2 stats enablement # Apache 2 stats enablement
- name: Enable apache2
block:
- name: Drop apache2 stats site config - name: Drop apache2 stats site config
template: template:
src: apache-status.conf.j2 src: apache-status.conf.j2
dest: /etc/apache2/sites-available/apache-status.conf dest: /etc/apache2/sites-available/apache-status.conf
when: apache_enabled
- name: Enable apache2 stats site - name: Enable apache2 stats site
file: file:
src: /etc/apache2/sites-available/apache-status.conf src: /etc/apache2/sites-available/apache-status.conf
dest: /etc/apache2/sites-enabled/apache-status.conf dest: /etc/apache2/sites-enabled/apache-status.conf
state: link state: link
when: apache_enabled
- name: Ensure apache2 stats mode is enabled - name: Ensure apache2 stats mode is enabled
apache2_module: apache2_module:
name: status name: status
state: present state: present
register: apache_status_mod register: apache_status_mod
when: apache_enabled
- name: Reload apache2 - name: Reload apache2
service: service:
name: apache2 name: apache2
state: reloaded state: reloaded
when: when:
- apache_enabled
- apache_status_mod is changed - apache_status_mod is changed
rescue:
- name: Apache2 monitoring not enabled
debug:
msg: >-
The apache2 module was not enabled because of an error within the
enablement process. Check the host to ensure apache2 is really
available and resolve the noted errors before continuing.
- name: Disable apache2 check
set_fact:
apache_enabled: false
when:
- apache_enabled | bool
# NGINX stats enablement # NGINX stats enablement
- name: Drop nginx stats site config - name: Drop nginx stats site config

View File

@ -5,6 +5,9 @@ q_mem: "{{ (ansible_memtotal_mb | int) // 3 }}"
# Option to define half memory # Option to define half memory
h_mem: "{{ (ansible_memtotal_mb | int) // 2 }}" h_mem: "{{ (ansible_memtotal_mb | int) // 2 }}"
# Option to set persistent queue storage in gigabytes
q_storage: "{{ (ansible_processor_count | int) * (ansible_processor_threads_per_core | int) * 2 }}"
apm_port: 8200 apm_port: 8200
elastic_port: 9200 elastic_port: 9200
elastic_hap_port: 9201 elastic_hap_port: 9201