ANSIBLE AND INTEGRATION OF ANSIBLE WITH GOOGLE CLOUD PLATFORM

In this article we will discuss what is ansible and its use cases?

Rahul Kumar
4 min readDec 1, 2020

Q . When you started learning Ansible first question will come in your mind What is Ansible ?

  • you can simply say that ansible is open source automation tool or platform. used for configuration management, application deployment, intraservice orchestration, and provisioning.

Q. What makes Ansible Differ from other Automation Tools like Jenkins, Nagios etc. ?

  • These are also automation tools but it depends on what’s kind of automation you want achieve , if you want to to automate your monitoring system then use Nagios and if you want to automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery then use Jenkins . similarly , if you want to automate the configuration level task then use ansible.

Q .There are many configuration management tools like puppet, chef etc. so, why would you choose Ansible?

The main reason for Choosing Ansible is Simplicity . Ansible is simple as compared to puppet and Chef .

  • Ansible uses YAML as configuration language but puppet and chef use Ruby .
  • Ansible is agentless. That is, instead of having to install an agent on every system you want to manage (as you have to do with Puppet and Chef), Ansible just requires that systems have Python (on Linux servers) or PowerShell (on Windows servers) and SSH.

Why do we need Ansible?

Ansible automates and simplifies repetitive , complex operations and it saved huge time when we install packages or configure large numbers of servers.

lets understand by example :

If you have configured a webserver on top of your OS . then you have to do some steps required like

step1. install httpd (for installing apache webserver)

Step2. To start the service httpd

step3. copy or deploy your webpages into docoment root folder : /var/www/html

Step4. To allow the port no 80/tcp .

If you have to configure webserver on 100 of OS like that then it will took huge time . by chance you forgot to do any step then it won’t configure. so we need automation tool to do these task . here , ansible plays a vital role to do these kind of work and save time as well .

What Ansible Can Do?

By Using ansible we can do :

1 . Configuration Management:

  • Install or remove software
  • Ensure the Services are in desired state : Running, stopped

2. Application Deployment: Deploying applications

3.Security and compliances

4. Orchestration

Ansible architecture

In Ansible architecture ,these terms are used mostly controller node , inventory , playbook , managed node .

Controller Node /Local machine : Node where we configure ansible.

Inventory : All the machines you’re using with Ansible are listed in a single simple txt file, along with their IP addresses, databases, servers, and so on.

playbook: Ansible playbooks are like instruction manuals for tasks .here we create a YAML file and put instructions in it.

Managed node: Node where we perform the instructions given in playbook .

Ansible and Google Cloud Platform :

Ansible puts Google Technology at Your Fingertips

Google Cloud Platform (GCP) provides scalable infrastructure and solutions to meet the needs of your organization. GCP offers on-demand instances, software-defined networking, storage and databases, and big data solutions and they’re all available at your fingertips.

Ansible and Google Native Integration

The Ansible/GCP integration gives you everything you need to manage your IT infrastructure. From provisioning instances and auto scaling, custom networks and load balancing, and even managing DNS and cloud storage, it’s all provided. Use the Ansible/GCP tutorial and examples in your Playbooks.

Solutions That grow with Your Organization

Testing/Continuous Integration

  • Use Ansible to launch instances in any GCP Zone, configure networking setups to accurately simulate real-world scenarios
  • Deploy your code how you want: private disk images, startup scripts pointing to your own package repository and more — all within your native Ansible Playbooks
  • Tear-down instances when you’re done: right after a test or after a review with the team and even keep a snapshot of the disk

Production Deployment

  • Use GCP Managed Instance Groups (Playbook example) and autoscaling to ensure your application can meet the needs of its users
  • Easily use Cross-Region Load Balancing to have your application served by the closest-available zone
  • Enable Service Accounts with specific access, enabling only those who need it to run your playbooks in production.

Leverage Containers Without the Hassle

  • Easily deploy containers in Google’s managed container environment (Container Engine)
  • Store and access your container images in our Container Registry
  • Auto scaling, advanced networking and Logging giving you full control to understand and tune your cluster.

Google is an Active Contributor to the Ansible Community

The Ansible open source community is a vibrant, fast-moving place that strives to get things done. Google thrives in open source, but also understands the reliability needs of its users to safely run their infrastructure. Google Engineering actively builds Ansible modules, contributes code and documentation, and helps users deliver their solutions with GCP.

Thank you….

--

--