MOTOSHARE πποΈ
Turning Idle Vehicles into Shared Rides & Earnings
From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.
With Motoshare, every parked vehicle finds a purpose.
Owners earn. Renters ride.
π Everyone wins.
Q1. Difference Between Terraform and Ansible?

Q2. What Kind of Work you did in Ansible?

Q3. What Kind of Playbook you have written in Ansible?
- Playbook for Patching & Upgrading Linux APP Servers
- Playbook for Patching & Upgrading Linux DB Servers
- Playbook for Installing Applications in Linux VMS
- Playbook for Installing Database in Linux VMS
- Playbook for Installing Web Servers in Linux VMS


Q4. What is Architecture of Ansible or How it works?

Q5. Whats there in Playbooks? How you write playbook?

Q6. Example of Plybook of Ubuntu Servers
---
- name: Update web servers
hosts: web
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: "apache2"
state: latest
- name: Copy index.html
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Starting a Apache Server
ansible.builtin.service:
name: "apache2"
state: startedCode language: JavaScript (javascript)
---
- name: Update web servers
hosts: web
vars:
myname: "Rajesh Kumar"
httpport: 8090
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: apache2
state: latest
- name: Copy index.html
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Starting a Apache Server
ansible.builtin.service:
name: apache2
state: started
- name: Template for httpd.conf
template:
src: ports.conf.j2
dest: /etc/apache2/ports.conf
notify:
- ReStarting a Apache Server
handlers:
- name: ReStarting a Apache Server
ansible.builtin.service:
name: apache2
state: restartedCode language: JavaScript (javascript)
Q7. List of TOP Ansible modules you have used in Playbook
Certainly! Here is a list of commonly used Ansible modules in Playbook format, presented in a table without examples:

- name: Install a package
apt:
name: git
state: present
- name: Ensure nginx is running
service:
name: nginx
state: started
enabled: true
- name: Copy a file to the remote server
copy:
src: /local/path/to/file
dest: /remote/path/to/file
- name: Deploy a configuration file
template:
src: /local/path/to/template.j2
dest: /remote/path/to/config.conf
- name: Ensure a directory exists
file:
path: /path/to/directory
state: directory
mode: '0755'
- name: Create a user
user:
name: johndoe
state: present
groups: sudo
- name: Run a custom shell command
shell: echo "This is a test"
- name: Run a simple command
command: /usr/bin/uptime
- name: Clone a Git repository
git:
repo: 'https://github.com/example/repo.git'
dest: /path/to/destination
- name: Ensure a line is present in a file
lineinfile:
path: /path/to/file
line: 'This is a line in the file'
Code language: JavaScript (javascript)
Q8. What is ROLE?


roles/
βββ common
β βββ defaults
β β βββ main.yml # Default variables for the role
β βββ files
β β βββ ... # Files to be copied to remote hosts
β βββ handlers
β β βββ main.yml # Handlers, triggered by tasks
β βββ meta
β β βββ main.yml # Role dependencies and metadata
β βββ tasks
β β βββ main.yml # Main list of tasks to execute
β βββ templates
β β βββ ... # Jinja2 templates to be deployed
β βββ tests
β β βββ inventory # Test inventory file for Vagrant
β β βββ test.yml # Test playbook
β βββ vars
β βββ main.yml # Variables for the role
βββ webserver
β βββ defaults
β β βββ main.yml # Default variables for the role
β βββ files
β β βββ ... # Files to be copied to remote hosts
β βββ handlers
β β βββ main.yml # Handlers, triggered by tasks
β βββ meta
β β βββ main.yml # Role dependencies and metadata
β βββ tasks
β β βββ main.yml # Main list of tasks to execute
β βββ templates
β β βββ ... # Jinja2 templates to be deployed
β βββ tests
β β βββ inventory # Test inventory file for Vagrant
β β βββ test.yml # Test playbook
β βββ vars
β βββ main.yml # Variables for the role
βββ database
βββ defaults
β βββ main.yml # Default variables for the role
βββ files
β βββ ... # Files to be copied to remote hosts
βββ handlers
β βββ main.yml # Handlers, triggered by tasks
βββ meta
β βββ main.yml # Role dependencies and metadata
βββ tasks
β βββ main.yml # Main list of tasks to execute
βββ templates
β βββ ... # Jinja2 templates to be deployed
βββ tests
β βββ inventory # Test inventory file for Vagrant
β βββ test.yml # Test playbook
βββ vars
βββ main.yml # Variables for the role
Code language: PHP (php)
Q9. What are top 10 Roles you have used in your work?

[…] https://www.bestdevops.com/ansible-interview-questions-and-answers […]