🚀 DevOps Certified Professional
📅 Starting: 1st of Every Month 🤝 +91 8409492687 | 🤝 +1 (469) 756-6329 🔍 Contact@DevOpsSchool.com

Ansible playbook Excercise

DevOps

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

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

tasks:
   - name: create group
     group:
       name:deploy

       state: present

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

- name: create user
     user:
       name: deploy-user
       group: deploy
       shell: /bin/bash
    
      

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

- name: Install the package
  ansible.builtin.package:
    name:
      - httpd
    state: latest

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

- name: Install the package
  ansible.builtin.package:
    name:
      - httpd
    state: started

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

---

- hosts: all
  tasks:
  - name: Creating an empty file
    file:
      path: "/var/www/html"
      state: touch

Write a Ansible Playbook to reboot a self machine.

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