buluma.influxdb2

Ansible角色 influxdb2

使用Ansible安装和配置InfluxDB 2.0。

GitHub 版本 问题 拉取请求 下载
github Version Issues PullRequests Ansible Role

示例剧本

此示例来自 molecule/default/converge.yml,每次推送、拉取请求和发布时都会进行测试。

---
- name: 收敛
  hosts: all
  gather_facts: true
  become: yes
  vars:
    apt_autostart_state: enabled
    pip_package: python3-pip
    pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
    pip_install_packages:
      - name: setuptools
      - name: requests

  pre_tasks:
    - name: 更新apt缓存。
      apt: update_cache=true cache_valid_time=600
      when: ansible_os_family == 'Debian'

    - name: 为旧版操作系统设置软件包名称。
      ansible.builtin.set_fact:
        pip_package: python-pip
      when: >
        (ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8)
        or (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10)
        or (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18)

  roles:
    - role: buluma.influxdb2
      influxdb_orgs:
        - name: main-org
          description: 主组织
        - name: guest-org

      influxdb_users:
        - name: admin01
          org: main-org
          password: secretPassword
        - name: guest01
          org: guest-org
          password: secretPassword

      influxdb_buckets:
        - name: bucket01
          description: 第一个桶
          org: main-org
          retention: 1d
        - name: bucket02
          org: main-org

机器需要准备。在CI中,这项工作通过 molecule/default/prepare.yml 来完成:

---
- name: 准备容器
  hosts: all
  gather_facts: true
  become: yes
  serial: 30%
  vars:
    apt_autostart_state: enabled

  roles:
    - role: buluma.bootstrap
    - role: buluma.apt_autostart
    - role: buluma.pip
    - name: buluma.influxdb2

  post_tasks:
    - name: 创建 /environmentfile.txt
      ansible.builtin.copy:
        content: "value=influxdb"
        dest: /environmentfile.txt
        mode: "0644"

另请查看 完整说明和示例 以了解如何使用这些角色。

角色变量

变量的默认值在 defaults/main.yml 中设置:

---
influxdb_dependencies:
  - apt-transport-https
  - curl
  - gnupg

influxdb_packages:
  - influxdb2
  - influxdb2-cli

influxdb_package_state: present

influxdb_config_path: /etc/influxdb
influxdb_bolt_path: /var/lib/influxdb/influxd.bolt
influxdb_engine_path: /var/lib/influxdb/engine

influxdb_host: http://localhost:8086

influxdb_config: {}
#  http-bind-address: 0.0.0.0:8086
#  reporting-disabled: true

influxdb_primary_org: example-org
influxdb_primary_bucket: example-bucket
influxdb_primary_username: example-user
influxdb_primary_password: ExAmPl3PA55W0rD

# 为管理员用户设置根令牌
influxdb_admin_token: EXAMPLE-TOKEN

influxdb_orgs: []
#  - name: main-org
#    description: 主组织
#  - name: guest-org

influxdb_users: []
#  - name: admin01
#    org: main-org
#    password: secretPassword
#  - name: guest01
#    org: guest-org
#    password: secretPassword

influxdb_buckets: []
#  - name: bucket01
#    description: 第一个桶
#    org: main-org
#    retention: 1d
#  - name: bucket02
#    description: 第二个桶
#    org: main-org

influxdb_service_enabled: true

influxdb_service_state: started

influxdb_skip_onboarding: false

要求

使用的角色状态

下面的角色用于准备系统。您可以用其他方式准备您的系统。

需求 GitHub 版本
buluma.bootstrap Ansible Molecule Version
buluma.apt_autostart Ansible Molecule Version
buluma.pip Ansible Molecule Version

上下文

此角色是多个兼容角色的一部分。有关更多信息,请查看 这些角色的文档

这是相关角色的概述:

dependencies

兼容性

此角色已在以下 容器镜像 中测试:

容器 标签
Debian 所有
Ubuntu 所有
Kali 所有

所需的最低Ansible版本为2.12,已测试:

  • 之前的版本。
  • 当前版本。
  • 开发版本。

如果您发现问题,请在 GitHub 注册。

更改日志

角色历史

许可证

MIT

作者信息

Shadow Walker

关于项目

Install and configure InfluxDB 2.0 using Ansible.

安装
ansible-galaxy install buluma.influxdb2
许可证
apache-2.0
下载
7.9k
拥有者
DevOps Engineer