Switch to custom role influxdb_grafana

- Use plugin version 3.0.0 and remove compatibility with MOS 6.1
- Leverage common tasks to configure disk and network

Change-Id: I5175c577e54e0b41b5e60e136d025f1781a2a45b
This commit is contained in:
Swann Croiset 2015-09-07 10:03:21 +02:00
parent c95b77afcd
commit c916c62eeb
13 changed files with 134 additions and 398 deletions

View File

@ -1,39 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
$roles = hiera('roles')
$blockdevices_array = split($::blockdevices, ',')
# Check that we're not colocated with other roles
if size($roles) > 1 {
fail('The InfluxDB-Grafana plugin cannot be deployed with roles other than base-os.')
}
# Check that disk device(s) exist
if ($influxdb_grafana['disk1']) and !($influxdb_grafana['disk1'] in $blockdevices_array) {
fail("Disk device ${ influxdb_grafana['disk1'] } doesn't exist.")
}
if ($influxdb_grafana['disk2']) and !($influxdb_grafana['disk2'] in $blockdevices_array) {
fail("Disk device ${ influxdb_grafana['disk2'] } doesn't exist.")
}
if ($influxdb_grafana['disk3']) and !($influxdb_grafana['disk3'] in $blockdevices_array) {
fail("Disk device ${ influxdb_grafana['disk3'] } doesn't exist.")
}
}

View File

