mirror of https://github.com/ansible/ansible.git
Backport/2.9/docs (#64073)
* clarify no subfolders and md only for collections /docs folder (#63808) (cherry picked from commitpull/64163/head6a2902c8d5
) * Fixed example error in windows_winrm user guide (#63922) The example code to configure TLS 1.2 Support using Ansible had an indention error. The register variable 'enable_tls12' was not indented. This caused the subsequent task to fail since the variable was not registered. (cherry picked from commitc562e17659
) * Fix doc errors in AWS modules (#63851) * Fix register/debug in aws_batch_compute_environment * Fix aws_batch_job_queue doc errors * Fix module naming: `batch_job_queue` > `aws_batch_job_queue` * Fix missing register * Update debug task to use modern YAML format * Fix missing register + debug for lambda_policy * Fix YAML syntax for elb_application_lb_info module (cherry picked from commite4f16368ed
) * Update documentation for package module (#63909) It is not clear from the documentation that list can be used (cherry picked from commit7f2c367d78
) * [ec2_launch_template] Update description of state param (#63147) Currently, it is not possible to delete specific versions of an ec2 launch template. The module docs incorrectly suggest that there is a `version` param to the module that can be used to do that. This patch aims to correct that error. (cherry picked from commit7ea7260753
) * template: Add a space in example block (#63930) (cherry picked from commitf279715c29
) * revisions to docsite README (#63957) (cherry picked from commit5c962ef859
) * combine galaxy.com install roles details (#63486) (cherry picked from commitee8a088205
) * Correct a typo (#64020) (cherry picked from commit18f4f0549f
) * Update password.py (#63965) Update the examples of the password lookup plugin to show how multiple options are joined together. (cherry picked from commit92daec5d0b
) * Fix indentation of example (#63789) Remove no_log since module_defaults aren't displayed like set_fact was (cherry picked from commit1e52782d6b
) * add newline to render table correctly (#63769) (cherry picked from commit1aee11c860
) * clarified some points on environment keyword usage (#64065) (cherry picked from commit885ee62b53
)
parent
12820ba64f
commit
b80ca85a69
@ -1,51 +1,176 @@
|
||||
Homepage and Documentation Source for Ansible
|
||||
=============================================
|
||||
Ansible documentation
|
||||
=====================
|
||||
|
||||
This project hosts the source behind [docs.ansible.com](https://docs.ansible.com/)
|
||||
This project hosts the source behind [docs.ansible.com](https://docs.ansible.com/).
|
||||
|
||||
Contributions to the documentation are welcome. To make changes, submit a pull request that changes the reStructuredText files in the `rst/` directory only, and the core team can do a docs build and push the static files.
|
||||
To create clear, concise, consistent, useful materials on docs.ansible.com, please refer to the following information.
|
||||
|
||||
If you wish to verify output from the markup such as link references, you may install sphinx and build the documentation by running `make webdocs` from the `ansible/docs/docsite` directory.
|
||||
|
||||
To include module documentation you'll need to run `make webdocs` at the top level of the repository. The generated html files are in `docsite/htmlout/`.
|
||||
About Ansible
|
||||
-------------
|
||||
Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. Learn more about Ansible [here](https://docs.ansible.com/ansible/latest/index.html).
|
||||
|
||||
To limit module documentation building to a specific module, run `MODULES=NAME make webdocs` instead. This should make testing module documentation syntax much faster. Instead of a single module, you can also specify a comma-separated list of modules. In order to skip building documentation for all modules, specify non-existing module name, for example `MODULES=none make webdocs`.
|
||||
To install Ansible, see the [Installation Guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html).
|
||||
|
||||
The following sections provide information and resources on contributing to Ansible documentation.
|
||||
|
||||
Contributions
|
||||
=============
|
||||
Ansible documentation is written in ReStructuredText(RST). Contributions to the documentation are welcome.
|
||||
|
||||
The Ansible community produces guidance on contributions, building documentation, and submitting pull requests, which you can find in [Contributing to the Ansible Documentation](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html).
|
||||
|
||||
Filing issues
|
||||
-------------
|
||||
If you do not want to learn the reStructuredText format, you can also [file issues] about documentation problems on the Ansible GitHub project.
|
||||
|
||||
Note that module documentation can actually be [generated from a DOCUMENTATION docstring][module-docs] in the modules directory, so corrections to modules written as such need to be made in the module source, rather than in docsite source.
|
||||
Editing docs directly on GitHub
|
||||
-------------------------------
|
||||
For typos and other quick fixes, you can edit the documentation right from the site. See [Editing docs directly on GitHub](https://docs.ansible.com/ansible/devel/community/documentation_contributions.html#editing-docs-directly-on-github) for more information.
|
||||
|
||||
Ansible style guide
|
||||
===================
|
||||
|
||||
To create clear, concise, consistent, useful materials on docs.ansible.com, follow the guidelines found in the [Ansible Style Guide](https://docs.ansible.com/ansible/latest/dev_guide/style_guide/index.html#linguistic-guidelines).
|
||||
|
||||
reStructuredText
|
||||
----------------
|
||||
The Ansible style guide also includes useful guidelines on writing in reStructuredText. Please see the style guide for reStructuredText formatting guidelines for:
|
||||
* header notation
|
||||
* internal navigation
|
||||
* linking
|
||||
* local table of contents
|
||||
|
||||
|
||||
Tools
|
||||
=====
|
||||
|
||||
The Ansible community provides resources on tools used to write, test, and build documentation. In this section you will find some helpful links and workflow recommendations to get started writing or editing documentation.
|
||||
|
||||
Popular editors
|
||||
---------------
|
||||
The Ansible community uses a range of tools for working with the Ansible project. Find a list of some of the most popular of these tools [here](https://docs.ansible.com/ansible/latest/community/other_tools_and_programs.html#popular-editors).
|
||||
|
||||
Building documentation
|
||||
----------------------
|
||||
Building the documentation is the best way to check for errors and review your changes. Ansible documentation is built using Sphinx. For resources on Sphinx and building documentation, see [building the documentation locally](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html#building-the-documentation-locally) in the Ansible Community Guide.
|
||||
|
||||
Github
|
||||
------
|
||||
[Ansible documentation](https://github.com/ansible/ansible/tree/devel/docs/docsite) is hosted on the Ansible Github project.
|
||||
|
||||
The following sections describe the workflows required to start developing or submit changes to Ansible documentation.
|
||||
|
||||
|
||||
To install sphinx and the required theme, install ``pip`` and then ``pip install sphinx sphinx_rtd_theme``
|
||||
## Setting up Git
|
||||
|
||||
[file issues]: https://github.com/ansible/ansible/issues
|
||||
[module-docs]: https://docs.ansible.com/developing_modules.html#documenting-your-module
|
||||
|
||||
HEADERS
|
||||
=======
|
||||
GitHub provides a set of [Git cheatsheets](https://github.github.com/training-kit/) in multiple languages.
|
||||
|
||||
RST allows for arbitrary hierarchy for the headers, it will 'learn on the fly'. We also want a standard that all our documents can follow:
|
||||
1. First [Install Git](https://help.github.com/en/articles/set-up-git)
|
||||
|
||||
2. Perform the initial Git setup tasks, as described in [First Time Git Setup](link:https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup).
|
||||
|
||||
3. Navigate to https://github.com/ansible/ansible and [create a fork](https://help.github.com/en/articles/fork-a-repo). This will create your own version of the repository which you can find at https://github.com/{yourusername}/ansible where {yourusername} is the username you created in GitHub.
|
||||
|
||||
4. [Clone](https://help.github.com/en/articles/cloning-a-repository) from your fork to create a copy on your local machine.
|
||||
|
||||
NOTE: It is possible to clone using SSH so you don't have to enter a username/password every time you push. Find instructions at [Connecting to GitHub with SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) and [Which Remote URL Should I Use](https://help.github.com/articles/which-remote-url-should-i-use/). When using SSH, the origin lines will appear like this:
|
||||
`git@github.com:{yourusername}/ansible.git`
|
||||
|
||||
|
||||
```
|
||||
$ git clone git@github.com:{yourusername}/ansible.git
|
||||
```
|
||||
##########################
|
||||
# with overline, for parts
|
||||
##########################
|
||||
|
||||
*****************************
|
||||
* with overline, for chapters
|
||||
*****************************
|
||||
5. Navigate to the new directory by entering the following from the command line on your local machine:
|
||||
```
|
||||
$ cd {repository-name}
|
||||
```
|
||||
|
||||
=, for sections
|
||||
===============
|
||||
6. Add a git remote to your local repository to link to the upstream version of the documentation. This makes it easier to update your fork and local version of the documentation.
|
||||
```
|
||||
$ git remote add upstream git://github.com/ansible/ansible.git
|
||||
```
|
||||
|
||||
-, for subsections
|
||||
------------------
|
||||
7. Check your settings.
|
||||
```
|
||||
$ git remote -v
|
||||
origin https://github.com/{YOUR_USERNAME}/{YOUR_FORK}.git (fetch)
|
||||
origin https://github.com/{YOUR_USERNAME}/{YOUR_FORK}.git (push)
|
||||
upstream https://github.com/{ORIGINAL_OWNER}/{ORIGINAL_REPOSITORY}.git (fetch)
|
||||
upstream https://github.com/{ORIGINAL_OWNER}/{ORIGINAL_REPOSITORY}.git (push)
|
||||
```
|
||||
|
||||
^, for sub-subsections
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
## Creating a topic branch
|
||||
|
||||
", for paragraphs
|
||||
"""""""""""""""""
|
||||
Create a topic branch for new documentation submissions or larger changes.
|
||||
|
||||
1. Fetch updates from ``origin``:
|
||||
```
|
||||
$ git fetch origin
|
||||
```
|
||||
2. Checkout a new branch based on ``devel``:
|
||||
```
|
||||
$ git checkout -b {branch name}
|
||||
```
|
||||
3. Create new documents or make changes to existing files.
|
||||
4. Add new or changed files:
|
||||
```
|
||||
$ git add {file name}
|
||||
```
|
||||
5. Commit your changes or additions. Be sure to include a commit message:
|
||||
```
|
||||
$ git commit -m "new message"
|
||||
```
|
||||
6. Push your updates back to `origin`:
|
||||
```
|
||||
$ git push -u origin {branch name}
|
||||
```
|
||||
|
||||
Once you have completed this workflow, it is a good idea to build the documentation and ensure everything is correct and that it works. As a contributor, you are required to prove that See [building the documentation locally](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html#building-the-documentation-locally) in the Ansible Community Guide for more on building documentation.
|
||||
|
||||
|
||||
When final additions or changes are pushed back to your fork you can open a pull request (PR).
|
||||
|
||||
|
||||
Working with pull requests (PRs)
|
||||
--------------------------------
|
||||
Pull requests represent the stage in a contribution where you are ready to submit your work for review and inclusion in the documentation. When a PR is opened, a reviewer will check the work and potentially open a dialog around your proposed changes. PRs should include specific information, which you can find in [Opening a new issue and/or PR](https://docs.ansible.com/ansible/latest/community/documentation_contributions.html#opening-a-new-issue-and-or-pr) in the Ansible Community Guide.
|
||||
|
||||
## Creating a pull request
|
||||
1. Navigate to your personal fork: https://github.com/{yourusername}/ansible
|
||||
2. Click **Pull requests** and then click **New pull requests**.
|
||||
3. Use the drop-down menus, set the **base repository** to the stable branch and set the **head repository** to your topic branch.
|
||||
4. Apply appropriate labels. Include **backport** and **documentation**.
|
||||
6. Fill in the PR summary using the following template:
|
||||
|
||||
```
|
||||
##### SUMMARY
|
||||
|
||||
##### ISSUE TYPE
|
||||
|
||||
##### COMPONENT NAME
|
||||
docs.ansible.com
|
||||
##### ANSIBLE VERSION
|
||||
|
||||
##### ADDITIONAL INFORMATION
|
||||
|
||||
```
|
||||
NOTE:
|
||||
If you put 'closes <issuenumber> ' in the summary, ansible will automatically close the issue on merge.
|
||||
|
||||
7. Click **Create pull request**.
|
||||
|
||||
|
||||
A reviewer will evaluate your contribution. They may open a dialog around the PR and suggest revisions or, if the PR meets acceptance criteria, will merge it to the base branch.
|
||||
|
||||
## Backporting a pull request
|
||||
|
||||
All Ansible PRs must be merged to the `devel` branch first. Most users may, however, use a prior stable branch. Evaluate your pull request to determine if it applies to a prior branch.
|
||||
|
||||
See [Backporting merged PRs](https://docs.ansible.com/ansible/devel/community/development_process.html?highlight=backport#backporting-merged-prs) for a complete worklfow.
|
||||
|
||||
## Other Git workflows
|
||||
|
||||
We do have pages littered with ```````` headers, but those should be removed for one of the above.
|
||||
In addition to creating a pull request and backporting, other workflows exist to help keep your topic branches and pull requests up-to-date. See the [Developer Guide](https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html) on `git rebase` to learn more about rebasing a pull request.
|
||||
|
@ -1,11 +0,0 @@
|
||||
.. _creating_collections_galaxy:
|
||||
|
||||
*******************************
|
||||
Creating collections for Galaxy
|
||||
*******************************
|
||||
|
||||
|
||||
Collections are a distribution format for Ansible content. You can use collections to package and distribute playbooks, roles, modules, and plugins.
|
||||
You can publish and use collections through `Ansible Galaxy <https://galaxy.ansible.com>`_.
|
||||
|
||||
See :ref:`developing_collections` for details on how to create collections.
|
@ -1,20 +0,0 @@
|
||||
.. _developing_galaxy:
|
||||
|
||||
***************
|
||||
Developer Guide
|
||||
***************
|
||||
|
||||
You can host collections and roles on Galaxy to share with the Ansible community. Galaxy content is formated in pre-packaged units of work such as `roles <playbooks_reuse_roles>`_, and new in Galaxy 3.2, `collections <collections>`_.
|
||||
You can create roles for provisioning infrastructure, deploying applications, and all of the tasks you do everyday. Taking this a step further, you can create collections which provide a comprehensive package of automation that may include multiple playbooks, roles, modules, and plugins.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
creating_collections
|
||||
creating_roles
|
||||
|
||||
.. seealso::
|
||||
`collections <collections>`_
|
||||
Sharable collections of modules, playbooks and roles
|
||||
`roles <playbooks_reuse_roles>`_
|
||||
Reusable tasks, handlers, and other files in a known directory structure
|
@ -0,0 +1,391 @@
|
||||
.. _using_galaxy:
|
||||
.. _ansible_galaxy:
|
||||
|
||||
*****************
|
||||
Galaxy User Guide
|
||||
*****************
|
||||
|
||||
:dfn:`Ansible Galaxy` refers to the `Galaxy <https://galaxy.ansible.com>`_ website, a free site for finding, downloading, and sharing community developed roles.
|
||||
|
||||
Use Galaxy to jump-start your automation project with great content from the Ansible community. Galaxy provides pre-packaged units of work such as `roles <playbooks_reuse_roles>`_, and new in Galaxy 3.2, `collections <collections>`_.
|
||||
You can find roles for provisioning infrastructure, deploying applications, and all of the tasks you do everyday. The collection format provides a comprehensive package of automation that may include multiple playbooks, roles, modules, and plugins.
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 2
|
||||
.. _finding_galaxy_collections:
|
||||
|
||||
Finding collections on Galaxy
|
||||
=============================
|
||||
|
||||
To find collections on Galaxy:
|
||||
|
||||
#. Click the :guilabel:`Search` icon in the left-hand navigation.
|
||||
#. Set the filter to *collection*.
|
||||
#. Set other filters and press :guilabel:`enter`.
|
||||
|
||||
Galaxy presents a list of collections that match your search criteria.
|
||||
|
||||
.. _installing_galaxy_collections:
|
||||
|
||||
Installing collections from Galaxy
|
||||
==================================
|
||||
|
||||
.. include:: ../shared_snippets/installing_collections.txt
|
||||
|
||||
|
||||
Installing an older version of a collection
|
||||
-------------------------------------------
|
||||
|
||||
.. include:: ../shared_snippets/installing_older_collection.txt
|
||||
|
||||
Install multiple collections with a requirements file
|
||||
-----------------------------------------------------
|
||||
|
||||
.. include:: ../shared_snippets/installing_multiple_collections.txt
|
||||
|
||||
Galaxy server configuration list
|
||||
--------------------------------
|
||||
|
||||
.. include:: ../shared_snippets/galaxy_server_list.txt
|
||||
|
||||
|
||||
.. _finding_galaxy_roles:
|
||||
|
||||
Finding roles on Galaxy
|
||||
=======================
|
||||
|
||||
Search the Galaxy database by tags, platforms, author and multiple keywords. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy search elasticsearch --author geerlingguy
|
||||
|
||||
The search command will return a list of the first 1000 results matching your search:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Found 2 roles matching your search:
|
||||
|
||||
Name Description
|
||||
---- -----------
|
||||
geerlingguy.elasticsearch Elasticsearch for Linux.
|
||||
geerlingguy.elasticsearch-curator Elasticsearch curator for Linux.
|
||||
|
||||
|
||||
Get more information about a role
|
||||
---------------------------------
|
||||
|
||||
Use the ``info`` command to view more detail about a specific role:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy info username.role_name
|
||||
|
||||
This returns everything found in Galaxy for the role:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Role: username.role_name
|
||||
description: Installs and configures a thing, a distributed, highly available NoSQL thing.
|
||||
active: True
|
||||
commit: c01947b7bc89ebc0b8a2e298b87ab416aed9dd57
|
||||
commit_message: Adding travis
|
||||
commit_url: https://github.com/username/repo_name/commit/c01947b7bc89ebc0b8a2e298b87ab
|
||||
company: My Company, Inc.
|
||||
created: 2015-12-08T14:17:52.773Z
|
||||
download_count: 1
|
||||
forks_count: 0
|
||||
github_branch:
|
||||
github_repo: repo_name
|
||||
github_user: username
|
||||
id: 6381
|
||||
is_valid: True
|
||||
issue_tracker_url:
|
||||
license: Apache
|
||||
min_ansible_version: 1.4
|
||||
modified: 2015-12-08T18:43:49.085Z
|
||||
namespace: username
|
||||
open_issues_count: 0
|
||||
path: /Users/username/projects/roles
|
||||
scm: None
|
||||
src: username.repo_name
|
||||
stargazers_count: 0
|
||||
travis_status_url: https://travis-ci.org/username/repo_name.svg?branch=master
|
||||
version:
|
||||
watchers_count: 1
|
||||
|
||||
|
||||
.. _installing_galaxy_roles:
|
||||
|
||||
Installing roles from Galaxy
|
||||
============================
|
||||
|
||||
The ``ansible-galaxy`` command comes bundled with Ansible, and you can use it to install roles from Galaxy or directly from a git based SCM. You can
|
||||
also use it to create a new role, remove roles, or perform tasks on the Galaxy website.
|
||||
|
||||
The command line tool by default communicates with the Galaxy website API using the server address *https://galaxy.ansible.com*. Since the `Galaxy project <https://github.com/ansible/galaxy>`_
|
||||
is an open source project, you may be running your own internal Galaxy server and wish to override the default server address. You can do this using the *--server* option
|
||||
or by setting the Galaxy server value in your *ansible.cfg* file. For information on setting the value in *ansible.cfg* see :ref:`galaxy_server`.
|
||||
|
||||
|
||||
Installing roles
|
||||
----------------
|
||||
|
||||
Use the ``ansible-galaxy`` command to download roles from the `Galaxy website <https://galaxy.ansible.com>`_
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install namespace.role_name
|
||||
|
||||
Setting where to install roles
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
By default, Ansible downloads roles to the first writable directory in the default list of paths ``~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles``. This installs roles in the home directory of the user running ``ansible-galaxy``.
|
||||
|
||||
You can override this with one of the following options:
|
||||
|
||||
* Set the environment variable :envvar:`ANSIBLE_ROLES_PATH` in your session.
|
||||
* Define ``roles_path`` in an ``ansible.cfg`` file.
|
||||
* Use the ``--roles-path`` option for the ``ansible-galaxy`` command.
|
||||
|
||||
The following provides an example of using ``--roles-path`` to install the role into the current working directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install --roles-path . geerlingguy.apache
|
||||
|
||||
.. seealso::
|
||||
|
||||
:ref:`intro_configuration`
|
||||
All about configuration files
|
||||
|
||||
Installing a specific version of a role
|
||||
---------------------------------------
|
||||
|
||||
When the Galaxy server imports a role, it imports any git tags matching the Semantic Version format as versions. In turn, you can download a specific version of a role by specifying one of the imported tags.
|
||||
|
||||
To see the available versions for a role:
|
||||
|
||||
#. Locate the role on the Galaxy search page.
|
||||
#. Click on the name to view more details, including the available versions.
|
||||
|
||||
You can also navigate directly to the role using the /<namespace>/<role name>. For example, to view the role geerlingguy.apache, go to `<https://galaxy.ansible.com/geerlingguy/apache>`_.
|
||||
|
||||
To install a specific version of a role from Galaxy, append a comma and the value of a GitHub release tag. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install geerlingguy.apache,v1.0.0
|
||||
|
||||
It is also possible to point directly to the git repository and specify a branch name or commit hash as the version. For example, the following will
|
||||
install a specific commit:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install git+https://github.com/geerlingguy/ansible-role-apache.git,0b7cd353c0250e87a26e0499e59e7fd265cc2f25
|
||||
|
||||
Installing multiple roles from a file
|
||||
-------------------------------------
|
||||
|
||||
You can install multiple roles by including the roles in a :file:`requirements.yml` file. The format of the file is YAML, and the
|
||||
file extension must be either *.yml* or *.yaml*.
|
||||
|
||||
Use the following command to install roles included in :file:`requirements.yml:`
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install -r requirements.yml
|
||||
|
||||
Again, the extension is important. If the *.yml* extension is left off, the ``ansible-galaxy`` CLI assumes the file is in an older, now deprecated,
|
||||
"basic" format.
|
||||
|
||||
Each role in the file will have one or more of the following attributes:
|
||||
|
||||
src
|
||||
The source of the role. Use the format *namespace.role_name*, if downloading from Galaxy; otherwise, provide a URL pointing
|
||||
to a repository within a git based SCM. See the examples below. This is a required attribute.
|
||||
scm
|
||||
Specify the SCM. As of this writing only *git* or *hg* are allowed. See the examples below. Defaults to *git*.
|
||||
version:
|
||||
The version of the role to download. Provide a release tag value, commit hash, or branch name. Defaults to the branch set as a default in the repository, otherwise defaults to the *master*.
|
||||
name:
|
||||
Download the role to a specific name. Defaults to the Galaxy name when downloading from Galaxy, otherwise it defaults
|
||||
to the name of the repository.
|
||||
|
||||
Use the following example as a guide for specifying roles in *requirements.yml*:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# from galaxy
|
||||
- src: yatesr.timezone
|
||||
|
||||
# from GitHub
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
|
||||
# from GitHub, overriding the name and specifying a specific tag
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
version: master
|
||||
name: nginx_role
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.gz
|
||||
- src: https://some.webserver.example.com/files/master.tar.gz
|
||||
name: http-role-gz
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.bz2
|
||||
- src: https://some.webserver.example.com/files/master.tar.bz2
|
||||
name: http-role-bz2
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.xz (Python 3.x only)
|
||||
- src: https://some.webserver.example.com/files/master.tar.xz
|
||||
name: http-role-xz
|
||||
|
||||
# from Bitbucket
|
||||
- src: git+https://bitbucket.org/willthames/git-ansible-galaxy
|
||||
version: v1.4
|
||||
|
||||
# from Bitbucket, alternative syntax and caveats
|
||||
- src: https://bitbucket.org/willthames/hg-ansible-galaxy
|
||||
scm: hg
|
||||
|
||||
# from GitLab or other git-based scm, using git+ssh
|
||||
- src: git@gitlab.company.com:mygroup/ansible-base.git
|
||||
scm: git
|
||||
version: "0.1" # quoted, so YAML doesn't parse this as a floating-point value
|
||||
|
||||
Installing multiple roles from multiple files
|
||||
---------------------------------------------
|
||||
|
||||
For large projects, the ``include`` directive in a :file:`requirements.yml` file provides the ability to split a large file into multiple smaller files.
|
||||
|
||||
For example, a project may have a :file:`requirements.yml` file, and a :file:`webserver.yml` file.
|
||||
|
||||
Below are the contents of the :file:`webserver.yml` file:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# from github
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
|
||||
# from Bitbucket
|
||||
- src: git+http://bitbucket.org/willthames/git-ansible-galaxy
|
||||
version: v1.4
|
||||
|
||||
The following shows the contents of the :file:`requirements.yml` file that now includes the :file:`webserver.yml` file:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# from galaxy
|
||||
- src: yatesr.timezone
|
||||
- include: <path_to_requirements>/webserver.yml
|
||||
|
||||
To install all the roles from both files, pass the root file, in this case :file:`requirements.yml` on the
|
||||
command line, as follows:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install -r requirements.yml
|
||||
|
||||
.. _galaxy_dependencies:
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
Roles can also be dependent on other roles, and when you install a role that has dependencies, those dependencies will automatically be installed.
|
||||
|
||||
You specify role dependencies in the ``meta/main.yml`` file by providing a list of roles. If the source of a role is Galaxy, you can simply specify the role in
|
||||
the format ``namespace.role_name``. You can also use the more complex format in ``requirements.yml``, allowing you to provide ``src``, ``scm``, ``version``, and ``name``.
|
||||
|
||||
The following shows an example ``meta/main.yml`` file with dependent roles:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
dependencies:
|
||||
- geerlingguy.java
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
description: Elasticsearch for Linux.
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.4
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- web
|
||||
- system
|
||||
- monitoring
|
||||
- logging
|
||||
- lucene
|
||||
- elk
|
||||
- elasticsearch
|
||||
|
||||
Tags are inherited *down* the dependency chain. In order for tags to be applied to a role and all its dependencies, the tag should be applied to the role, not to all the tasks within a role.
|
||||
|
||||
Roles listed as dependencies are subject to conditionals and tag filtering, and may not execute fully depending on
|
||||
what tags and conditionals are applied.
|
||||
|
||||
If the source of a role is Galaxy, specify the role in the format *namespace.role_name*:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
dependencies:
|
||||
- geerlingguy.apache
|
||||
- geerlingguy.ansible
|
||||
|
||||
|
||||
Alternately, you can specify the role dependencies in the complex form used in :file:`requirements.yml` as follows:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
dependencies:
|
||||
- src: geerlingguy.ansible
|
||||
- src: git+https://github.com/geerlingguy/ansible-role-composer.git
|
||||
version: 775396299f2da1f519f0d8885022ca2d6ee80ee8
|
||||
name: composer
|
||||
|
||||
When dependencies are encountered by ``ansible-galaxy``, it will automatically install each dependency to the ``roles_path``. To understand how dependencies are handled during play execution, see :ref:`playbooks_reuse_roles`.
|
||||
|
||||
.. note::
|
||||
|
||||
Galaxy expects all role dependencies to exist in Galaxy, and therefore dependencies to be specified in the
|
||||
``namespace.role_name`` format. If you import a role with a dependency where the ``src`` value is a URL, the import process will fail.
|
||||
|
||||
List installed roles
|
||||
--------------------
|
||||
|
||||
Use ``list`` to show the name and version of each role installed in the *roles_path*.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy list
|
||||
- ansible-network.network-engine, v2.7.2
|
||||
- ansible-network.config_manager, v2.6.2
|
||||
- ansible-network.cisco_nxos, v2.7.1
|
||||
- ansible-network.vyos, v2.7.3
|
||||
- ansible-network.cisco_ios, v2.7.0
|
||||
|
||||
Remove an installed role
|
||||
------------------------
|
||||
|
||||
Use ``remove`` to delete a role from *roles_path*:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy remove namespace.role_name
|
||||
|
||||
|
||||
.. seealso::
|
||||
`collections <collections>`_
|
||||
Sharable collections of modules, playbooks and roles
|
||||
`roles <playbooks_reuse_roles>`_
|
||||
Reusable tasks, handlers, and other files in a known directory structure
|
@ -1,14 +0,0 @@
|
||||
|
||||
.. _finding_galaxy_collections:
|
||||
|
||||
*****************************
|
||||
Finding collections on Galaxy
|
||||
*****************************
|
||||
|
||||
To find collections on Galaxy:
|
||||
|
||||
#. Click the :guilabel:`Search` icon in the left-hand navigation.
|
||||
#. Set the filter to *collection*.
|
||||
#. Set other filters and press *enter*.
|
||||
|
||||
Galaxy presents a list of collections that match your search criteria.
|
@ -1,66 +0,0 @@
|
||||
|
||||
.. _finding_galaxy_roles:
|
||||
|
||||
*************************
|
||||
Finding roles on Galaxy
|
||||
*************************
|
||||
|
||||
Search the Galaxy database by tags, platforms, author and multiple keywords. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy search elasticsearch --author geerlingguy
|
||||
|
||||
The search command will return a list of the first 1000 results matching your search:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Found 2 roles matching your search:
|
||||
|
||||
Name Description
|
||||
---- -----------
|
||||
geerlingguy.elasticsearch Elasticsearch for Linux.
|
||||
geerlingguy.elasticsearch-curator Elasticsearch curator for Linux.
|
||||
|
||||
|
||||
Get more information about a role
|
||||
=================================
|
||||
|
||||
Use the ``info`` command to view more detail about a specific role:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy info username.role_name
|
||||
|
||||
This returns everything found in Galaxy for the role:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Role: username.role_name
|
||||
description: Installs and configures a thing, a distributed, highly available NoSQL thing.
|
||||
active: True
|
||||
commit: c01947b7bc89ebc0b8a2e298b87ab416aed9dd57
|
||||
commit_message: Adding travis
|
||||
commit_url: https://github.com/username/repo_name/commit/c01947b7bc89ebc0b8a2e298b87ab
|
||||
company: My Company, Inc.
|
||||
created: 2015-12-08T14:17:52.773Z
|
||||
download_count: 1
|
||||
forks_count: 0
|
||||
github_branch:
|
||||
github_repo: repo_name
|
||||
github_user: username
|
||||
id: 6381
|
||||
is_valid: True
|
||||
issue_tracker_url:
|
||||
license: Apache
|
||||
min_ansible_version: 1.4
|
||||
modified: 2015-12-08T18:43:49.085Z
|
||||
namespace: username
|
||||
open_issues_count: 0
|
||||
path: /Users/username/projects/roles
|
||||
scm: None
|
||||
src: username.repo_name
|
||||
stargazers_count: 0
|
||||
travis_status_url: https://travis-ci.org/username/repo_name.svg?branch=master
|
||||
version:
|
||||
watchers_count: 1
|
@ -1,26 +0,0 @@
|
||||
.. _using_galaxy:
|
||||
.. _ansible_galaxy:
|
||||
|
||||
**********
|
||||
User Guide
|
||||
**********
|
||||
|
||||
:dfn:`Ansible Galaxy` refers to the `Galaxy <https://galaxy.ansible.com>`_ website, a free site for finding, downloading, and sharing community developed roles.
|
||||
|
||||
Use Galaxy to jump-start your automation project with great content from the Ansible community. Galaxy provides pre-packaged units of work such as `roles <playbooks_reuse_roles>`_, and new in Galaxy 3.2, `collections <collections>`_.
|
||||
You can find roles for provisioning infrastructure, deploying applications, and all of the tasks you do everyday. The collection format provides a comprehensive package of automation that may include multiple playbooks, roles, modules, and plugins.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
finding_collections
|
||||
finding_roles
|
||||
installing_collections
|
||||
installing_roles
|
||||
|
||||
|
||||
.. seealso::
|
||||
`collections <collections>`_
|
||||
Sharable collections of modules, playbooks and roles
|
||||
`roles <playbooks_reuse_roles>`_
|
||||
Reusable tasks, handlers, and other files in a known directory structure
|
@ -1,22 +0,0 @@
|
||||
.. _installing_galaxy_collections:
|
||||
|
||||
Installing collections from Galaxy
|
||||
==================================
|
||||
|
||||
.. include:: ../../shared_snippets/installing_collections.txt
|
||||
|
||||
|
||||
Installing an older version of a collection
|
||||
-------------------------------------------
|
||||
|
||||
.. include:: ../../shared_snippets/installing_older_collection.txt
|
||||
|
||||
Install multiple collections with a requirements file
|
||||
-----------------------------------------------------
|
||||
|
||||
.. include:: ../../shared_snippets/installing_multiple_collections.txt
|
||||
|
||||
Galaxy server configuration list
|
||||
--------------------------------
|
||||
|
||||
.. include:: ../../shared_snippets/galaxy_server_list.txt
|
@ -1,218 +0,0 @@
|
||||
Installing roles from Galaxy
|
||||
============================
|
||||
|
||||
The ``ansible-galaxy`` command comes bundled with Ansible, and you can use it to install roles from Galaxy or directly from a git based SCM. You can
|
||||
also use it to create a new role, remove roles, or perform tasks on the Galaxy website.
|
||||
|
||||
The command line tool by default communicates with the Galaxy website API using the server address *https://galaxy.ansible.com*. Since the `Galaxy project <https://github.com/ansible/galaxy>`_
|
||||
is an open source project, you may be running your own internal Galaxy server and wish to override the default server address. You can do this using the *--server* option
|
||||
or by setting the Galaxy server value in your *ansible.cfg* file. For information on setting the value in *ansible.cfg* see :ref:`galaxy_server`.
|
||||
|
||||
|
||||
Installing Roles
|
||||
----------------
|
||||
|
||||
Use the ``ansible-galaxy`` command to download roles from the `Galaxy website <https://galaxy.ansible.com>`_
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install username.role_name
|
||||
|
||||
roles_path
|
||||
^^^^^^^^^^
|
||||
|
||||
By default Ansible downloads roles to the first writable directory in the default list of paths ``~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles``. This will install roles in the home directory of the user running ``ansible-galaxy``.
|
||||
|
||||
You can override this by setting the environment variable :envvar:`ANSIBLE_ROLES_PATH` in your session, defining ``roles_path`` in an ``ansible.cfg`` file, or by using the ``--roles-path`` option.
|
||||
|
||||
The following provides an example of using ``--roles-path`` to install the role into the current working directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install --roles-path . geerlingguy.apache
|
||||
|
||||
.. seealso::
|
||||
|
||||
:ref:`intro_configuration`
|
||||
All about configuration files
|
||||
|
||||
Installing a specific version of a role
|
||||
---------------------------------------
|
||||
|
||||
You can install a specific version of a role from Galaxy by appending a comma and the value of a GitHub release tag. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install geerlingguy.apache,v1.0.0
|
||||
|
||||
It's also possible to point directly to the git repository and specify a branch name or commit hash as the version. For example, the following will
|
||||
install a specific commit:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install git+https://github.com/geerlingguy/ansible-role-apache.git,0b7cd353c0250e87a26e0499e59e7fd265cc2f25
|
||||
|
||||
|
||||
Installing multiple roles from a file
|
||||
-------------------------------------
|
||||
|
||||
Beginning with Ansible 1.8 it is possible to install multiple roles by including the roles in a *requirements.yml* file. The format of the file is YAML, and the
|
||||
file extension must be either *.yml* or *.yaml*.
|
||||
|
||||
Use the following command to install roles included in *requirements.yml*:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy install -r requirements.yml
|
||||
|
||||
Again, the extension is important. If the *.yml* extension is left off, the ``ansible-galaxy`` CLI assumes the file is in an older, now deprecated,
|
||||
"basic" format.
|
||||
|
||||
Each role in the file will have one or more of the following attributes:
|
||||
|
||||
src
|
||||
The source of the role. Use the format *username.role_name*, if downloading from Galaxy; otherwise, provide a URL pointing
|
||||
to a repository within a git based SCM. See the examples below. This is a required attribute.
|
||||
scm
|
||||
Specify the SCM. As of this writing only *git* or *hg* are allowed. See the examples below. Defaults to *git*.
|
||||
version:
|
||||
The version of the role to download. Provide a release tag value, commit hash, or branch name. Defaults to the branch set as a default in the repository, otherwise defaults to the *master*.
|
||||
name:
|
||||
Download the role to a specific name. Defaults to the Galaxy name when downloading from Galaxy, otherwise it defaults
|
||||
to the name of the repository.
|
||||
|
||||
Use the following example as a guide for specifying roles in *requirements.yml*:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
# from galaxy
|
||||
- src: yatesr.timezone
|
||||
|
||||
# from GitHub
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
|
||||
# from GitHub, overriding the name and specifying a specific tag
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
version: master
|
||||
name: nginx_role
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.gz
|
||||
- src: https://some.webserver.example.com/files/master.tar.gz
|
||||
name: http-role-gz
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.bz2
|
||||
- src: https://some.webserver.example.com/files/master.tar.bz2
|
||||
name: http-role-bz2
|
||||
|
||||
# from a webserver, where the role is packaged in a tar.xz (Python 3.x only)
|
||||
- src: https://some.webserver.example.com/files/master.tar.xz
|
||||
name: http-role-xz
|
||||
|
||||
# from Bitbucket
|
||||
- src: git+https://bitbucket.org/willthames/git-ansible-galaxy
|
||||
version: v1.4
|
||||
|
||||
# from Bitbucket, alternative syntax and caveats
|
||||
- src: https://bitbucket.org/willthames/hg-ansible-galaxy
|
||||
scm: hg
|
||||
|
||||
# from GitLab or other git-based scm, using git+ssh
|
||||
- src: git@gitlab.company.com:mygroup/ansible-base.git
|
||||
scm: git
|
||||
version: "0.1" # quoted, so YAML doesn't parse this as a floating-point value
|
||||
|
||||
Installing multiple roles from multiple files
|
||||
---------------------------------------------
|
||||
|
||||
At a basic level, including requirements files allows you to break up bits of roles into smaller files. Role includes pull in roles from other files.
|
||||
|
||||
Use the following command to install roles includes in *requirements.yml* + *webserver.yml*
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ansible-galaxy install -r requirements.yml
|
||||
|
||||
Content of the *requirements.yml* file:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
# from galaxy
|
||||
- src: yatesr.timezone
|
||||
|
||||
- include: <path_to_requirements>/webserver.yml
|
||||
|
||||
|
||||
Content of the *webserver.yml* file:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
# from github
|
||||
- src: https://github.com/bennojoy/nginx
|
||||
|
||||
# from Bitbucket
|
||||
- src: git+https://bitbucket.org/willthames/git-ansible-galaxy
|
||||
version: v1.4
|
||||
|
||||
.. _galaxy_dependencies:
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
Roles can also be dependent on other roles, and when you install a role that has dependencies, those dependencies will automatically be installed.
|
||||
|
||||
You specify role dependencies in the ``meta/main.yml`` file by providing a list of roles. If the source of a role is Galaxy, you can simply specify the role in
|
||||
the format ``username.role_name``. You can also use the more complex format in ``requirements.yml``, allowing you to provide ``src``, ``scm``, ``version``, and ``name``.
|
||||
|
||||
Tags are inherited *down* the dependency chain. In order for tags to be applied to a role and all its dependencies, the tag should be applied to the role, not to all the tasks within a role.
|
||||
|
||||
Roles listed as dependencies are subject to conditionals and tag filtering, and may not execute fully depending on
|
||||
what tags and conditionals are applied.
|
||||
|
||||
Dependencies found in Galaxy can be specified as follows:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
dependencies:
|
||||
- geerlingguy.apache
|
||||
- geerlingguy.ansible
|
||||
|
||||
|
||||
The complex form can also be used as follows:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
dependencies:
|
||||
- src: geerlingguy.ansible
|
||||
- src: git+https://github.com/geerlingguy/ansible-role-composer.git
|
||||
version: 775396299f2da1f519f0d8885022ca2d6ee80ee8
|
||||
name: composer
|
||||
|
||||
When dependencies are encountered by ``ansible-galaxy``, it will automatically install each dependency to the ``roles_path``. To understand how dependencies are handled during play execution, see :ref:`playbooks_reuse_roles`.
|
||||
|
||||
.. note::
|
||||
|
||||
At the time of this writing, the Galaxy website expects all role dependencies to exist in Galaxy, and therefore dependencies to be specified in the
|
||||
``username.role_name`` format. If you import a role with a dependency where the ``src`` value is a URL, the import process will fail.
|
||||
|
||||
List installed roles
|
||||
--------------------
|
||||
|
||||
Use ``list`` to show the name and version of each role installed in the *roles_path*.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy list
|
||||
|
||||
- chouseknecht.role-install_mongod, master
|
||||
- chouseknecht.test-role-1, v1.0.2
|
||||
- chrismeyersfsu.role-iptables, master
|
||||
- chrismeyersfsu.role-required_vars, master
|
||||
|
||||
Remove an installed role
|
||||
------------------------
|
||||
|
||||
Use ``remove`` to delete a role from *roles_path*:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ ansible-galaxy remove username.role_name
|
Loading…
Reference in New Issue