Posts

Showing posts with the label ansible-galaxy

Ansible 5: Commands and their examples

Image
Hello Automation specialists, This post is for trying all the Ansible Command-line tools,  it's like a cheat sheet for ansible CLI with executed examples to better understand their usage. Ansible command-line utilities can be executed only on the box where the Ansible engine is installed and running. ansible  ansible command is used for define and run a single task 'playbook' against a set of hosts. ansible command is an extra-simple tool/framework/API for doing 'remote operations'.   Case 1: ansible -i inventory.yml all --list-hosts # all ansible -i inventory.yml dbserver --list-hosts #Specific group ansible -i inventory.yml common --list-hosts # same as all if inventory is yml Listing host using ansible command Case 2: # inventory set in the ansible.cfg ansible all --list-hosts # a group specific ansible web --list-hosts # checking for a specific host in a group ansible web --list-hosts -l 192.168.33.22...

Ansible Reusability with roles and ansible galaxy

Image
Ansible Roles In this post, I've gone thru multiple articles and YouTube videos on 'ansible roles', which helped me to understand into a deeper level of Ansible roles and galaxy site and CLI commands with various options. So, sharing here with you   What is role in Ansible? The role is the primary mechanism for breaking a playbook into multiple files. This simplifies writing complex playbooks, and it makes them easier to reuse.  Why should I use Roles in Ansible? The following are the reasons to work with roles Address complexity Reusability and sharing Modular code Learn how to build and create ansible roles to manage remote machines using an ansible configuration management tool.  For example let's create an apache role to install, configure and easy to manage the Apache web server using the roles.  Ansible Galaxy ansible roles structure Defining Ansible Roles are having major role in simplifying a larger playbook split into multiple small files called roles ...