@ -12,51 +12,46 @@
# License for the specific language governing permissions and limitations
# under the License.
#
$influxdb_grafana = hiera('influxdb_grafana')
$user_node_name = hiera('user_node_name')
if $influxdb_grafana['node_name'] == $user_node_name {
class {'::firewall':}
class {'::firewall':}
firewall { '000 accept all icmp requests':
proto => 'icmp',
action => 'accept',
}
firewall { '001 accept all to lo interface':
proto => 'all',
iniface => 'lo',
action => 'accept',
}
firewall { '002 accept related established rules':
proto => 'all',
state => ['RELATED', 'ESTABLISHED'],
action => 'accept',
}
firewall {'020 ssh':
port => 22,
proto => 'tcp',
action => 'accept',
}
firewall { '200 influxdb':
port => [8083, 8086],
proto => 'tcp',
action => 'accept',
}
firewall { '201 grafana':
port => 8000,
proto => 'tcp',
action => 'accept',
}
firewall { '999 drop all other requests':
proto => 'all',
chain => 'INPUT',
action => 'drop',
}
firewall { '000 accept all icmp requests':
proto => 'icmp',
action => 'accept',
}
firewall { '001 accept all to lo interface':
proto => 'all',
iniface => 'lo',
action => 'accept',
}
firewall { '002 accept related established rules':
proto => 'all',
state => ['RELATED', 'ESTABLISHED'],
action => 'accept',
}
firewall {'020 ssh':
port => 22,
proto => 'tcp',
action => 'accept',
}
firewall { '200 influxdb':
port => [8083, 8086],
proto => 'tcp',
action => 'accept',
}
firewall { '201 grafana':
port => 8000,
proto => 'tcp',
action => 'accept',
}
firewall { '999 drop all other requests':
proto => 'all',
chain => 'INPUT',
action => 'drop',
}

View File

@ -12,15 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
#
$influxdb_grafana = hiera('influxdb_grafana')
$user_node_name = hiera('user_node_name')
if $influxdb_grafana['node_name'] == $user_node_name {
class {'lma_monitoring_analytics::grafana':
admin_username => $influxdb_grafana['grafana_username'],
admin_password => $influxdb_grafana['grafana_userpass'],
influxdb_username => $influxdb_grafana['influxdb_username'],
influxdb_password => $influxdb_grafana['influxdb_userpass'],
influxdb_database => $influxdb_grafana['influxdb_dbname'],
}
$influxdb_grafana = hiera('influxdb_grafana')
class {'lma_monitoring_analytics::grafana':
admin_username => $influxdb_grafana['grafana_username'],
admin_password => $influxdb_grafana['grafana_userpass'],
influxdb_username => $influxdb_grafana['influxdb_username'],
influxdb_password => $influxdb_grafana['influxdb_userpass'],
influxdb_database => $influxdb_grafana['influxdb_dbname'],
}

View File

@ -13,22 +13,35 @@
# under the License.
#
$influxdb_grafana = hiera('influxdb_grafana')
$directory = $influxdb_grafana['data_dir']
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
# retention period value is expressd in days
if $influxdb_grafana['retention_period'] == 0 {
$retention_period = 'INF'
} else {
$retention_period = sprintf('%dd', $influxdb_grafana['retention_period'])
}
class { 'lma_monitoring_analytics::influxdb':
influxdb_rootpass => $influxdb_grafana['influxdb_rootpass'],
influxdb_dbname => $influxdb_grafana['influxdb_dbname'],
influxdb_username => $influxdb_grafana['influxdb_username'],
influxdb_userpass => $influxdb_grafana['influxdb_userpass'],
influxdb_dir => $influxdb_grafana['data_dir'],
retention_period => $retention_period,
replication_factor => $influxdb_grafana['replication_factor'],
}
user { 'influxdb':
ensure => present,
system => true,
shell => '/sbin/nologin',
}
file { $directory:
ensure => 'directory',
owner => 'influxdb',
group => 'influxdb',
require => User['influxdb'],
}
# retention period value is expressd in days
if $influxdb_grafana['retention_period'] == 0 {
$retention_period = 'INF'
} else {
$retention_period = sprintf('%dd', $influxdb_grafana['retention_period'])
}
class { 'lma_monitoring_analytics::influxdb':
influxdb_rootpass => $influxdb_grafana['influxdb_rootpass'],
influxdb_dbname => $influxdb_grafana['influxdb_dbname'],
influxdb_username => $influxdb_grafana['influxdb_username'],
influxdb_userpass => $influxdb_grafana['influxdb_userpass'],
influxdb_dir => $influxdb_grafana['data_dir'],
retention_period => $retention_period,
replication_factor => $influxdb_grafana['replication_factor'],
require => File[$directory],
}

View File

@ -1,87 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
notice('MODULAR: netconfig.pp')
$network_scheme = hiera('network_scheme')
class { 'l23network' :
use_ovs => hiera('use_neutron', false)
}
prepare_network_config($network_scheme)
$sdn = generate_network_config()
notify {'SDN': message => $sdn }
#Set arp_accept to 1 by default #lp1456272
sysctl::value { 'net.ipv4.conf.all.arp_accept': value => '1' }
sysctl::value { 'net.ipv4.conf.default.arp_accept': value => '1' }
# setting kernel reserved ports
# defaults are 49000,49001,35357,41055,58882
class { 'openstack::reserved_ports': }
### TCP connections keepalives and failover related parameters ###
# configure TCP keepalive for host OS.
# Send 3 probes each 8 seconds, if the connection was idle
# for a 30 seconds. Consider it dead, if there was no responces
# during the check time frame, i.e. 30+3*8=54 seconds overall.
# (note: overall check time frame should be lower then
# nova_report_interval).
class { 'openstack::keepalive' :
tcpka_time => '30',
tcpka_probes => '8',
tcpka_intvl => '3',
tcp_retries2 => '5',
}
# increase network backlog for performance on fast networks
sysctl::value { 'net.core.netdev_max_backlog': value => '261144' }
L2_port<||> -> Sysfs_config_value<||>
L3_ifconfig<||> -> Sysfs_config_value<||>
L3_route<||> -> Sysfs_config_value<||>
class { 'sysfs' :}
sysfs_config_value { 'rps_cpus' :
ensure => 'present',
name => '/etc/sysfs.d/rps_cpus.conf',
value => cpu_affinity_hex($::processorcount),
sysfs => '/sys/class/net/*/queues/rx-*/rps_cpus',
exclude => '/sys/class/net/lo/*',
}
sysfs_config_value { 'xps_cpus' :
ensure => 'present',
name => '/etc/sysfs.d/xps_cpus.conf',
value => cpu_affinity_hex($::processorcount),
sysfs => '/sys/class/net/*/queues/tx-*/xps_cpus',
exclude => '/sys/class/net/lo/*',
}
if !defined(Package['irqbalance']) {
package { 'irqbalance':
ensure => installed,
}
}
if !defined(Service['irqbalance']) {
service { 'irqbalance':
ensure => running,
require => Package['irqbalance'],
}
}
}

View File

@ -1,41 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
class { 'disk_management': }
if ($influxdb_grafana['disk1']) {
disk_management::partition { "/dev/${influxdb_grafana['disk1']}":
size => $influxdb_grafana['disk1_size'],
require => Class['disk_management'],
}
}
if ($influxdb_grafana['disk2']) {
disk_management::partition { "/dev/${influxdb_grafana['disk2']}":
size => $influxdb_grafana['disk2_size'],
require => Class['disk_management'],
}
}
if ($influxdb_grafana['disk3']) {
disk_management::partition { "/dev/${influxdb_grafana['disk3']}":
size => $influxdb_grafana['disk3_size'],
require => Class['disk_management'],
}
}
}

View File

@ -1,47 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
$directory = $influxdb_grafana['data_dir']
$disks = split($::unallocated_pvs, ',')
validate_array($disks)
user { 'influxdb':
ensure => present,
system => true,
shell => '/sbin/nologin',
}
if empty($disks) {
file { $directory:
ensure => 'directory',
owner => 'influxdb',
group => 'influxdb',
require => User['influxdb'],
}
} else {
disk_management::lvm_fs { $directory:
owner => 'influxdb',
group => 'influxdb',
disks => $disks,
lv_name => 'influxdb-data',
vg_name => 'influxdb',
require => User['influxdb'],
}
}
}

