While you’re not driving your car or bike, it can still be working for you.
MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.
🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
1. Write a Ansible Playbook to create a group called “deploy”
—
– name: Create the “deploy” group
hosts: localhost
become: yes
tasks:
– name: Ensure the “deploy” group exists
group:
name: deploy
state: present
2. 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 the “deploy-user” and add to the “deploy” group
hosts: localhost
become: yes
tasks:
– name: Ensure the “deploy” group exists
group:
name: deploy
state: present
– name: Create the “deploy-user” user
user:
name: deploy-user
group: deploy
shell: /bin/bash
state: present
3. Write a Ansible Playbook to install package named “httpd” in RHEL/centos.
—
– name: Install httpd package
hosts: localhost
become: yes
4. Write a Ansible Playbook to start and enable the service named “httpd”
—
– name: Start and enable the httpd service on RHEL
hosts: localhost
become: yes
tasks:
– name: Ensure the httpd service is enabled
service:
name: httpd
enabled: yes
– name: Start the httpd service
service:
name: httpd
state: started
5. Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents.
—
– name: Create index.html in /var/www/html
hosts: localhost
become: yes
tasks:
– name: Create the directory if it doesn’t exist
file:
path: /var/www/html
state: directory
– name: Create the index.html file
copy:
content: |
<!DOCTYPE html>
<html>
<head>
<title>Dummy Page</title>
</head>
<body>
<h1>This is a dummy HTML page</h1>
</body>
</html>
dest: /var/www/html/index.html
6. Write a Ansible Playbook to reboot a self machine.
—
– name: Reboot the local machine
hosts: localhost
become: yes
tasks:
– name: Reboot the machine
reboot:
Adam
1 year ago
Write a Ansible Playbook to create a group called “deploy”
---
- name: whatever
hosts: all
become: true
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: whatever
hosts: all
become: true
tasks:
- name: create user
user:
name: deploy-user
group: deploy
state: present
shell: /bin/bash
...
Write a Ansible Playbook to install package named “httpd” in RHEL/centos.
---
- name: whatever
hosts: all
become: true
tasks:
- dnf:
name: httpd
state: latest
...
Write a Ansible Playbook to start and enable the service named “httpd”
---
- name: whatever
hosts: all
become: true
tasks:
- service:
name: httpd
state: started
enabled: true
...
Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents.
---
- name: whatever
hosts: all
become: true
tasks:
- copy:
dest: /var/www/html/index.html
content: foobar
...
Write a Ansible Playbook to reboot a self machine.
---
- name: whatever
hosts: all
become: true
tasks:
- reboot:
...
Write a Ansible Playbook to install a package called “git”, “wget”.
---
- name: whatever
hosts: all
become: true
tasks:
- dnf:
name:
- git
- wget
state: latest
...
Write a Ansible Playbook to clone git repo. thttps://github.com/scmgalaxy/ansible-role-template
---
- name: whatever
hosts: all
become: true
tasks:
- git:
name: https://github.com/scmgalaxy/ansible-role-template
dest: /tmp/role-template
...
shardendu
1 year ago
Write a Ansible Playbook to start and enable the service named “httpd”
—
– name: Start and Enable the httpd Service
hosts: rhel
become: yes
tasks:
– name: httpd install and start
service:
name: httpd
state: started
enabled: yes
Write a Ansible Playbook to reboot a self machine.
---
- name: Lab excercise
hosts: localhost
tasks:
- name: make sure group exist
group:
name: deploy
state: present
- name: make sure user exist
user:
name: deploy-user
group: deploy
shell: /bin/bash
- name: make sure latest apache is installed
apt:
name: apache2
state: latest
- name: make sure apache is started
service:
name: apache2
state: started
- name: make sure the index html is in place
copy:
src: index.html
dest: /var/www/html/
- name: make sure second html is in place
copy:
content: 'second file content'
dest: /var/www/html/second.html
- name:
apt:
state: present
name:
- git
- wget
- name: Clone repo
git:
repo: https://github.com/scmgalaxy/ansible-role-template
dest: /root/ansible-role-template
clone: yes
update: yes
...
Certification Courses
DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:
DevOps Certification - Learn the fundamentals and advanced concepts of DevOps practices and tools.
SRE Certification - Gain expertise in Site Reliability Engineering and ensure reliability at scale.
MLOps Certification - Dive into Machine Learning Operations and streamline ML workflows.
AiOps Certification - Discover AI-driven operations management for next-gen IT environments.
Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.
This is the complete playbook
—
– name: complete playbook
hosts: localhost
tasks:
– name: group deploy
ansible.builtin.group:
name: deploy
state: present
– name: create user
ansible.builtin.user:
name: deploy-user
state: present
groups: deploy
shell: “/bin/bash”
– name: install se httpd
ansible.builtin.apt:
name: apache2
state: latest
– name: Start service
ansible.builtin.service:
name: apache2
state: started
– name: copy file
ansible.builtin.copy:
content: “<h1> Hola Mundo </h1>”
dest: /var/www/html/index.html
– name: reboot machines
ansible.builtin.reboot:
reboot_timeout: 3600
– name: install packages
ansible.builtin.apt:
name: git,wget
state: latest
– name: replicate repository
ansible.builtin.git:
repo: https://github.com/scmgalaxy/ansible-role-template
dest: /home/ubuntu/ansible-role-template
– name: Linus lab
hosts: localhost
become: yes
tasks:
– name: Create a user group
group:
name: deploy
state: present
– name : Create user and add to deploygroup
user:
name: deploy-user
group: deploy
shell: /bin/bash
home: /home/deploy-user
– name: install httpd
yum:
name: httpd
state: installed
– name: Starting a Apache Server
ansible.builtin.service:
name: apache2
state: started
– name: Copy file with owner and permissions
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
– name: Install install git
ansible.builtin.apt:
name: “git”
state: present
– name: Install install git
ansible.builtin.apt:
name: “wget”
state: present
– name: Git checkout
ansible.builtin.git:
repo: ‘https://github.com/scmgalaxy/ansible-role-template’
dest: /tmp/checkout
1
– name: create group
hosts: all
tasks:
– name: create group “deployE
ansible.builtin.group:
name: deploy
state: present
2
– name: create user
hosts: all
tasks:
– name: create group “deployE
ansible.builtin.user:
name: deploy-user
state: present
shell: /bin/bash
3
– name: install package
hosts: all
tasks:
– name: install package httpd
ansible.builtin.apt:
name: httpd
state: present
4
– name: start service httpd
hosts: all
tasks:
– name: Start service httpd
ansible.builtin.service:
name: httpd
state: started
5
– name: create file
hosts: all
tasks:
– name: create file
ansible.builtin.file:
dest: /var/www/html/index.html
state: touch
6
– name: create file
hosts: all
tasks
– name: reboot the machine with all defaults
ansible.builtin.reboot:
7
– name: install package
hosts: all
vars:
packages:
– git
– wget
tasks:
– name: install package httpd
ansible.builtin.apt:
name: “{{ item }}
state: present
with_items: “{{packages}}”
1. Write a Ansible Playbook to create a group called “deploy”
—
– name: Create the “deploy” group
hosts: localhost
become: yes
tasks:
– name: Ensure the “deploy” group exists
group:
name: deploy
state: present
2. 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 the “deploy-user” and add to the “deploy” group
hosts: localhost
become: yes
tasks:
– name: Ensure the “deploy” group exists
group:
name: deploy
state: present
– name: Create the “deploy-user” user
user:
name: deploy-user
group: deploy
shell: /bin/bash
state: present
3. Write a Ansible Playbook to install package named “httpd” in RHEL/centos.
—
– name: Install httpd package
hosts: localhost
become: yes
tasks:
– name: Install the httpd package
package:
name: httpd
state: present
4. Write a Ansible Playbook to start and enable the service named “httpd”
—
– name: Start and enable the httpd service on RHEL
hosts: localhost
become: yes
tasks:
– name: Ensure the httpd service is enabled
service:
name: httpd
enabled: yes
– name: Start the httpd service
service:
name: httpd
state: started
5. Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents.
—
– name: Create index.html in /var/www/html
hosts: localhost
become: yes
tasks:
– name: Create the directory if it doesn’t exist
file:
path: /var/www/html
state: directory
– name: Create the index.html file
copy:
content: |
<!DOCTYPE html>
<html>
<head>
<title>Dummy Page</title>
</head>
<body>
<h1>This is a dummy HTML page</h1>
</body>
</html>
dest: /var/www/html/index.html
6. Write a Ansible Playbook to reboot a self machine.
—
– name: Reboot the local machine
hosts: localhost
become: yes
tasks:
– name: Reboot the machine
reboot:
Write a Ansible Playbook to start and enable the service named “httpd”
—
– name: Start and Enable the httpd Service
hosts: rhel
become: yes
tasks:
– name: httpd install and start
service:
name: httpd
state: started
enabled: yes
Write a Ansible Playbook to reboot a self machine.
—
– name: Reboot Managed Node
hosts: centos
become: yes
tasks:
– name: Reboot the managed node
reboot:
Write a Ansible Playbook to install a package called “git”, “wget”.
—
– name: Install Git and Wget
hosts: centos
become: yes
tasks:
– name: Install Git and Wget
yum:
name:
– git
– wget
state: present
– name: Install Git and Wget on Debian-based systems
apt:
name:
– git
– wget
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
hosts: rhel
become: yes
tasks:
– name: Create group
group:
name: deploy
state: present
– name: Create user
user:
name: deploy-user
group: deploy
shell: /bin/bash
notify: Restart SSH
handlers:
– name: Restart SSH
service:
name: ssh
state: restarted
Write a Ansible Playbook to clone git repo. thttps://github.com/scmgalaxy/ansible-role-template
—
– name: Clone Repository
hosts: rhel
become: yes
tasks:
– name: Clone the GitHub repository
git:
repo: https://github.com/scmgalaxy/ansible-role-template.git
dest: /tmp/scmgalaxy