- name: Write a Ansible Playbook to create a group called “deploy” hosts: localhost
tasks:
- name: Group deploy
ansible.builtin.group:
name: deploy
state: present
- name: Write a Ansible Playbook to create a user called “deploy-user” which is part of group called “deploy” and with /bin/bash shell. hosts: localhost
tasks:
- name: User deploy
ansible.builtin.user:
name: deploy-user
state: present
group: deploy
shell: /bin/bash
- name: Write a Ansible Playbook to install package named “httpd” in RHEL/centos. hosts: localhost
tasks:
- name: Install httpd package
ansible.builtin.yum:
name: httpd
state: latest
- name: Write a Ansible Playbook to start and enable the service named “httpd” hosts: localhost
tasks:
- name: start httpd service
ansible.builtin.service:
name: httpd
state: started
- name: Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents. hosts: localhost
tasks:
- name: Create file ansible.builtin.file: path: /var/www/html/index.html state: touch
- name: copy file
ansible.builtin.copy:
dest: /var/www/html/index.html
content: '
thi is my ansible training
'- name: Write a Ansible Playbook to install package named “httpd” in RHEL/centos. hosts: localhost
tasks:
- name: Remove git package ansible.builtin.yum: name: git state: absent name: wget state: absent
- name: Install git package
ansible.builtin.yum:
name: git
state: present
name: wget
state: present
- name: Write a Ansible Playbook to clone git repo. https://github.com/scmgalaxy/ansible-role-template hosts: localhost
tasks:
- name: Clone a github repository ansible.builtin.git: repo: https://github.com/scmgalaxy/ansible-role-template dest: /usr/bin/surya clone: yes update: yes
Top comments (0)