14
deployment_tasks.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: influxdb_grafana
type: group
role: [influxdb_grafana]
tasks:
- hiera
- globals
- tools
- logging
- netconfig
required_for: [deploy_end]
requires: [deploy_start]
parameters:
strategy:
type: parallel

View File

@ -22,16 +22,6 @@ attributes:
- condition: "true"
action: hide
node_name:
value: 'influxdb'
label: 'Node name'
description: 'The name of the node where the plugin will be deployed'
weight: 10
type: "text"
regex:
source: '\S'
error: "You must provide a name"
influxdb_rootpass:
value: ''
label: 'Root password'
@ -93,6 +83,7 @@ attributes:
error: "You must provide a password with at least 4 characters"
# Parameter hidden in the UI on purpose
# this directory must match the mount point set in volumes.yaml
data_dir:
value: '/opt/influxdb'
label: 'InfluxDB storage directory'
@ -102,58 +93,3 @@ attributes:
restrictions:
- condition: "true"
action: hide
disk1:
value: ''
label: 'Disk 1'
description: 'Disk device used to store InfluxDB data (for instance sda or sdb or another device). Leave it empty to use "/".'
weight: 80
type: "text"
disk1_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 90
type: "text"
disk2:
value: ''
label: 'Disk 2'
description: 'Disk device used to store InfluxDB data (for instance sdb).'
weight: 100
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk1.value == ''"
action: "disable"
disk2_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 110
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk1.value == ''"
action: "disable"
disk3:
value: ''
label: 'Disk 3'
description: 'Disk device used to store InfluxDB data (for instance sdc).'
weight: 120
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk2.value == ''"
action: "disable"
disk3_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 130
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk2.value == ''"
action: "disable"

View File

@ -7,7 +7,7 @@ version: '0.8.0'
# Description
description: Deploy InfluxDB server and the Grafana web interface.
# Required fuel version
fuel_version: ['6.1', '7.0']
fuel_version: ['7.0']
# Specify license of your plugin
licenses: ['Apache License Version 2.0']
# Specify author or company name
@ -25,16 +25,6 @@ releases:
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: ubuntu
version: 2014.2-6.1
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2014.2-6.1
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
# Version of plugin package
package_version: '2.0.0'
package_version: '3.0.0'

13
node_roles.yaml Normal file
View File

@ -0,0 +1,13 @@
influxdb_grafana:
name: 'InfluxDB Grafana'
description: 'Install InfluxDB and Grafana'
has_primary: false
public_ip_required: false
weight: 100
limits:
max: 1
conflicts:
- controller
- compute
- cinder
- ceph-osd

View File

@ -1,22 +1,7 @@
# This task is executed before any real deployment task
- role: ['base-os']
stage: post_deployment/8000
type: puppet
parameters:
puppet_manifest: puppet/manifests/check_environment_configuration.pp
puppet_modules: puppet/modules
timeout: 300
# The following tasks are executed in the order they are declared
- role: ['base-os']
stage: post_deployment/8100
type: puppet
parameters:
puppet_manifest: puppet/manifests/netconfig.pp
puppet_modules: /etc/puppet/modules
timeout: 720
- role: ['base-os']
# Priorities are important, this ensure that this plugin is deployed before
# LMA Collector (priority 8200).
- role: [influxdb_grafana]
stage: post_deployment/8100
type: puppet
parameters:
@ -24,21 +9,7 @@
puppet_modules: /etc/puppet/modules
timeout: 300
- role: ['base-os']
stage: post_deployment/8100
type: puppet
parameters:
puppet_manifest: puppet/manifests/setup_disks.pp
puppet_modules: puppet/modules
timeout: 600
- role: ['base-os']
stage: post_deployment/8100
type: reboot
parameters:
timeout: 600
- role: ['base-os']
- role: [influxdb_grafana]
stage: post_deployment/8100
type: puppet
parameters:
@ -46,7 +17,7 @@
puppet_modules: puppet/modules
timeout: 600
- role: ['base-os']
- role: [influxdb_grafana]
stage: post_deployment/8100
type: puppet
parameters:
@ -54,7 +25,7 @@
puppet_modules: puppet/modules
timeout: 600
- role: ['base-os']
- role: [influxdb_grafana]
stage: post_deployment/8100
type: puppet
parameters:

21
volumes.yaml Normal file
View File

@ -0,0 +1,21 @@
volumes:
- id: "influxdb"
type: "vg"
min_size:
generator: "calc_gb_to_mb"
generator_args: [30]
label: "InfluxDB database"
volumes:
- mount: "/opt/influxdb"
type: "lv"
name: "influxdb"
file_system: "ext4"
size:
generator: "calc_total_vg"
generator_args: ["influxdb"]
volumes_roles_mapping:
influxdb_grafana:
- {allocate_size: "min", id: "os"}
- {allocate_size: "min", id: "logs"}
- {allocate_size: "all", id: "influxdb"}