Book Image

Ansible 2 Cloud Automation Cookbook

By : Aditya Patawari, Vikas Aggarwal
Book Image

Ansible 2 Cloud Automation Cookbook

By: Aditya Patawari, Vikas Aggarwal

Overview of this book

Ansible has a large collection of inbuilt modules to manage various cloud resources. The book begins with the concepts needed to safeguard your credentials and explain how you interact with cloud providers to manage resources. Each chapter begins with an introduction and prerequisites to use the right modules to manage a given cloud provider. Learn about Amazon Web Services, Google Cloud, Microsoft Azure, and other providers. Each chapter shows you how to create basic computing resources, which you can then use to deploy an application. Finally, you will be able to deploy a sample application to demonstrate various usage patterns and utilities of resources.
Table of Contents (11 chapters)

Logging into Docker Registry

In this recipe, we will write a task to log in to Docker Registry. If we are using a private registry and want to push or pull Docker images, we first need to log in to that Docker Registry.

In the following task we will use Docker Hub as the Docker Registry. We will be logging into Docker Hub and will push an image to Docker Hub's private repository.

How to do it...

  1. Let's define a task for logging into Docker Registry:
- name: Log into DockerHub
docker_login:
username: vikas17a
password: XXXXXXXXX
email: [email protected]
tags:
- recipe6
  1. Let's try to push an image to Docker Hub's private repository using the login:
- name: Push image to Dockerhub
docker_image...