Ansible Playbook Lab

DevOps

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.

Start Your Journey with Motoshare

Write a Ansible Playbook to create a group called “deploy”

-name: first playbook
 hosts: web

 tasks:
  -name: Deploy Group
   ansible.builtin.group:
     name: deploy
     state: present
Code language: CSS (css)

Write a Ansible Playbook to create a user called “deploy-user” which is part of group called “deploy” and with /bin/bash shell.

-name: second playbook
 hosts: web

 tasks:
  -name: Adding user to group
   ansible.builtin.user:
     name: deploy-user
     shell: /bin/bash
     groups: deploy
   

Code language: JavaScript (javascript)

Write a Ansible Playbook to install package named “httpd” in RHEL/centos.

-name: Third playbook
 hosts: web

 tasks:
  -name: Installing package
   ansible.builtin.package:
    name: httpd
    state: presentCode language: CSS (css)

Write a Ansible Playbook to start and enable the service named “httpd”

-name: fourth playbook
 hosts: web

 tasks:
  -name: start and enable the service named “httpd” 
   ansible.builtin.service:
    name: httpd
    state: started
    enabled: yesCode language: CSS (css)

Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents.

-name: fifth playbook
 hosts: web

 tasks:
  -name: create a file called “index.html” in /var/www/html 
   file:
      path: /var/www/html/index.html
      state: touchCode language: JavaScript (javascript)

Write a Ansible Playbook to reboot a self machine.

-name: sixth playbook
 hosts: web

 tasks:
  -name: reboot a self machine.
   reboot:
    reboot_timeout: 60Code language: PHP (php)

Write a Ansible Playbook to clone git repo. https://github.com/scmgalaxy/ansible-role-template

-name: seventh playbook
 hosts: web

 tasks:
  -name:  clone git repo. 
   ansible.builtin.git:
    repo: https://github.com/scmgalaxy/ansible-role-template
    clone: yesCode language: PHP (php)

Write a Ansible Playbook to install a package called “git”, “wget”.

 name: eighth playbook
  hosts: web
  tasks:
  - name: Installing git, wget packages 
    yum:
      name: 
         -git
         -wget
      state: present