rgibert.single_binary_service
单一二进制服务
描述
Ansible角色,用于将单一二进制文件安装为systemd服务
需求
- 基于RHEL或Debian的操作系统
角色变量
变量 | 描述 |
---|---|
single_binary_service_checksum | 下载文件的校验和 |
single_binary_service_dl_url | 下载目标地址 |
single_binary_service_exec_files | 需要设置可执行权限的文件(相对于single_binary_service_share_path) |
single_binary_service_group | single_binary_service_user的主组 |
single_binary_service_name | 服务名称 |
single_binary_service_share_path | 安装的共享路径 |
single_binary_service_start_cmd | 启动服务的命令 |
single_binary_service_stop_cmd | 停止服务的命令 |
single_binary_service_user | 以此用户身份运行服务 |
依赖
- 无
示例剧本
- hosts: servers
roles:
- role: rgibert.single_binary_service
prometheus_node_exporter_base_url: "https://github.com/prometheus/node_exporter/releases/download"
prometheus_node_exporter_dl_url: "{{ prometheus_node_exporter_base_url }}/v{{ single_binary_service_version }}/node_exporter-{{ single_binary_service_version }}.linux-{{ prometheus_node_exporter_arch }}.tar.gz"
single_binary_service_checksum: "sha256:{{ prometheus_node_exporter_base_url }}/v{{ single_binary_service_version }}/sha256sums.txt"
single_binary_service_dl_url: "{{ prometheus_node_exporter_base_url }}/v{{ single_binary_service_version }}/node_exporter-{{ single_binary_service_version }}.linux-{{ prometheus_node_exporter_arch }}.tar.gz"
single_binary_service_group: prometheus
single_binary_service_is_archive: true
single_binary_service_name: prometheus_node_exporter
single_binary_service_start_cmd: "/usr/local/share/prometheus_node_exporter-{{ single_binary_service_version }}/node_exporter-{{ single_binary_service_version }}.linux-{{ prometheus_node_exporter_arch }}/node_exporter"
single_binary_service_stop_cmd: "/usr/bin/ps auwwx | grep /usr/local/share/prometheus_node_exporter-{{ single_binary_service_version }}/node_exporter-{{ single_binary_service_version }}.linux-{{ prometheus_node_exporter_arch }}/node_exporter | grep -v grep | awk '{print $2}' | xargs kill -9"
single_binary_service_user: prometheus
single_binary_service_version: 0.18.1
prometheus_node_exporter_arch: amd64
许可证
GPLv3
作者信息
安装
ansible-galaxy install rgibert.single_binary_service
许可证
gpl-3.0
下载
355
拥有者
SRE @getsentry