Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Module Install Use Cases

Chris Houseknecht edited this page Apr 30, 2018 · 13 revisions

Summary

In this scenario, the repository contains multiple content types, including several modules. Examples are based on atestuseraccount/galaxy-test-role.

Assumptions

  • ANSIBLE_ROLES_PATH is not set in the environment
  • ANSIBLE_GALAXY_CONTENT_PATH is not set in the environment
  • Neither roles_path nor galaxy_content_path is set in ansible.cfg
  • Based on the above settings, roles will be installed to the default content path of ~/.ansible/content
  • Before each command is executed, the modules subdirectory within the content path is empty
  • Version is an SCM tag on the repository level
  • Modules are found in the root level library directory of the source repository
  • The repository does not contain an ansible-galaxy.yml metadata file

Install all modules

Commands

The following command uses the Galaxy name to install the latest version of all modules:

ansible-galaxy install -t module atestuseraccount.testing-content

The following command uses the SCM+URL convention to install the latest version of all modules:

ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git

Expected Results

  • All modules found in the repository tag 1.1.0 are installed, as pictured below.

  • The path to the installed modules is ~/.ansible/content/library/.

  • The contents of ~/.ansible/content/library/.galaxy_install_info contains an entry for each module, and the version of each is set to 1.1.0

~/.ansible/content/
    library/
        .galaxy_install_info
        elasticsearch_plugin.py
        kibana_plugin.py
        mysql_db.py
        mysql_replication.py
        mysql_user.py
        mysql_variable.py
        redis.py
        riak.py

Install a single module

Command

The following command uses the Galaxy name to install the latest version of a single module:

ansible-galaxy install -t module atestuseraccount.testing-content.elasticsearch_plugin.py

The following command uses the SCM+URL convention to install a specific modules:

ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,name=elasticsearch_plugin.py

Expected Results

  • The version of the module found in the repository tag 1.1.0 is installed, as pictured below.

  • The path to the installed modules is ~/.ansible/content/library/elasticsearch_plugin.py.

  • The contents of ~/.ansible/content/library/.galaxy_install_info contains an entry for the single module, with a version of 1.1.0

~/.ansible/content/
    library/
        .galaxy_install_info
        elasticsearch_plugin.py

Install a specific version of all modules

Commands

The following commands use the Galaxy name to install version 0.0.1 of all modules:

ansible-galaxy install -t module atestuseraccount.galaxy-test-role,0.0.1
ansible-galaxy install -t module atestuseraccount.galaxy-test-role,version=0.0.1

The following commands use the SCM+URL convention to install version 0.0.1 of all modules:

ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,0.0.1
ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,version=0.0.1

Expected Results

  • All modules found in the repository tag 0.0.1 are installed, as pictured below.

  • The path to the installed modules is ~/.ansible/content/library/.

  • The contents of ~/.ansible/content/library/.galaxy_install_info contains an entry for each module, and the version of each is set to 0.0.1

~/.ansible/content/
    library/
        .galaxy_install_info
        elasticsearch_plugin.py
        kibana_plugin.py
        mysql_db.py
        mysql_replication.py
        mysql_user.py
        mysql_variable.py
        redis.py
        riak.py

Install specific version of a single module

Command

The following commands use the Galaxy name to install version 0.0.1 of the elasticsearch_plugin.py module:

ansible-galaxy install -t module atestuseraccount.testing-content.elasticsearch_plugin.py,0.0.1
ansible-galaxy install -t module atestuseraccount.testing-content.elasticsearch_plugin.py,version=0.0.1

The following commands use the SCM+URL convention to install version 0.0.1 of the elasticsearch_plugin.py module:

ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,name=elasticsearch_plugin.py,0.0.1
ansible-galaxy install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,name=elasticsearch_plugin.py,version=0.0.1

Expected Results

  • The version of the module found in the repository tag 0.0.1 is installed, as pictured below.

  • The path to the installed modules is ~/.ansible/content/library/elasticsearch_plugin.py.

  • The contents of ~/.ansible/content/library/.galaxy_install_info contains an entry for the single module, with a version of 0.0.1

~/.ansible/content/
    library/
        .galaxy_install_info
        elasticsearch_plugin.py