Posts

Step by Step installation of Ansible Tower opensource version AWX

Image
Hello Guys, In this post, I would like to experiment with the installation of AWX on a new variety of Linux that is Alpine Linux. Prerequisites Here I will go with the Alpine Linux which is the default Operating System on  Play with  Docker  alternatively, You must have at least 3 boxes on either vagrant  or Any cloud instances (AWS) 1 Ansible engine remaining 2 for remote nodes AWX is GUI/web tool which is currently broken down to AWX-operator and AWX Task The AWX up to 18 version installations used docker based environments, where it uses the following Docker images from the Docker hub Postgress SQL Rabbit MQ MemCache Steps to install AWX 1. Update the repo on the Alpine Linux apk update 2. Installing with apk package manager 'add' subcommand will do the installation. apk add ansible This will be installing Ansible on Alpine Linux. Ansible installation on Play with Docker (PWD) instance   3. Validate the ansible installation using the version option. an...

Ansible the lineinfile, blockinfile and replace modules

Image
 Hello !! This post is for exploring the "lineinfile" vs 'blockinfile' and "replace" modules. The replace and the lineinfile use the path parameter to mark: The file to modify. lineinfile module is used to ensure[s] a particular line is in a file, or [to] replace an existing line using a back-referenced (backref) regular expression (regex). Use the replace module if you want to change multiple, similar lines The "dest" parameter is used for modules creating new files like template or copy modules. Just replace dest with path and both provided examples should work as expected. Adding lines in the file Adding a line in a file, if a file does not exist then it will create it. --- # Filename: adding_line.yml - name: testing LineInFile module hosts: localhost tasks: - name: Add a line to a file if the file does not exist lineinfile: path: /tmp/hosts line: 192.168.1.99 ansiblectl.devopshunter.com ctl cre...

How to run Ansible command when you don't have VM?

Image
 Hello Guys!! It's less than 5mins to read article There are different situations where you need to work but you have security restrictions, you cannot even run the vagrant boxes on your laptop. In such situations, If you are able to login to Docker Hub then you can play your playbooks for testing different modules which don't need to connect remotely to your managed nodes. That means you want to execute the module on the Ansible Controller node itself. Ansible container running on PWD (Play with Docker) Pre-requisites You must have a Docker Hub user account  You must have basic knowledge on Docker images, containers usage Good internet speed :) Steps to run Play with Docker  Step 1: Log in to your Docker Hub and launch the " Play with Docker " also known as PWD in short. Step 2: Create the Docker installed Nodes using "ADD NEW INSTANCE". Step 3: Search for the Ansible images either you can check at the command line with or search on the Docker H...

Ansible Comparison Membership Operators

Image
Hello everyone are you working on Ansible Automations?!!  This is post is for you to help, In this post you will find more interesting variable usages and their operations with different options such as comparison operators and membership operators. Comparison operators This is an example for Comparison operators --- # Filename: test_compare.yml - name: Comparison Operator example hosts: localhost gather_facts: false vars: a: "Vybhava" b: "Technologies" n: 100 m: 500 tasks: - debug: msg: - "This will compare numbers {{n}} and {{m}} " - " n == m: {{ n == m }}" - " n != m: {{ n != m }}" - " n > m: {{ n > m }}" - " n >= m: {{ n >= m }}" - " n <= m: {{ n <= m }}" - " n < m: {{ n < m }}" - "Compare Strings : a {{a}} and b {{b}}" - " a ==...

Ansible 11 The uri module with examples

Image
 Hey DevSecOps Automation specialist, Welcome back to the DevOps Hunter blog. In this post, I made it for learning more about all possible parameters that we can use when an application validation is done with the Ansible 'uri' module.  Why uri module? Web Application returns status HTTPCode 200 for success, 404 for failures, and also for 503 for Server internal issues. When you work on the restart of a web application we need to know the status of the application to proceed with the next move. So this uri module is most important for reboot and restart of web applications using ansible. The uri module parameters Supported parameters include: attributes, backup, body, body_format, client_cert, client_key, content, creates, delimiter, dest, directory_mode, follow, follow_redirects, force, force_basic_auth, group, headers, http_agent, method, mode, owner, regexp, remote_src, removes, return_content, selevel, serole, setype, seuser, src, status_code, timeout,...

Ansible 10 Shell vs Command module

Image
Hello DevSecOps Automation learners!! You can do wonders by learning Ansible Automations along with me. The Ansible can run the command module as default that is you don't need to mentioned with -m option for command. That means when you don't mention any module then it is working with the 'command module' Ansible Shell vs Command module Here we will execute in details of experiment with 4 different use cases which could be part of your automation playbook construct: Both operate similarly When redirect operator used When pipes used between commands Multiple commands need to run Let's examine these use cases 1. Both operate similarly If we need to run single Linux command to be executed then both shell, commands modules operates same way there is no difference. Here I'm using "who -r" command to be run. If we don't mention any module name then command module by default. # Using default command module ansible web -a "who -r" #or ansible...

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...