Posts

How to install Docker in Ubuntu 22.0.4

Image
Please find steps needed for installing Docker in Ubuntu 22.0.4 instance. You can install in Docker in many ways. But try only one option. Docker installation steps using default repository from Ubuntu Update local packages by executing below command: sudo apt-get update Install the below packages sudo apt install gnupg2 pass -y gnupg2 is tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures   Install docker sudo apt install docker.io -y Add Ubuntu user to Docker group sudo usermod -aG docker $USER We need to reload shell in order to have new group settings applied. Now you need to logout and log back in command line or execute the below command: newgrp docker The Docker service needs to be setup to run at startup. To do so, type in each command followed by enter: sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker The above screenshot should confirm that Docker daemon is up and running. Doc...

Installing Maven using Ansible playbook on Ubuntu

Image
Playbook for installing Maven on Ubuntu using Ansible Playbook sudo vi installMaven.yml --- - hosts: My_Group   tasks:     - name: Install Maven using Ansible       become: yes       apt:         name: "{{ packages }}"         state: present       vars:         packages:            - maven ansible-playbook installMaven.yml This is the execution result of Ansible playbook.

Installing Jenkins using Ansible Playbook on Ubuntu

Image
Find below Ansible playbook for installing Jenkins on a Ubuntu machine. Pre-requisites: Java needs to be installed already on machine before setting up Jenkins. Here below is the playbook for installing Jenkins  using   Ansible in Ubuntu EC2 : sudo vi installJenkins.yml Copy the below yellow highlighted in the above file:  ---  - hosts: My_Group       tasks:     - name: ensure the jenkins apt repository key is installed       apt_key: url=https://pkg.jenkins.io/debian/jenkins.io-2023.key state=present       become: yes     - name: ensure the repository is configured       apt_repository: repo='deb https://pkg.jenkins.io/debian-stable binary/' state=present       become: yes     - name: ensure jenkins is installed       apt: name=jenkins update_cache=yes       become: yes     - name: ensure jenkins is running  ...

Installing Java 11 with Ansible playbook on Ubuntu

Image
1. Login to Ansible management server/machine. Create SSH keys in   Ansible   host machine by executing the below command:   (if you already have keys created, please skip this step) ssh-keygen  enter three times..now you will see keys successfully created. 2.  Execute the below command on Ansible management node and copy the public key content: sudo cat ~/.ssh/id_rsa.pub copy the above output. 3. Now login to target node, execute the below command to open the file sudo vi /home/ubuntu/.ssh/authorized_k eys type shift A and then enter now  and paste the key in the above file.  please do not delete any existing values in this file. 4. Now go back to Ansible mgmt node, do changes in /etc/ ansible /hosts file to include the node you will be installing software. Make sure you  add public IP address of target node  as  highlighted below  in  red color: sudo vi /etc/ansible/hosts [My_Group]   xx.xx.xx.xx  ansible_ssh_u...

Terminating EC2 instances with Ansible Playbook

Image
Please find a simple Ansible playbook for terminating EC2 instance in AWS using instance id. Pre-requisites: Make sure you create an IAM role with AmazonEC2FullAccess policy and attach the role to EC2 instance. Login to EC2 instance using Git bash or ITerm/putty where you installed Ansible. E xecute the below command to e dit Ansible hosts or inventory file sudo vi /etc/ansible/hosts   Add the below two lines in the end of the file: [localhost] local save the file and come out of it. Create the playbook by executing below command: sudo vi  terminate.yml  ---  - name: ec2 provisioning using Ansible    hosts: local    connection: local    gather_facts: False  - hosts: local    gather_facts: False    connection: local    vars:       - region: 'us-east-2'      - ec2_id: ' i-05f39cfb80c97df38 '    tasks:      - name: Terminate in...

Ansible Playbook for provisioning a new EC2 instance in AWS | Create new EC2 instance in AWS cloud using Ansible Playbook

Image
We will learn how to create Ansible Playbook for provisioning a new EC2 instance in AWS cloud. Please follow the below steps in the machine where you have installed Ansible. Pre-requisites: Ansible is installed and Boto is also installed  on Ubuntu EC2 instance Create an IAM role with AmazonEC2FullAccess policy in AWS console and attach the role to ansible EC2 instance. Steps to create EC2 instance using Ansible: Login to EC2 instance using Git bash or ITerm/putty where you installed Ansible. Execute the below command: Create an Inventory file first sudo mkdir /etc/ansible Edit Ansible hosts or inventory file sudo vi /etc/ansible/hosts Add the below two lines in the end of the file: [localhost] local cd ~ mkdir playbooks     cd playbooks Create Ansible playbook sudo vi create_ec2.yml  (copy the below content  in  green  color) edit the create_jenkins_ec2.yml to make sure you update the key which is red marked below: ---   - name:   ...

Install Ansible on Ubuntu | How to setup Ansible on Ubuntu 22.0.4 | Ansible install on Ubuntu

Image
Ansible is #1 configuration management tool. It can also be used for  infrastructure   provisioning  as well. or You can use Ansible in combination of Terraform which can take care of infra automation and Ansible can do  configuration  management.   Ansible Architecture:   The best way to install Ansible for Ubuntu is to add the project's PPA (personal package archive) to your system. You also would need Boto framework for provisioning resources in AWS cloud. Pre-requisites Create new Ubuntu EC2 instance for installing Ansible, just open port 22. Change Host Name to AnsibleMgmtNode sudo hostnamectl set-hostname  AnsibleMgmtNode Update Repository sudo apt-get update Install Ansible: sudo apt install ansible sudo apt install python3-pip -y  ( this is just comment -  Package manager for python) Install Boto Framework - AWS SDK sudo pip3 install boto boto3 Ansible will access AWS resources using boto SDK. sudo apt-get install python3-boto -y...