ARTH TASK 14.2

Problem Statement

This article covers step by step guide to achieve our use case.

Writing Ansible Playbook to install docker engine.

Code to install docker and start docker service

After running the playbook, docker will be installed and the docker engine will be started.

Creating a SSH enabled container

We need to write a Dockerfile to create ssh enabled container. Lets start by understanding how we can configure ssh manually. So, we need openssh-server software for ssh service. Use command yum install openssh-server -y to install. Now we need to have passwd software to configure password for the user. Use command yum install passwd -y to install passwd. Now, change password of root user using passwd root, but it is a interactive command. So, we can use non-interactive command to directly fetch input from user. Use command echo “password”| passwd root — stdin. And then we can start the service by /usr/sbin/sshd and to make it permanently enable write the command inside /etc/rc.d/rc.local.

But this is time consuming so we decide to write a Dockerfile.

Now, run command docker build -t tirth1272/sshcontainer . (tirth1272 is just a username for docker hub, you have to keep your username)

Then you can do docker push <imagename> eg: docker push tirth1272/sshcontainer:latest

Now, writing a playbook to configure container.

After running, this code the inventory ip.txt will be updated.

Now, lets try to install any package inside this container. To do this make another yaml file.

Run this playbook and we will be able to configure the container according to our needs.

 

Comments

Popular posts from this blog

ARTH TASK 23 [📌 Automate Kubernetes Cluster Using Ansible 🔅 Launch ec2-instances on AWS Cloud eg. for master and slave. 🔅 Create roles that will configure master node and slave node seperately. 🔅 Launch a wordpress and mysql database connected to it in the respectine slaves. 🔅 Expose the wordpress pod and client able hit the wordpress ip with its respective port. ]

Arth Task6 "Create High Availability Architecture with AWS CLI" #awscloud #awscli #aws #vimaldaga #righteducation #educationredefine #rightmentor #worldrecordholder #linuxworld #makingindiafutureready #righeudcation #awsbylw #arthbylw

RH294 real used cases workshop #RedHat #vimaldaga #righteducation #educationredefine #rightmentor #linuxworld #makingindiafutureready #righeducation #arthbylw #ansiblebylw #ansible #expertsession #sreejith #arun #practicalimplementation #rh294