-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinfluxdb_install.yml
54 lines (53 loc) · 3.92 KB
/
influxdb_install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- hosts: all
tasks:
- name: Setting up Influxdb Database and set up all deps
block:
- name: Add Influxdb Repo
yum_repository:
name: influxdb
baseurl: https://repos.influxdata.com/rhel/$releasever/$basearch/stable
gpgcheck: yes
enabled: yes
gpgkey: https://repos.influxdata.com/influxdb.key
description: influxdb
- name: Installing InfluxDB
package:
state: present # required. Whether to install (C(present)), or remove (C(absent)) a package. Other states depend on the underlying package module, i.e C(latest).
name: influxdb # required. Package name, or package specifier with version, like C(name-1.0).,Be aware that packages are not always named the same and this module will not 'translate' them per distro.
- name: Setting up influxdb config
template:
src: influxdb.j2
dest: /etc/influxdb/influxdb.conf
- name: Ensuring that firewallD is enabled
service:
name: firewalld # required. Name of the service.
state: started # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload. B(At least one of state and enabled are required.) Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally.
- name: Enabling InfluxDB ports in Firewall
firewalld:
state: enabled # required. choices: enabled;disabled;present;absent. Enable or disable a setting. For ports: Should this port accept(enabled) or reject(disabled) connections. The states "present" and "absent" can only be used in zone level operations (i.e. when no other parameters but zone and state are set).
permanent: yes # not required. Should this configuration be in the running firewalld configuration or persist across reboots. As of Ansible version 2.3, permanent operations can operate on firewalld configs when it's not running (requires firewalld >= 3.0.9). (NOTE: If this is false, immediate is assumed true.)d
port: '{{ item }}/tcp' # not required. Name of a port or port range to add/remove to/from firewalld. Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port ranges.
loop:
- 8086
- 8082
- name: Restarting firewallD serice
service:
name: firewalld # required. Name of the service.
state: restarted # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload. B(At least one of state and enabled are required.) Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally.
#### Setting up prerequisites for installing Influxdb and for managing host by ansible
- name: Installing Python3 pip for getting influxdb python module
package:
state: present
name: python3-pip
- name: Installing influxdb python module
pip:
name: influxdb # not required. The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package.,This can be a list (since 2.2) and contain version specifiers (since 2.7).
state: present # not required. choices: absent;forcereinstall;latest;present. The state of module,The 'forcereinstall' option is only available in Ansible 2.1 and above.
#### Handlers for handle some changes in configuration
- name: starting up influxdb service
service:
name: influxdb
state: started
when:
- "'mgmt' in group_names"