--- - name: Install GnuPG apt: update_cache: yes name: - gnupg2 become: yes - name: APT Key apt_key: url: 'https://repos.influxdata.com/influxdb.key' state: present become: yes - name: Install repos template: src: influxdb.list.j2 dest: /etc/apt/sources.list.d/influxdb.list become: yes register: install_repo - name: Update APT Cache apt: update_cache: yes become: yes when: install_repo.changed - name: Install Packages apt: name: - curl - python3-influxdb - influxdb become: yes - name: InfluxDB user setup user: name: influxdb groups: - ssl-cert append: yes become: yes - name: Install configuration template: src: influxdb.conf.j2 dest: /etc/influxdb/influxdb.conf become: yes notify: Restart influxdb - name: Check for changed cert command: /bin/true when: - cert_changed notify: - Restart influxdb - name: Flush handlers meta: flush_handlers - name: create Influx DBs influxdb_database: database_name: '{{ item }}' hostname: localhost port: 8086 ssl: yes validate_certs: no state: present with_items: '{{ influx_dbs }}' become: yes - name: create Influx Users influxdb_user: user_name: '{{ item.key }}' user_password: '{{ item.value.password }}' grants: '{{ item.value.grants }}' hostname: localhost port: 8086 ssl: yes validate_certs: no state: present with_dict: '{{ influx_users }}' no_log: yes become: yes