Commit f50c53dc authored by Flávio Ramalho's avatar Flávio Ramalho
Browse files

Several changes

- Updated ansible version to 2.1.0
- Added ansible header on configuration files
- Added configuration of NTP (chrony), monasca host as master for agents host
- Clone monasca-client instead of installing via pip on both agent/monasca
- Some changes to cover ansible-lint recommendations
parent 73c7a483
......@@ -5,6 +5,7 @@ monasca_persister_git_repo: "https://git.openstack.org/openstack/monasca-persist
monasca_notification_git_repo: "https://git.openstack.org/openstack/monasca-notification.git"
monasca_thresh_git_repo: "https://git.openstack.org/openstack/monasca-thresh.git"
monasca_ui_git_repo: "https://git.openstack.org/openstack/monasca-ui.git"
monasca_client_git_repo: "https://git.openstack.org/openstack/python-monascaclient.git"
monasca_agent_git_repo: "https://git.openstack.org/openstack/monasca-agent.git"
monasca_git_branch: "master"
......@@ -26,3 +27,9 @@ os_mon_project_name: "mini-mon"
## Database
mysql_root_pass: "secretdatabase"
## NTP
ntp_servers:
- ntp.lsd.ufcg.edu.br
agent_ntp_servers:
- "{{ monasca_ip_address }}"
......@@ -4,6 +4,7 @@ os_monasca
Install and configure OpenStack Monasca.
The following services are installed:
- Chrony
- MariaDB
- Zookeeper
- Kafka
......@@ -30,6 +31,7 @@ Role Variables
monasca_notification_git_repo: "https://git.openstack.org/openstack/monasca-notification.git"
monasca_thresh_git_repo: "https://git.openstack.org/openstack/monasca-thresh.git"
monasca_ui_git_repo: "https://git.openstack.org/openstack/monasca-ui.git"
monasca_client_git_repo: "https://git.openstack.org/openstack/python-monascaclient.git"
monasca_git_branch: "master"
## Grafana
......@@ -58,6 +60,10 @@ Role Variables
storm_version: "1.0.1"
storm_logback_dir: "log4j2"
## NTP
ntp_servers:
- ntp.lsd.ufcg.edu.br
## System info
monasca_system_user_name: monasca
monasca_system_group_name: monasca
......@@ -74,7 +80,6 @@ Role Variables
# Common pip packages
monasca_pip_packages:
- python-monascaclient
- python-keystoneclient
- keystoneauth1
- simport
......
......@@ -20,6 +20,7 @@ monasca_persister_git_repo: "https://git.openstack.org/openstack/monasca-persist
monasca_notification_git_repo: "https://git.openstack.org/openstack/monasca-notification.git"
monasca_thresh_git_repo: "https://git.openstack.org/openstack/monasca-thresh.git"
monasca_ui_git_repo: "https://git.openstack.org/openstack/monasca-ui.git"
monasca_client_git_repo: "https://git.openstack.org/openstack/python-monascaclient.git"
monasca_git_branch: "master"
## Grafana
......@@ -48,6 +49,10 @@ kafka_version: "2.9.2-{{ base_kafka_version }}"
storm_version: "1.0.1"
storm_logback_dir: "log4j2"
## NTP
ntp_servers:
- ntp.lsd.ufcg.edu.br
## System info
monasca_system_user_name: monasca
monasca_system_group_name: monasca
......@@ -64,7 +69,6 @@ monasca_required_pip_packages:
# Common pip packages
monasca_pip_packages:
- python-monascaclient
- python-keystoneclient
- keystoneauth1
- simport
---
galaxy_info:
author: flaviodsr
author: flaviodsr
description: Install and configure OpenStack Monasca
company: UFCG/LSD
# If the issue tracker for your role is not on github, uncomment the
......@@ -14,10 +14,10 @@ galaxy_info:
# - Apache
# - CC-BY
license: Apache
min_ansible_version: 1.6.2
min_ansible_version: 2.1.0
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
......@@ -169,4 +169,3 @@ dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
---
# Copyright 2016 LSD/UFCG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Drop chrony Config(s)
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "0644"
with_items:
- src: "chrony.conf.j2"
dest: "/etc/chrony/chrony.conf"
owner: "root"
group: "root"
register: chrony_config
tags:
- chrony-config
- monasca-install-chrony
- name: Restart chrony
service:
name: "chrony"
state: "restarted"
when: chrony_config.changed
tags:
- chrony-restart
- monasca-install-chrony
......@@ -50,7 +50,7 @@
- monasca-install-grafana
- name: Copy grafana install script
copy:
copy:
src: "install_grafana.sh"
dest: "/opt/grafana-build/install_grafana.sh"
mode: "0750"
......@@ -59,7 +59,7 @@
- monasca-grafana-script
- monasca-install-grafana
- name: Install grafana
- name: Install grafana
command: "./install_grafana.sh"
args:
chdir: "/opt/grafana-build"
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Download influxdb
- name: Download influxdb
get_url:
url: " http://s3.amazonaws.com/influxdb/influxdb_{{ influxdb_version }}_amd64.deb"
dest: "/root/influxdb_{{ influxdb_version }}_amd64.deb"
......
......@@ -19,6 +19,7 @@
virtualenv: "/opt/venvs/monasca-api"
with_items:
- "gunicorn"
- "influxdb==2.8.0"
- "PyMySQL"
tags:
- monasca-api-pip-packages
......@@ -28,6 +29,8 @@
command: "/opt/venvs/monasca-api/bin/python setup.py sdist"
args:
chdir: "/opt/cloned-repos/monasca-api"
register: api_result
changed_when: "api_result.rc == 0"
tags:
- monasca-api-tarball
- monasca-install-api
......@@ -35,6 +38,7 @@
- name: Get tarball file name
shell: "ls -td /opt/cloned-repos/monasca-api/dist/monasca-api-*.tar.gz | head -1"
register: tarball
changed_when: false
tags:
- monasca-api-install
- monasca-install-api
......
---
# Copyright 2016 LSD/UFCG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create monasca-client tarball
command: "/opt/venvs/monasca-client/bin/python setup.py sdist"
args:
chdir: "/opt/cloned-repos/monasca-client"
register: client_result
changed_when: "client_result.rc == 0"
tags:
- monasca-client-tarball
- monasca-install-client
- name: Get tarball file name
shell: "ls -td /opt/cloned-repos/monasca-client/dist/python-monascaclient*.tar.gz | head -1"
register: tarball
changed_when: false
tags:
- monasca-client-install
- monasca-install-client
- name: Install monasca-client
pip:
name: "file://{{ tarball.stdout }}"
virtualenv: "/opt/venvs/monasca-client"
tags:
- monasca-client-install
- monasca-install-client
......@@ -17,5 +17,7 @@
command: "mvn clean install -DskipTests"
args:
chdir: "/opt/cloned-repos/monasca-common"
register: common_result
changed_when: "common_result.rc == 0"
tags:
- monasca-install-common
......@@ -27,6 +27,8 @@
command: "/opt/venvs/monasca-notification/bin/python setup.py sdist"
args:
chdir: "/opt/cloned-repos/monasca-notification"
register: notification_result
changed_when: "notification_result.rc == 0"
tags:
- monasca-notification-tarball
- monasca-install-notification
......@@ -34,6 +36,7 @@
- name: Get tarball file name
shell: "ls -td /opt/cloned-repos/monasca-notification/dist/monasca-notification-*.tar.gz | head -1"
register: tarball
changed_when: false
tags:
- monasca-notification-install
- monasca-install-notification
......
......@@ -17,6 +17,8 @@
command: "/opt/venvs/monasca-persister/bin/python setup.py sdist"
args:
chdir: "/opt/cloned-repos/monasca-persister"
register: tarball_result
changed_when: "tarball_result.rc == 0"
tags:
- monasca-persister-tarball
- monasca-install-persister
......@@ -24,6 +26,7 @@
- name: Get tarball file name
shell: "ls -td /opt/cloned-repos/monasca-persister/dist/monasca-persister-*.tar.gz | head -1"
register: tarball
changed_when: false
tags:
- monasca-persister-install
- monasca-install-persister
......
......@@ -17,12 +17,25 @@
command: "mvn clean package -DskipTests"
args:
chdir: "/opt/cloned-repos/monasca-thresh/thresh"
register: thresh_result
changed_when: "thresh_result.rc == 0"
tags:
- monasca-thresh-install
- monasca-install-thresh
- name: Get monasca thrash jar file name
shell: "ls -td /opt/cloned-repos/monasca-thresh/thresh/target/monasca-thresh-*-shaded.jar | head -1"
register: thresh_jar
changed_when: false
tags:
- monasca-tresh-filename
- monasca-install-thresh
- name: Copy thresh jar
shell: "cp -f /opt/cloned-repos/monasca-thresh/thresh/target/monasca-thresh-*-shaded.jar \
/opt/monasca-thresh/monasca-thresh.jar"
copy:
src: "{{ thresh_jar.stdout }}"
dest: "/opt/monasca-thresh/monasca-thresh.jar"
remote_src: true
tags:
- monasca-thresh-cpjar
- monasca-install-thresh
......
......@@ -52,7 +52,7 @@
- name: Setup mysql schemas
mysql_db:
state: "import"
name: "{{ item.name }}"
name: "{{ item.name }}"
target: "/opt/sqls/{{ item.sql }}"
with_items:
- name: "mon"
......
......@@ -22,7 +22,7 @@
- monasca-storm-version
- monasca-install-storm
- name: Download storm
- name: Download storm
get_url:
url: "http://apache.mirrors.tds.net/storm/apache-storm-{{ storm_version }}/apache-storm-{{ storm_version }}.tar.gz"
dest: "/root/apache-storm-{{ storm_version }}.tar.gz"
......@@ -31,7 +31,7 @@
- monasca-storm-download
- monasca-install-storm
- name: Unarchive storm
- name: Unarchive storm
unarchive:
src: "/root/apache-storm-{{ storm_version }}.tar.gz"
dest: "/opt"
......
......@@ -24,6 +24,7 @@
- include: monasca_pre_install.yml
- include: configure_database.yml
- include: configure_ntp.yml
- include: configure_zookeeper.yml
- include: install_kafka.yml
- include: install_storm.yml
......@@ -34,4 +35,5 @@
- include: install_monasca_persister.yml
- include: install_monasca_notification.yml
- include: install_monasca_thresh.yml
- include: install_monasca_client.yml
- include: monasca_post_install.yml
......@@ -23,7 +23,7 @@
- monasca-nodejs
- name: Run nodejs script
shell: "/root/nodejs-setup_4.x"
command: "/root/nodejs-setup_4.x"
when: nodejs_apt.changed
tags:
- monasca-nodejs
......@@ -46,9 +46,8 @@
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: monasca_apt_packages
with_items: "{{ monasca_apt_packages }}"
......@@ -24,7 +24,8 @@
- monasca-keystone
- name: Ensure monasca service, endpoint, roles and users
command: "/opt/venvs/monasca-client/bin/python /usr/local/bin/create_monasca_service.py"
command: "/opt/venvs/monasca-client/bin/python /usr/local/bin/create_monasca_service.py"
changed_when: false
tags:
- monasca-keystone
......
......@@ -20,7 +20,7 @@
system: "yes"
with_items:
- "{{ monasca_system_group_name }}"
- "kafka"
- "kafka"
- "storm"
- "grafana"
tags:
......@@ -123,7 +123,7 @@
until: install_packages|success
retries: 5
delay: 2
with_items: monasca_required_pip_packages
with_items: "{{ monasca_required_pip_packages }}"
tags:
- monasca-install
- monasca-pip-packages
......@@ -167,7 +167,7 @@
- "client"
- "api"
- "persister"
- "notification"
- "notification"
tags:
- monasca-install
- monasca-create-venv
......@@ -181,7 +181,7 @@
until: install_packages|success
retries: 5
delay: 2
with_items: monasca_pip_packages
with_items: "{{ monasca_pip_packages }}"
tags:
- monasca-install
- monasca-pip-packages
......@@ -211,6 +211,9 @@
- repo: "{{ monasca_ui_git_repo }}"
dest: "monasca-ui"
version: "{{ monasca_git_branch }}"
- repo: "{{ monasca_client_git_repo }}"
dest: "monasca-client"
version: "{{ monasca_git_branch }}"
tags:
- monasca-clone-repos
- monasca-install
# {{ ansible_managed }}
# This the default chrony.conf file for the Debian chrony package. After
# editing this file use the command 'invoke-rc.d chrony restart' to make
# your changes take effect. John Hasler <jhasler@debian.org> 1998-2008
# See www.pool.ntp.org for an explanation of these servers. Please
# consider joining the project if possible. If you can't or don't want to
# use these servers I suggest that you try your ISP's nameservers. We mark
# the servers 'offline' so that chronyd won't try to connect when the link
# is down. Scripts in /etc/ppp/ip-up.d and /etc/ppp/ip-down.d use chronyc
# commands to switch it on when a dialup link comes up and off when it goes
# down. Code in /etc/init.d/chrony attempts to determine whether or not
# the link is up at boot time and set the online status accordingly. If
# you have an always-on connection such as cable omit the 'offline'
# directive and chronyd will default to online.
#
# Note that if Chrony tries to go "online" and dns lookup of the servers
# fails they will be discarded. Thus under some circumstances it is
# better to use IP numbers than host names.
{% for ntp_server in ntp_servers %}
server {{ ntp_server }} offline minpoll 8
{% endfor %}
# Look here for the admin password needed for chronyc. The initial
# password is generated by a random process at install time. You may
# change it if you wish.
keyfile /etc/chrony/chrony.keys
# Set runtime command key. Note that if you change the key (not the
# password) to anything other than 1 you will need to edit
# /etc/ppp/ip-up.d/chrony, /etc/ppp/ip-down.d/chrony, /etc/init.d/chrony
# and /etc/cron.weekly/chrony as these scripts use it to get the password.
commandkey 1
# I moved the driftfile to /var/lib/chrony to comply with the Debian
# filesystem standard.
driftfile /var/lib/chrony/chrony.drift
# Comment this line out to turn off logging.
log tracking measurements statistics
logdir /var/log/chrony
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
# Dump measurements when daemon exits.
dumponexit
# Specify directory for dumping measurements.
dumpdir /var/lib/chrony
# Let computer be a server when it is unsynchronised.
local stratum 10
# Allow computers on the unrouted nets to use the server.
allow 10/8
allow 192.168/16
allow 172.16/12
# This directive forces `chronyd' to send a message to syslog if it
# makes a system clock adjustment larger than a threshold value in seconds.
logchange 0.5
# This directive defines an email address to which mail should be sent
# if chronyd applies a correction exceeding a particular threshold to the
# system clock.
# mailonchange root@localhost 0.5
# This directive tells chrony to regulate the real-time clock and tells it
# Where to store related data. It may not work on some newer motherboards
# that use the HPET real-time clock. It requires enhanced real-time
# support in the kernel. I've commented it out because with certain
# combinations of motherboard and kernel it is reported to cause lockups.
# rtcfile /var/lib/chrony/chrony.rtc
# If the last line of this file reads 'rtconutc' chrony will assume that
# the CMOS clock is on UTC (GMT). If it reads '# rtconutc' or is absent
# chrony will assume local time. The line (if any) was written by the
# chrony postinst based on what it found in /etc/default/rcS. You may
# change it if necessary.
rtconutc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment