DevOps Project: Jenkins CI/CD for Kubernetes Deployments

  DevOps Tech Hub

116 Followers

Ansible Architecture


Ansible is the automation tool to automate applications and IT infrastructure. Ansible do more than just automation, it can be integrated as

  1. Application Deployment
  2. Configuration Management
  3. Continuous Delivery.

Below diagram depicts the basic Ansible architecture:

In this DevOps project Ansible is used to run YAML playbook to create custom container images and push the image to the DockerHub registry. Here is the playbook definition  

#Create Custom Container Image

#Push to DockerHub Registry

---

- hosts: localhost

  tasks: 

  - name: Pull .war artifact from Artifactory

    become: true

    get_url:

      url: http://3.101.18.188:8082/artifactory/libs-release/com/dpt/dpt/1.0-RELEASE/dpt-1.0-RELEASE.war

      dest: /home/admin

      url_username: admin

      url_password: helloadmin123


  - name: Rename .war Artifact

    command: mv dpt-1.0-RELEASE.war dpt.war

  - name: Pull Tomcat  Container Image

    docker_image:

      name: tomcat:latest

      source: pull


  - name: Build image and with build args

    docker_image:

      name: dpt

      build:

        path: /home/admin

        pull: no

        args:

          listen_port: 8080

      source: build


  - name: Log into DockerHub

    docker_login:

     username: dockertest

     password: hellodocker123

  - name: Push to docker hub

    docker_image:

      name: dpt

      repository: dockertest/dpt:1.0

      push: yes

      source: local





Previous Next