Skip to content

Commit

Permalink
Merge pull request #1 from devops-works/remove-apt-loop-add-py3-support
Browse files Browse the repository at this point in the history
Remove with_items, use loop, use variable for python-pip package
  • Loading branch information
cleming authored Nov 9, 2020
2 parents 92667fc + b6607fd commit 4a29780
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
influxdb_reporting_disabled: "false"
influxdb_python_pip_package: "python3-pip"

# Admin
influxdb_admin_enabled: "true"
Expand Down
18 changes: 10 additions & 8 deletions tasks/influxdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
state: present
update_cache: yes

- name: Installs python-pip
apt:
pkg: "{{ influxdb_python_pip_package }}"
state: present

- name: Installs influxdb
apt:
pkg: "{{ item }}"
pkg: influxdb
state: present
with_items:
- influxdb
- python-pip
notify:
- Start influxdb

Expand All @@ -26,7 +28,7 @@
owner: influxdb
group: influxdb
mode: 0755
with_items:
loop:
- "{{ influxdb_datadir }}"
- "{{ influxdb_waldir }}"

Expand Down Expand Up @@ -65,7 +67,7 @@
database_name: "{{ item.database }}"
login_username: "{{ influxdb_admin_user }}"
login_password: "{{ influxdb_admin_password }}"
with_items: "{{ influxdb_users }}"
loop: "{{ influxdb_users }}"
when: influxdb_users is defined and "database" in item

- name: Adds database retention
Expand All @@ -77,7 +79,7 @@
replication: 1
login_username: "{{ influxdb_admin_user }}"
login_password: "{{ influxdb_admin_password }}"
with_items: "{{ influxdb_retentions }}"
loop: "{{ influxdb_retentions }}"
when: influxdb_retentions is defined

- name: Creates influxdb users
Expand All @@ -87,5 +89,5 @@
login_username: "{{ influxdb_admin_user }}"
login_password: "{{ influxdb_admin_password }}"
admin: "{{ item.admin | default(omit) }}"
with_items: "{{ influxdb_users }}"
loop: "{{ influxdb_users }}"
when: influxdb_users is defined

0 comments on commit 4a29780

Please sign in to comment.