Ansible Pilot

Download and Use Ansible Galaxy Collection - ansible-galaxy and requirements.yml

How to Download and use the Ansible Collection ansible.windows re-using Ansible artifacts (tasks, variables, defaults, handlers, modules, and plugins) published in Ansible Galaxy directory.

How to Download and Use Ansible Galaxy Role with ansible-galaxy and requirements.yml? I’m going to show you a live demo with some simple Ansible code. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

What is an Ansible Collection?

An Ansible Collection is a distribution format for Ansible content. It solves one problem and contains all the relevant contains the package and distributes playbooks, roles, modules, and plugins. For Users, the Ansible Collection is easy to download and share via Ansible Galaxy. For Developers the Ansible Collection is easy to upload and share via Ansible Galaxy. Plus an Ansible Collection has a defined standard directory structure and format.

What is Ansible Galaxy?

The website is available at the URL https://galaxy.ansible.com/. The search engine, Tags, and Platform make it easy to find any content inside. I recommend you carefully evaluate the quality of content before using it in your system. Quality indicators are usually the quality assurance of code, the supported operating systems and platforms, the documentation, the release numbers, the presence of Changelog, the number of downloads, and the author or creator. Please notice that the website contains Ansible Roles and Ansible Collections. Today we’re focusing on Ansible Role content.

demo

Let’s jump into a real-life How to Download and Use the Ansible Galaxy Collection ansible.windows.

code

---
- name: win_ping module demo
  hosts: all
  become: false
  gather_facts: false
  tasks:
    - name: test connection
      ansible.windows.win_ping:

---
collections:
  - name: ansible.windows
    source: https://galaxy.ansible.com

download execution


$ ansible-galaxy install -r galaxy/collection/requirements.yml
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/ansible-windows-1.9.0.tar.gz to /Users/lberton/.ansible/tmp/ansible-local-7011bzsrggn6/tmpjuw0c98f/ansible-windows-1.9.0-xt4y9ih0
Installing 'ansible.windows:1.9.0' to '/Users/lberton/.ansible/collections/ansible_collections/ansible/windows'
ansible.windows:1.9.0 was installed successfully

code with ❤️ in GitHub

Recap

Now you know how to Download and Use Ansible Galaxy Collection ansible.windows with Ansible. Subscribe to the YouTube channel, Medium, Website and Twitter to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

Want to keep this project going? Please donate

Trustpilot
Follow me

Subscribe not to miss any new releases

December 28, 2021

FREE Top 10 Best Practices

Top 10 Best Practices of Ansible Automation: save time, reduce errors and stress