RH-294 Expert Session on ANSIBLE Use Cases
This article is about the session I had yesterday (28/12/2020). It is about the real use cases of Ansible Tower with demo.
- Mr.Sreejith Anujan — The principle instructor at Red Hat
- Primarily responsible for empowering Red Hat customers with tailor-made enablement services.
- Also heading the designing and delivering hihg quality content on integrated solutions and trusted partners across APAC, ANZ and APJ.
- Connected with Red Hat for around 12+ years.
2. Mr.Arun Eapen — Director, APAC Service Delivery, GLS Red Hat Asia Pacific
- Specialist : Linux and Security
- The first RHC*(RHCA, RHCSS, RHCDS, RHCVA) in India.
- Founding member of the Free Software Foundation India.
- Being in open source software for more than 24 years.
Automation is the creation and application of technologies to produce and deliver goods and services with minimal human intervention. The implementation of automation technologies, techniques, and processes improves the efficiency, reliability, and/or speed of many tasks that were previously performed by humans.
Automation is the future and we can perform automation using Ansible, Terraform, Puppet, Jenkins, etc…
Ansible is a software tool that provides simple but powerful automation for cross-platform computer support. It is primarily intended for IT professionals, who use it for application deployment, updates on workstations and servers, cloud provisioning, configuration management, intra-service orchestration, and nearly anything a systems administrator does on a weekly or daily basis. Ansible doesn’t depend on agent software and has no additional security infrastructure, so it’s easy to deploy.
What is Ansible Automation?
Ansible is a simple automation language that can perfectly describe an IT application infrastructure. It’s easy-to-learn, self-documenting, and doesn’t require a grad-level computer science degree to read. Automation shouldn’t be more complex than the tasks it’s replacing.
How Ansible works?
Ansible Tower (formerly ‘AWX’) is a web-based solution that makes Ansible even more easy to use for IT teams of all kinds. It’s designed to be the hub for all of your automation tasks.
Tower allows you to control access to who can access what, even allowing sharing of SSH credentials without someone being able to transfer those credentials. Inventory can be graphically managed or synced with a wide variety of cloud sources. It logs all of your jobs, integrates well with LDAP, and has an amazing browsable REST API. Command-line tools are available for easy integration with Jenkins as well. Provisioning callbacks provide great support for autoscaling topologies.
1. Ansible Tower X AWS
Writing a job template for creating a VPC, Subnet, Route table, IP allocation, and finally provisioning an EC2 instance on top of it.
Just like the Ansible playbook, we can write a Job template in ansible tower, by giving the AWS credentials and using AWS API. If the credentials are correct the template is executed and VPC is created.
What if there is a situation where we have to run multiple playbooks sequentially, with ansible we cannot do it however we can use Ansible Tower Workflow for this.
What is Ansible Workflow?
Ansible Tower enables users to create sequences consisting of any combination of job templates, project syncs, and inventory syncs that are linked together in order to execute them as a single unit.
Job or workflow templates are linked together using a graph-like structure called nodes. These nodes can be jobs, project syncs, or inventory syncs. A template can be part of different workflows or used multiple times in the same workflow. A copy of the graph structure is saved to a workflow job when you launch the workflow.
Ansible Tower X Slack Notification
Getting to know what a person is doing in a team is very crucial with out having common knowledge the work can be in chaos. With the help of any notification channel admin can send a notification to the group so that every person in the team knows what is going on. With Ansible Tower we can also send a notification using API, In this use case we are using Slack as a notification medium.
when a job fails in Ansible tower, a notification is sent using the configuration defined by the notification template.
A user assigns the notification template to any of the various objects that support it (all variants of job templates as well as organizations and projects) and at the appropriate trigger level for which they want the notification (started, success, or error). For example a user may wish to assign a particular notification template to trigger when Job Template 1 fails.
For more about notification see Ansible Send Notification.
Ansible Tower X Oracle Cloud
Ansible works backend with the help of PYTHON , to run any playbook in the managed node it just needs python installed in it. This is why it is agentless. In the first use case we have discussed about integrating ansible with AWS, in this we have added our credentials so that we can reach to AWS API. But with Oracle it is not possible because it does not have template for Oracle Cloud Credentials. Due to which we cannot connect to oracle API.
To overcome this problem we can use Python environment. Using python we can create an environment which can help us to reach to API. In Ansible Web UI we can create our custom credential template for Oracle using create credential tab.
Using Pip command we can install the OCI infrastructure.
pip install oci
These are some of the use cases that we have implemented on 28/12/20 Linux world webinar. I would like to thank Sreejith Anujan, Principal Instructor at Red Hat Sir, Arun Eapen, Director — APAC, Service Delivery, GLS, RedHat Asia Pacific for such an informative session and useful session. I would like to also thank Vimal Daga Sir, Preeti Ma’am and Linux World team.