Skip to main content

A simple project template for Ansible

Project description

ansible-playbook-template

简介

ansible-playbook-template是一个用于快速生成ansible playbook的工具。

该工具可以帮助您快速生成ansible playbook的项目结构,同时也可以帮助您快速生成ansible playbook的role结构。

支持如下功能:

  • 快速生成项目结构
  • 快速生成role结构,同 ansible-galaxy init 功能一致,支持生成多个role
  • 快速生成playbook结构
  • 快速生成inventory结构
  • 快速生成host_vars结构
  • 快速生成group_vars结构
  • 快速生成hosts结构
  • 快速生成ansible.cfg结构
  • 快速生成README.md结构
  • 快速生成requirements.yml结构 ....

快速开始

pip install asb-pl-template

#You can install  asb-pl-template directly using pipx:
pipx install "git+https://github.com/hujianli94/asb-pl-template.git"

使用

# 快速生成项目结构和role结构
asb-pl-template create <project_name> --roles-path <path> --role-name <role_name>

# 快速生成playbook
asb-pl-template create <project_name> --playbook-name <playbook_name>

# 快速生成多个role
asb-pl-template create <project_name> --roles-path <path> --role-name <role_name> --role-name <role_name>

# 删除项目role
asb-pl-template delete <project_name> --roles-path <path> --role-name <role_name>

# 使用 --verbose 参数开启详细日志输出
asb-pl-template create <project_name> --roles-path <path> --role-name <role_name> --verbose


## 生成项目结构如下
<project_name>/
├── README.md            # 该专案的说明文件
├── ansible.cfg          # ansible config file
├── hosts                # inventory file for production servers
├── group_vars/
│   ├── main.yml         # 各环境共用的 vars   ├── local.yml        # 本机开发的 vars   ├── prod.yml         # 正式环境的 vars   └── stage.yml        # 测试环境的 vars
├── host_vars
│   ├── prod.yml         # 正式环境的主机 vars   └── stage.yml        # 测试环境的主机 vars
├── library/             # 自定义的模块
├── requirements.yml     # 依赖的 role
├── playbooks/
│   └── site.yml         # 主 playbook   └── site-local.yml   # 本机开发的 playbook   └── site-prod.yml    # 正式环境的 playbook   └── site-stage.yml   # 测试环境的 playbook
└── inventories/
    ├── prod/
       ├── group_vars/   # 组 vars
       ├── host_vars/    # 主机 vars
       └── inventory/    # 主机清单文件
    └── stage/
        ├── group_vars/   # 组 vars
        ├── host_vars/    #
        └── inventory/    #
└── roles/
    └── <role_name>/        # role name
        ├── tasks/        #
           └── main.yml  # main tasks file
        ├── handlers/     #
           └── main.yml  # handlers file
        ├── templates/    #
           └── ntp.conf.j2 # templates end in .j2
        ├── files/        #
           ├── bar.txt   # files
           └── foo.sh    # script files
        ├── vars/         #
           └── main.yml  # variables with this role
        ├── defaults/     #
           └── main.yml  # default variables
        └── meta/         #
            └── main.yml  # role dependencies
└── tests/
    └── test.yml        # playbook for testing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asb_pl_template-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asb_pl_template-0.1.1-py2.py3-none-any.whl (7.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file asb_pl_template-0.1.1.tar.gz.

File metadata

  • Download URL: asb_pl_template-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.6

File hashes

Hashes for asb_pl_template-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e7bd01f7f3289779b3013721bf402bac6d392db6c62929a2748e53e1cf7d82ec
MD5 84b995a288c393e6315e52596d7d20f5
BLAKE2b-256 da9a24d00d9b33431d5fc5cbdbb00dc2b95118db101aff56141cea1364dbe935

See more details on using hashes here.

File details

Details for the file asb_pl_template-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for asb_pl_template-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d9603b12f11a4262f11c421aa7ccd7e6d825e0e7ca7796dc5afe8a1ce3916f2c
MD5 8ff1d8eb434c365439d0b8882a4925be
BLAKE2b-256 dc0e4e89a2ee5ddaebb982c0db21410bad163ad72e9b7f33315f8da63ad41510

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page