Bootstrap influx.create.db role
This commit is contained in:
commit
e6ce2b5c97
7 changed files with 150 additions and 0 deletions
37
tasks/main.yml
Normal file
37
tasks/main.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
|
||||
- name: Ensure dependencies
|
||||
apt:
|
||||
name: [ 'python-requests', 'python-pip' ]
|
||||
state: present
|
||||
|
||||
- name: Ensure python-influxdb
|
||||
pip:
|
||||
name: influxdb
|
||||
state: present
|
||||
|
||||
- name: Ensure database
|
||||
influxdb_database:
|
||||
login_username: "{{ admin_user }}"
|
||||
login_password: "{{ admin_pass }}"
|
||||
database_name: "{{ db_name }}"
|
||||
|
||||
- name: Set retention policy
|
||||
influxdb_retention_policy:
|
||||
login_username: "{{ admin_user }}"
|
||||
login_password: "{{ admin_pass }}"
|
||||
database_name: "{{ db_name }}"
|
||||
policy_name: "{{ policy_name }}"
|
||||
duration: "{{ policy_duration }}"
|
||||
replication: "{{ policy_replication }}"
|
||||
|
||||
- name: Ensure user and grant access to DB
|
||||
influxdb_user:
|
||||
user_name: "{{ user_name }}"
|
||||
user_password: "{{ user_pass }}"
|
||||
login_username: "{{ admin_user }}"
|
||||
login_password: "{{ admin_pass }}"
|
||||
admin: "{{ is_admin }}"
|
||||
grants:
|
||||
- database: "{{ db_name }}"
|
||||
privilege: "{{ priv }}"
|
Reference in a new issue