Ansible playbook Excercise
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
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”