Posts

Showing posts from September, 2025

Ansible Modules Part-1

 1. Copy module: Copies files from the control machine to the target host. like deploying a configuration file. 2. Package module: Irrespective of the operating system, it selects the appropriate package module and installs, upgrades, or removes software. 3. Service module: manages services like start, stop, restart, enable 4. User module: Manages user accounts like create, deleting, and modifying user accounts 5. yum/apt module: Install or remove upgrade packages like Debian-based and red hat based environments.

How Ansible Modules Work

How Ansible Modules Work Execution Flow: whenever  y ou execute a playbook or run an ad-hoc command 2. Ansible copies the module to the target host 3. The module executes on the remote system 4. Results are returned to the Ansible control node

Ansible Playbook to install java software

  playbook name: java.yaml  ---  - name: remove java    hosts: all    become: yes    tasks:         - name: remove java         yum:               name: java-24-amazon-corretto              state: absent              autoremove: yes playbook name: java.yaml Execute playbook: ansible-playbook removejava.yaml Result: java software will be installed. 

Ansible Playbook to remove specific java version

playbook name:removejava.yaml  ---  - name: remove java    hosts: all    become: yes    tasks:         - name: remove java         yum:              name: java-24-amazon-corretto             state: absent             autoremove: yes playbook name:removejava.yaml execute playbook: ansible-playbook removejava.yaml Result: java software & deps also removed  autoremove: yes ---> means leftover files                                     and unnecessary files will be removed

Write Ansible Playbook using tags - (skip a specific task by using tag)

playbook name: task2.yaml --- - name: install packages   hosts: all   become: yes   tasks:     - name: install httpd       yum:            name: httpd            state: absent           tags: httpd     - name: install docker       yum:            name: docker            state: absent           tags: docker     - name: install java        yum:             name: java             state: present            tags: java      we have 3 tasks 1) Install httpd 2) Install docker 3) Install java but I would like to execute skip java execution task by using tag name step1: create playbook:        ex: playbo...

Write Ansible Playbook using tags - (execute a specific task by using tag)

 playbook name: task1.yaml --- - name: install packages   hosts: all   become: yes   tasks:     - name: install httpd       yum:          name: httpd          state: present         tags: httpd     - name: install docker       yum:          name: docker          state: present         tags: docker Note: we have two tasks 1) Install httpd 2) Install docker but I would like to execute only docker task by using tag name step1:  create playbook:             ex: playbook name: task1.yaml step2:  execution process:             ansible-playbook task1.yaml --tags docker step3:  result:        only docker software will be installed on target machines vist our YouTube Channel: https://www.youtube....

Write Ansible Playbook to Create multiple folders

playbook name:folders.yaml  ---  - name: create multiple folders    hosts: all    become: yes    tasks:       - name: create folders         file:            path: "/root/ {{item.name}}"            owner: "{{item.owner}}"            state: absent         loop:            - { name: 'jenkins', owner: 'kk1' }            - { name: 'maven', owner: 'kk2' } step1: create playbook           ex:playbook name:folders.yaml step2: execution process:             ansible-playbook folders.yaml step3: syntax check process:             ansible-playbook folders.yaml --syntax-check vist our YouTube Channel: https://www.youtube.com/@VansroTechnologies/videos

Write a Ansible Playbook to Install Docker & Start Docker Service

 1st Model: Install Docker & Start Docker Service  ==================================== Playbook Name: install_docker.yaml ---  - name: install docker & start docker service    hosts: all    become: yes    tasks:       - name: install docker package           yum:              name: docker             state: latest       - name: start docker service          service:             name: docker            state: started 2nd Model: Install Docker & Start Docker Service  ==================================== ---  - name: install docker & start docker service    hosts: all    become: yes    tasks:       - name: install docker package         ...

Write an Ansible Playbook to delete multiple users

--- - name: users_deletion playbook   hosts: all   become: yes   tasks:     - name: delete multiple users       user:         name: "{{item.name}}"         uid: "{{item.uid}}"         state: absent       loop:         - name: 'kk1'           uid: '1001'         - name: 'kk2'           uid: '1002' Watch now: https://youtube.com/live/_Dw-JFeP_yY

Write an Ansible Playbook to create multiple users

1st model: ======= --- - name: users_creation playbook   hosts: all   become: yes   tasks:      - name: create multiple users        user:           name: "{{item.name}}"           uid: "{{item.uid}}"           state: present       loop:           - name: 'kk1'             uid: '1001'           - name: 'kk2'              uid: '1002' 2nd model: ======== --- - name: users_creation playbook   hosts: all   become: yes   tasks:      - name: multiple users_creation        user:            name: "{{item.name}}"            uid: "{{item.uid}}"            state: present       loop:   ...

Write Ansible Playbook to install & configure webserver & copy index.html file using variables

 - name: httpd install playbook   hosts: all   become: yes   vars:     v1: httpd     v2: latest     v3: started     v4: restarted   tasks:     - name: Install httpd       yum:           name: "{{v1}}"           state: "{{v2}}"     - name: Start httpd service       service:          name: "{{v1}}"          state: "{{v3}}"     - name: copy index.html file            copy:                src: index.html                dest: /var/www/html     - name: restart httpd service       service:          name: "{{v1}}"          state: "{{v4}}"

Partitioning,Formatting,Mounting & Unmounting Disks by kk || Vansro Technologies ||

  Part-1 (Cloud Engineers) ----------------------------- step1: login AWS Account step2: create Linux server step3: create 4GB Volume step4: attach 4GB Volume to the Linux Server Part-2 (L2 OR L3 Linux Support Engineers) ------------------------------------------------------ based on your organization standards you get this task step5: login Linux server step6: do partitions         fdisk /dev/xvdb and press enter        disk partition no1: /dev/xvdb1        disk partition no2: /dev/xvdb2 step7: do format the disk partition (attach file system to the disk)        mkfs -t xfs /dev/xvdb1        mkfs -t xfs /dev/xvdb2 step8: create directory or folder (also called as mount points or folders)        mkdir /payments        mkdir /deposits step9: do mounting (attach folder to the disk)        mount /dev/xvdb1 /payments  ...

backup & restore data | Linux environment | AWS snapshot

backup & restore data | Linux environment | AWS snapshot ------------------------------------------------------------------------ high level points ---------------------- INSIDE SERVER1 ---------------------- 1.create Linux server1 inside AWS Cloud 2.create a volume    ex: volume name: /dev/xvdb 3.attach volume to the Linux server 4.make partitions ex: fdisk /dev/xvdb press enter button two partitions partition 1: /dev/xvdb1 partition 2: /dev/xvdb2 5.format the partitions with file system (ex:ext2,ext3,ext4 and xfs --Latest) attaching file system to the disk is also called as disk format (indirectly inform to the os is also called as disk format) disk format can be done with the help of "mkfs" command ex: mkfs -t xfs /dev/xvdb1        mkfs -t xfs /dev/xvdb2 6.create & attach mount points(folders) to the partitions mount folder creation process: ------------------------------------- mkdir project1 mkdir project2 mounting process: --...