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.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distributions

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

asb_pl_template-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

asb_pl_template-0.1.0-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.0.tar.gz.

File metadata

  • Download URL: asb_pl_template-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 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.0.tar.gz
Algorithm Hash digest
SHA256 2fb5423ab5320760b889d0e452d48e1fb704d62d1a0b417758e62043d83cc5c0
MD5 6614a6009543d77c8192beea4b0a9f17
BLAKE2b-256 5fbe9f59e26134e96091b72d250bef4316b4be8e7e887db0e87a4c1dfff5df48

See more details on using hashes here.

File details

Details for the file asb_pl_template-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for asb_pl_template-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b7779df8c44eb992c366dcc746abc14d95335d37e55e02d8a5b0a05ab4dc161
MD5 a355b7aecee515051247ef17c611654b
BLAKE2b-256 4e87c6a8f4b603ad0727979ccd8f47311922c6d6b6b694f961b65192fad34627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asb_pl_template-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c2c8a551e6c221377a1b5d80bc2d47693baf8daaace9aaf11bc15071900a2db
MD5 09e7c8d6090024cada74327342e49350
BLAKE2b-256 b87b768e2fd15095e7c9eaec59271046a0f4feb67b89929665a52507798bef0d

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