xanmanning.diagrams
Ansible 角色:图表
用于在 Python3 虚拟环境中安装 Diagrams 的 Ansible 角色。
需求
此角色已在 Ansible 2.7.0+ 的以下 Linux 发行版上进行测试:
- Amazon Linux 2
- CentOS 8
- CentOS 7
- Debian 10
- Fedora 29
- Fedora 30
- Fedora 31
- Ubuntu 18.04 LTS
目标服务器需要以下软件包:
- Graphviz
- python3
- python3 venv
免责声明
如果您遇到任何问题,请创建 GitHub 问题,我在业余时间维护此角色,因此不能保证快速解决。
角色变量
变量 | 描述 | 默认值 |
---|---|---|
diagrams_version |
使用特定版本的 Diagrams,例如 0.10.0 。指定 false 以获取最新版本。 |
false |
diagrams_install_dir |
安装目录,用于放置图表虚拟环境。 | $HOME/.virtualenvs |
diagrams_venv_name |
图表虚拟环境的名称。 | diagrams |
diagrams_venv_suffix |
添加自定义后缀到虚拟环境。 | diagrams_version |
diagrams_venv_site_packages |
允许虚拟环境从全局 site-packages 继承包。 | false |
diagrams_install_os_dependencies |
允许角色安装操作系统依赖项。 | false |
diagrams_python3_path |
指定要在虚拟环境中使用的特定 Python 版本的路径。 | NULL |
依赖项
没有其他角色的依赖项。
示例剧本
为单用户安装的示例剧本:
- hosts: diagrams_hosts
roles:
- { role: xanmanning.diagrams, diagrams_version: 0.10.0 }
为全局安装最新版本的图表的示例剧本:
---
- hosts: diagrams_hosts
become: true
vars:
diagrams_install_os_dependencies: true
diagrams_install_dir: /opt/diagrams/bin
diagrams_venv_name: current
roles:
- role: xanmanning.diagrams
激活图表虚拟环境
您需要激活 Python3 虚拟环境才能访问 diagrams
。可以根据以下方式进行:
source {{ diagrams_install_dir }}/{{ diagrams_venv_name }}/bin/activate
在上述全局安装剧本中,这将看起来像以下方式:
source /opt/diagrams/bin/current/bin/activate