Ansible Playbook Programs

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
  1. Write a Ansible Playbook to create a group called “deploy”
- name: Deploying group
  hosts: webservers

  tasks:
  - name: create group
    group:
      name: deploy
      state: present
  

Program 2 – Write a Ansible Adhoc Commands to create a user called “deploy-user” which is part of group called “deploy” and with /bin/bash shell.

- name: Deploying user
  hosts: webservers

  tasks:
  - name: create user
    user:
      name: deploy-user

      shell:/bin/bash
      group: deployCode language: JavaScript (javascript)

3.Write a Ansible Adhoc commands install package named “httpd” in RHEL/centos.

- name: Start Installing Package
  hosts: webservers

  tasks:
  - name: install package
    yum:
      name: httpd

      state: present
      

Program 4 – Write a Ansible Adhoc commands to start and enable the service named “httpd”

- name: Starting the service
  hosts: webservers

  tasks:
  - name: start service
    service:
      name: httpd

      state: started

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

- name: Initiating File Creation
  hosts: webservers

  tasks:
  - name: creating a file
    copy:
      src: index.html

      dest: /var/www/html/index.htmlCode language: JavaScript (javascript)

Program 6 – Write a Ansible commands to copy a file called “second.html” in /var/www/html/second.html with some dummy html contents.

- name: Copying File
  hosts: webservers

  tasks:
  - name: copy a file
    copy:
      src: index.html

      dest: /var/www/html/second.htmlCode language: JavaScript (javascript)

Program 7 – Write a Ansible commands to install a package called “git”

- name: Starting to install git
  hosts: webservers

  tasks:
  - name: installing git
    git:
      name: git

      

Program 8 – Write a Ansible Adhoc commands to clone git repo. https://github.com/scmgalaxy/ansible-role-template.

- name: Initiating git cloning
  hosts: webservers

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

Program 9 – Write a Ansible commands to reboot a self machine.

- name: Started reboot
  hosts: webservers

  tasks:
  - name: rebooting the machine
    reboot:
      name: reboot the machine
      msg: rebooting the machine