Ansible clean up & connmon install commit

This commit is contained in:
Joe Talerico 2015-11-16 18:07:00 -05:00
parent 67b5688074
commit 053dae662d
10 changed files with 133 additions and 6 deletions

6
ansible/director.yml Normal file
View File

@ -0,0 +1,6 @@
#
#
#
- hosts : director
roles:
- director

View File

@ -21,8 +21,6 @@ while read line; do
fi
done < <(nova list | grep over)
truncate -s 0 ${file}
if [[ ${#compute} -gt 0 ]]; then
echo "[computes]">> $file
for c in ${compute[@]}; do

View File

@ -1,14 +1,22 @@
---
ansible_sudo: yes
#
# Number of Service workers for OpenStack
#
num_workers: 24
num_workers: "{{ lookup('env','NUM_WORKERS') }}"
#
# Tool for monitoring database connections
#
connmon: True
connmon: "{{ lookup('env','CONNMON') }}"
connmon: true
#connmon: "{{ lookup('env','CONNMON') }}"
connmon_host: 192.0.2.1
rabbitmq_fd: 16238
dns_server: 8.8.8.8
rabbitmq_fd: 2048
mariadb_max_connections: 4096

View File

@ -0,0 +1,2 @@
---
ansible_sudo: yes

View File

@ -1,8 +1,9 @@
#
#
#
- hosts : controllers
- hosts : controllers
remote_user: heat-admin
roles:
- common
- connmon
- nova

View File

@ -1,20 +1,26 @@
---
- name: test to see if selinux is running
command: getenforce
changed_when: no
register: sestatus
- name: Check tuned profile on controllers
command: tuned-adm active
register: tuned_result
changed_when: no
failed_when: tuned_result.rc == -1
- name: Check max_connections
shell: mysql -e "show variables like 'max_connections';" | grep max_connections | awk '{print $2}'
register: max_connections_result
changed_when: no
- fail: "The database does not have max_connections set properly"
failed_when: max_connections_result.stdout|int < mariadb_max_connections
- name : Check rabbitmq file descriptors
shell: rabbitmqctl status | grep file_descriptors | awk -F',' '{print $3}' | sed 's/.$//'
register: rabbitmq_fd_result
changed_when: no
- fail: "RabbitMQ does not have fd setup proerply"
failed_when: rabbitmq_fd_result.stdout|int < rabbitmq_fd

View File

@ -0,0 +1,48 @@
---
#
# Connmon install
#
#
- name : Check for pip
shell : /bin/pip --version
register: pip_installed
changed_when: no
- name : Add DNS record
shell : sed -i '1s/^/nameserver {{ dns_server }}\n/' /etc/resolv.conf
when : pip_installed.rc == 1
- name : Install pip
easy_install : name=pip
when : pip_installed.rc == 1
- name : Check for connmon
shell : /bin/connmon --help
register: pip_installed
changed_when: no
- name : install connmon
pip: name=connmon
when: pip_installed.rc == 1
#
# Connmon setup
#
- name : Check for connmon config
stat: path=/etc/connmon.cfg
register: connmon_config
changed_when: no
- name : Copy Connmon config
template: src=/home/stack/browbeat/connmon/controller_config dest=/etc/connmon.cfg mode=644
when: connmon_config.stat.exists == False
- name: Check connmon is configured
shell: grep -q "{{ connmon_host }}" /etc/connmon.cfg
ignore_errors: yes
register: connmon_conf
changed_when: no
- name : Config Connmon
shell : sed -i 's/localhost/{{ connmon_host }}/g' /etc/connmon.cfg
when: connmon_conf.rc == 1

View File

@ -0,0 +1,33 @@
---
# Connmon install
- name : Check for pip
shell : /bin/pip --version
register: pip_installed
changed_when: no
- name : Add DNS record
shell : sed -i '1s/^/nameserver {{ dns_server }}\n/' /etc/resolv.conf
when : pip_installed.rc == 1
- name : Install pip
easy_install : name=pip
when : pip_installed.rc == 1
- name : Check for connmon
shell : /bin/connmon --help
register: pip_installed
changed_when: no
- name : install connmon
pip: name=connmon
when: pip_installed.rc == 1
- name : check iptables
shell : iptables -nvL | grep -q "dpt:5800"
changed_when: no
register: connmon_port
changed_when: no
- name : open up iptables
shell : /usr/sbin/iptables -I INPUT 1 -p tcp --dport 5800 -j ACCEPT
when : connmon_port.rc == 1

View File

@ -1,4 +1,26 @@
---
- name: Check for connmon in nova.conf
shell : grep -q 'connection = mysql:' /etc/nova/nova.conf
when : connmon
register : nova_mysql
ignore_errors: true
changed_when: no
- name : Enable Connmon in nova.conf
shell : sed -i 's/mysql:/mysq+connmon:/g' /etc/nova/nova.conf
when: connmon and nova_mysql.rc == 0
- name: Check for connmon_service in nova.conf
shell : grep -q 'connmon_service' /etc/nova/nova.conf
when : connmon
ignore_errors: true
register : nova_connmon_service
changed_when: no
- name : Enable Connmon in nova.conf
shell : sed -i '/connection = mysql/s/$/?connmon_service=default/' /etc/nova/nova.conf
when: connmon and nova_connmon_service.rc == 1
- name: Ensure nova.conf is properly configured
ini_file:
dest: /etc/nova/nova.conf

3
ansible/site.yml Normal file
View File

@ -0,0 +1,3 @@
---
- include: director.yml
- include: overcloud.yml