Posts

Showing posts from April 22, 2018

Ansible– Modules and different types of Modules

Ansible – Modules Modules in Ansible are idempotent. From a RESTful service standpoint, for  an operation (or service call) to be idempotent, clients can make that  same call repeatedly while producing the same result. In other  words, making multiple identical requests has the same effect as making a single request. There are different types of modules in Ansible: Core module Extras modules Core Modules These are modules that the core Ansible team maintains and will  always ship with Ansible itself. They will also receive slightly higher  priority for all requests than those in the “extras” repos. The source of these modules is hosted by Ansible on GitHub in the  Ansible-modules-core. Extras Modules These modules are currently shipped with Ansible, but might be shipped  separately in the future. They are also mostly maintained by the Ansible  community. Non-core modules are still fully usable, but may receive slightly ...
Hosts And Users: For each play in a playbook, you get to choose which machines in your infrastructure to target and which remote user to complete the tasks. To include hosts in Ansible inventory, we will be using the IP addresses of the host machines. Generally the hosts are a list one or more groups or host patterns, separated by colons. The remote user is just the name of the user account. Variables: Ansible uses variables which are defined previously to enable more flexibility in playbooks and roles. They can be used to loop through a set of given values, access various information like the host name of a system and replace certain strings in templates with specific values. Ansible already defines a rich set of variables, individual for each system. Whenever Ansible will run on a system, all facts and information about the system are gathered and set as variables. But there is a  rule  for naming variables. Variable names should be letters, numbers, ...

Installation Ansible in Ubuntu which sample playbook

ppa:ansible/ansible repository  sudapt-add-repository -y ppa:ansible/ansible sudapt-get update sudapt-get install -y ansible  This installs Ansible globally. Virtualenv's This is my preferred way to install Ansible. We can also use Pip to install virtualenv, which lets us install Python libraries in their own little environment that won't affect others (nor force us to install tools globally). Here's how: # Install python2.7 (Ubuntu 16.04 comes with python 3 out of the box) and Pip sudo apt-get install -y python2.7 python-pip ## Use Pip to install virtualenv ### -U updates it if the package is already installed sudo pip install -U virtualenv Once we have pip and virtualenv installed globally, we can get Ansible inside of a virtual environment: # Go to my user's home directory, # make a directory to play with ansible cd ~/ mkdir ansible-play cd ansible-play # Create a python virtual environment virtualenv .venv # Enable the virtual environ...

Remote Connection Information-Ansible

Before we get started, it’s important to understand how Ansible communicates with remote machines over SSH. By default, Ansible will try to use native OpenSSH for remote communication when possible. This enables ControlPersist (a performance feature), Kerberos, and options in  ~/.ssh/config  such as Jump Host setup. However, when using Enterprise Linux 6 operating systems as the control machine (Red Hat Enterprise Linux and derivatives such as CentOS), the version of OpenSSH may be too old to support ControlPersist. On these operating systems, Ansible will fallback into using a high-quality Python implementation of OpenSSH called ‘paramiko’. If you wish to use features like Kerberized SSH and more, consider using Fedora, OS X, or Ubuntu as your control machine until a newer version of OpenSSH is available for your platform. Occasionally you’ll encounter a device that doesn’t support SFTP. This is rare, but should it occur, you can switch to SCP mode in Configuring A...

Ansible - Introduction with essential playbook features

Ansible  is simple open source IT engine which automates application deployment, intra service orchestration, cloud provisioning and many other IT tools. Ansible is easy to deploy because it does not use any agents or custom security infrastructure. Ansible uses playbook to describe automation jobs, and playbook uses very simple language i.e.  YAML   (It’s a human-readable data serialization language & is commonly used for configuration files, but could be used in many applications where data is being stored) which is very easy for humans to understand, read and write.  Hence the advantage is that even the IT infrastructure support guys can read and understand the playbook and debug if needed (YAML – It is in human readable form). Ansible is designed for multi-tier deployment. Ansible does not manage one system at time, it models IT infrastructure by describing all of your systems are interrelated.  Ansible is completely agentless which means Ansible...