openstack-ansible-os_monasca/tasks/monasca_influxdb_setup.yml

48 lines
1.7 KiB
YAML

---
# 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 influxdb database
influxdb_database:
hostname: "{{ monasca_influxdb_host }}"
port: "{{ monasca_influxdb_port }}"
username: "{{ monasca_influxdb_admin }}"
password: "{{ monasca_influxdb_admin_password }}"
database_name: "{{ monasca_influxdb_database }}"
state: present
no_log: True
- name: Create influxdb retention policy for database
influxdb_retention_policy:
hostname: "{{ monasca_influxdb_host }}"
port: "{{ monasca_influxdb_port }}"
database_name: "{{ monasca_influxdb_database }}"
username: "{{ monasca_influxdb_admin }}"
password: "{{ monasca_influxdb_admin_password }}"
policy_name: persister_all
duration: "{{ monasca_influxdb_retention_policy }}"
replication: "{{ monasca_influxdb_replication_factor }}"
no_log: True
- name: Create influxdb users
influxdb_user:
hostname: "{{ monasca_influxdb_host }}"
port: "{{ monasca_influxdb_port }}"
username: "{{ monasca_influxdb_admin }}"
password: "{{ monasca_influxdb_admin_password }}"
user_name: "{{ item.username }}"
user_password: "{{ item.password }}"
with_items:
- "{{ monasca_influxdb_users }}"
no_log: True