Early stages of trying to migrate some of this to ansible
This commit is contained in:
parent
5c43c8ed03
commit
c219475d70
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Script to generate ansible host file from undercloud nova-list
|
||||
#
|
||||
#
|
||||
. ~/stackrc
|
||||
file="./hosts"
|
||||
compute=()
|
||||
controllers=()
|
||||
ceph=()
|
||||
while read line; do
|
||||
host=$(echo $line| awk '{print $4}')
|
||||
IP=$(echo $line | awk '{print $12}' | cut -d "=" -f2)
|
||||
if [[ ${host} =~ compute ]]; then
|
||||
compute+="$IP "
|
||||
fi
|
||||
if [[ ${host} =~ ceph ]] ; then
|
||||
ceph+="$IP "
|
||||
fi
|
||||
if [[ ${host} =~ control ]]; then
|
||||
controllers+="$IP "
|
||||
fi
|
||||
done < <(nova list | grep over)
|
||||
|
||||
if [[ ${#compute} -gt 0 ]]; then
|
||||
echo "[computes]">> $file
|
||||
for c in ${compute[@]}; do
|
||||
echo $c >> $file
|
||||
done
|
||||
fi
|
||||
if [[ ${#controllers} -gt 0 ]]; then
|
||||
echo "">> $file
|
||||
echo "[controllers]" >> $file
|
||||
for ct in ${controllers[@]}; do
|
||||
echo $ct >> $file
|
||||
done
|
||||
fi
|
||||
if [[ ${#ceph} -gt 0 ]]; then
|
||||
echo "" >> $file
|
||||
echo "[ceph]" >> $file
|
||||
for ceph in ${ceph[@]}; do
|
||||
echo $ceph >> $file
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,17 @@
|
|||
[computes]
|
||||
192.0.2.6
|
||||
192.0.2.20
|
||||
192.0.2.8
|
||||
192.0.2.22
|
||||
192.0.2.7
|
||||
192.0.2.9
|
||||
192.0.2.24
|
||||
192.0.2.19
|
||||
|
||||
[controllers]
|
||||
192.0.2.23
|
||||
192.0.2.21
|
||||
192.0.2.5
|
||||
|
||||
[controllers:vars]
|
||||
ansible_sudo=yes
|
|
@ -0,0 +1,24 @@
|
|||
- name: test to see if selinux is running
|
||||
command: getenforce
|
||||
register: sestatus
|
||||
changed_when: false
|
||||
|
||||
- name: check selinux config file
|
||||
lineinfile: dest=/etc/selinux/config regexp=^SELINUX= line=SELINUX=enforcing
|
||||
|
||||
- name: Check tuned profile on controllers
|
||||
command: tuned-adm active
|
||||
register: tuned_result
|
||||
|
||||
- name: Check max_connections
|
||||
shell: mysql -e "show status where \`variable_name\` = 'Max_used_connections';" | grep Max_used_connections | awk '{print $2}'
|
||||
register: max_connections_result
|
||||
|
||||
- name : Check rabbitmq file descriptors
|
||||
shell: rabbitmqctl status | grep file_descriptors -A 3
|
||||
register: rabbitmq_fd_result
|
||||
|
||||
- debug: msg="{{ tuned_result.stdout}}"
|
||||
- debug: msg="{{ rabbitmq_fd_result.stdout}}"
|
||||
- debug: msg="{{ max_connections_result.stdout}}"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
- hosts : controllers
|
||||
remote_user: heat-admin
|
||||
roles:
|
||||
- common
|
Loading…
Reference in New Issue