{ "info": { "author": "Robert Kaussow", "author_email": "mail@geeklabor.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Utilities" ], "description": "# ansible-roler\n\n[![Build Status](https://cloud.drone.io/api/badges/xoxys/ansible-roler/status.svg)](https://cloud.drone.io/xoxys/ansible-roler)\n[![](https://img.shields.io/pypi/pyversions/ansible-roler.svg)](https://pypi.org/project/ansible-roler/)\n[![](https://img.shields.io/pypi/status/ansible-roler.svg)](https://pypi.org/project/ansible-roler/)\n[![](https://img.shields.io/pypi/v/ansible-roler.svg)](https://pypi.org/project/ansible-roler/)\n\n`ansible-roler` is a simple command line tool to setup the recommendet folder structure for a new ansible role.\n\n## Table of Content\n\n- [Setup](#setup)\n- [Usage](#usage)\n- [Configuration](#configuration)\n - [Defaults](#defaults)\n - [Base configuration](#base-configuration)\n - [Templating](#templating)\n- [License](#license)\n- [Maintainers and Contributors](#maintainers-and-contributors)\n\n---\n\n### Setup\n\n```Shell\n# From internal pip repo as user\npip install ansible-roler --user\n\n# .. or as root\nsudo pip install ansible-roler\n```\n\n### Usage\n\n```Shell\n$ ansible-roler --help\nusage: ansible-roler [-h] [-c CONFIG_FILE] [-n NAME] [-p PATH] [-v]\n\nManage ansible role environments\n\noptional arguments:\n -h, --help show this help message and exit\n -c CONFIG_FILE Location of configuration file:\n [/Users/rkau2905/Library/Application Support/ansible-\n role/config.ini]\n -n NAME, --name NAME Name of the new role\n -p PATH, --path PATH Path where the new role will be created\n -v, --verbose Show more verbose output\n```\n\n### Configuration\n\n#### Defaults\n\n`ansible-roler` will create the the minimal recommended folder structure:\n\n```Text\ncommon/\n tasks/\n main.yml\n handlers/\n main.yml\n templates/\n files/\n vars/\n defaults/\n main.yml\n meta/\n main.yml\n```\n\nThe main.yml files will be created only if you enable the [templating feature](#templating). Otherwise\nthe folders will be left empty.\n\n#### Base configuration\n\nIn addition to the command line options there are parameters you can adjust in a config file. The default location\nfor your config file is `~/ansible-roler/config.ini` but you can place it anywhere and\nspecifiy the path with `ansible-roler -c /path/to/config.ini`.\n\n```INI\n[base]\n# base path ansible-roler will use to create new roles\nbase_path=~/ansibleroles\n\n[logging]\n# error |\u00a0warning | info | debug\n# you can also control this with commandline attribute -vvv\nlog_level=warning\n```\n\n#### Templating\n\nIn special cases it can be helpfule to add templated files to each new role. The templating function\ncan be used to place in customized meta/main.yml or a default config file for your CI in each new role.\nThe templating is disabled by default and must be enabled in the config file befor you can use it.\n\n```INI\n[templating]\n# enable template functionality\nenable_templating=false\n# path to your own subdir template file\n# if not in config file default one will be used\n# if added empty 'subdir_template=' subdir templating is disabled\nsubdir_template=/home/jdoe/ansible/custom/main.yaml.j2\n# if you like you can exclude some subdirs from templating\n# these folders will be left empty\nexclude_subdirs=templates,vars,files\n# path to your own ci template file\n# if not in config file default one will be used\n# if added empty 'ci_template=' ci templating is disabled\nroot_template=/home/jdoe/ansible/custom/.drone.yaml.j2\n\n[template-vars]\n# define some variables you want to use in your template\nmeta_author=John Doe\nmeta_license=MIT\n```\n\n`ansible-roler` comes with simple default template file but as you can see in the config you can\ncustomize and use your own. The default file looks as follows:\n\n```HTML+Django\n---\n{% if subdir == 'tasks' %}\n# Contains the main list of tasks to be executed by the role.\n# Don't add tasks directly to the main.yml use includes instead\n- include_tasks: setup.yml\n{% endif %}\n{% if subdir == 'handlers' %}\n# Contains handlers, which may be used by this role or\n# even anywhere outside this role.\n{% endif %}\n{% if subdir == 'defaults' %}\n# Default variables for the role.\n{% endif %}\n{% if subdir == 'meta' %}\ngalaxy_info:\n author: {{ vars.meta.author | default('UNKNOWN') }}\n description: Deploy some application\n license: {{ vars.meta.author | default('MIT') }}\n min_ansible_version: 2.4\n platforms:\n - name: EL\n versions:\n - 7\n galaxy_tags:\n - myapp\ndependencies: []\n{% endif %}\n```\n\nCurrently, you can set two template files:\n\n- `subdir_template`: template will be deployed to the folders, tasks, handlers, defaults and meta.\n This can be used to provide a pre-configured main.yml in each of these folders.\n- `root_template`: tempate will be deployed to the root of your role.\n This can be used to provide a default config for your ci system.\n\nTemplating in `ansible-roler` works only with two static jinja2 files but you can control the content\nof the destination file with variables. Following variables will be automatically passed to the template\nprocessor:\n\n- subdir_template\n - `rolename`: these variable holds the rolename you have passed to `ansible-roler`\n If you have prefixed your role with prexix.myrole only the second part will be used.\n - `subdir`: these variable holds the current subdir which is processed at this time.\n This is a good option to add differen content to your destination file in relation to\n the current directory. You look at the usage in the build-in example above.\n- root_template\n - `rolename`\n\nThere is also an option to set custom variables. These variables will be accessable throug `vars`.\nThis variable is an empty dictionary as long as you don't set some variables. Therefore you have to\ndefine variables under the `template-vars' section in config file.\n\n```INI\n[template-vars]\n# define some variables you want to use in your template\nmeta_author=John Doe\nmeta_license=MIT\n```\n\nVariable names will be split at the first underscore. The first part is used as the name\nof a sub-dict under `vars` the other part is used as the of your variable. The result of the\nthese small example looks as follows:\n\n```Python\n{\n 'meta': {\n 'author': 'John Doe',\n 'license': 'MIT'\n }\n}\n```\n\nIf you want to access your variables in a template, here is an example `{{ vars.meta.author }}`.\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n### Maintainers and Contributors\n\n[Robert Kaussow](https://github.com/xoxys)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/xoxys/ansible-role", "keywords": "ansible cli role template", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ansible-roler", "package_url": "https://pypi.org/project/ansible-roler/", "platform": "", "project_url": "https://pypi.org/project/ansible-roler/", "project_urls": { "Homepage": "https://github.com/xoxys/ansible-role" }, "release_url": "https://pypi.org/project/ansible-roler/0.2.3/", "requires_dist": [ "six", "appdirs", "jinja2", "PyYAML", "configparser" ], "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "summary": "Command line tool to template the structure of a new ansible role.", "version": "0.2.3" }, "last_serial": 4846073, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "59efdef4d51a18ab17b0c3f48ae5681d", "sha256": "f7d2923c98abd64397accedfcec48a5960948fc5d42368a2e294558e41cebb6d" }, "downloads": -1, "filename": "ansible_roler-0.2.1-py3-none-any.whl", "has_sig": true, "md5_digest": "59efdef4d51a18ab17b0c3f48ae5681d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 9455, "upload_time": "2018-12-18T22:02:13", "url": "https://files.pythonhosted.org/packages/34/7c/7e37b642b28c30961131aa906f8bdcdb5d6514ca3205b1484a33787e3e28/ansible_roler-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de65760274eb35737c4e2027a15bfcb5", "sha256": "4642ff443b815b76e9569c4fbd44570dfd9dafa3872f199a5aad6b1c5cea8724" }, "downloads": -1, "filename": "ansible-roler-0.2.1.tar.gz", "has_sig": true, "md5_digest": "de65760274eb35737c4e2027a15bfcb5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 7974, "upload_time": "2018-12-18T22:02:14", "url": "https://files.pythonhosted.org/packages/d6/b4/00a10168b2026d793b188e92bc4a388ea984e6cebc88e2070396db7eccbe/ansible-roler-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "b3c8fbbefa7001139d2c6abd26dc0258", "sha256": "2a87a0d453bb7531131d634c34b0e22b900b8246b2e036d9c316b937ec588973" }, "downloads": -1, "filename": "ansible_roler-0.2.2-py3-none-any.whl", "has_sig": true, "md5_digest": "b3c8fbbefa7001139d2c6abd26dc0258", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 9741, "upload_time": "2019-01-08T07:48:02", "url": "https://files.pythonhosted.org/packages/32/96/bd35530c59878651f7c8030365d9100e91dd2209d8accf241fa5c13f8e7a/ansible_roler-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eba3c9ce2692648d54e02b8727585a8d", "sha256": "ca835b87ef8957df84c492abdb4812709d6e61e747824c099a6623caec86b9d8" }, "downloads": -1, "filename": "ansible-roler-0.2.2.tar.gz", "has_sig": true, "md5_digest": "eba3c9ce2692648d54e02b8727585a8d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8200, "upload_time": "2019-01-08T07:48:04", "url": "https://files.pythonhosted.org/packages/27/02/6705c527df606807a6aab5e12d68e3c0e2a09358da0348f2ff9b588063e0/ansible-roler-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "259d3da76359d7f6788e050a5c4dd0ef", "sha256": "ade85e13e4c74bfe5157a7bc3ec56e1d99eef7de52187a0742fe7261b05f9a34" }, "downloads": -1, "filename": "ansible_roler-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "259d3da76359d7f6788e050a5c4dd0ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 9777, "upload_time": "2019-02-20T15:20:15", "url": "https://files.pythonhosted.org/packages/4b/21/e4507b77177af6f8bc50798a475c733e0528c3643b1e202370aa0636ed3a/ansible_roler-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "db6079a46adb12d599e4aaa16ac718af", "sha256": "afa3a74ca331a00c8cf7c9eb07a4c6f9c29d901a6f578bab930cee158fcb11db" }, "downloads": -1, "filename": "ansible-roler-0.2.3.tar.gz", "has_sig": false, "md5_digest": "db6079a46adb12d599e4aaa16ac718af", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8233, "upload_time": "2019-02-20T15:20:16", "url": "https://files.pythonhosted.org/packages/4e/ac/5c3560d1314ae51be03b24f8ea957149459b0af30f7f74b487501b42fa2c/ansible-roler-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "259d3da76359d7f6788e050a5c4dd0ef", "sha256": "ade85e13e4c74bfe5157a7bc3ec56e1d99eef7de52187a0742fe7261b05f9a34" }, "downloads": -1, "filename": "ansible_roler-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "259d3da76359d7f6788e050a5c4dd0ef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 9777, "upload_time": "2019-02-20T15:20:15", "url": "https://files.pythonhosted.org/packages/4b/21/e4507b77177af6f8bc50798a475c733e0528c3643b1e202370aa0636ed3a/ansible_roler-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "db6079a46adb12d599e4aaa16ac718af", "sha256": "afa3a74ca331a00c8cf7c9eb07a4c6f9c29d901a6f578bab930cee158fcb11db" }, "downloads": -1, "filename": "ansible-roler-0.2.3.tar.gz", "has_sig": false, "md5_digest": "db6079a46adb12d599e4aaa16ac718af", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 8233, "upload_time": "2019-02-20T15:20:16", "url": "https://files.pythonhosted.org/packages/4e/ac/5c3560d1314ae51be03b24f8ea957149459b0af30f7f74b487501b42fa2c/ansible-roler-0.2.3.tar.gz" } ] }