practical 1

 We are tasked to deploy an HTTP webserver using Ansible Playbooks. Install apache web server on all the hosts in the inventory /home/thor/playbooks/inventory. Note that they are of different flavours i,e. Ubuntu and CentOS.


Develop a playbook /home/thor/playbooks/install_apache.yml that would install apache on both Ubuntu and CentOS. Note that the package name is apache2 on Ubuntu and httpd on CentOS

=======================================


---

- name: Install apache

  hosts: all

  gather_facts: yes

  tasks:

    - name: install ubuntu

      package:

         name: apache2

         state: prersent

      when: ansible_distribution == "Ubuntu"




    - name: install centso

      package:

         name: httpd

         state: present

      when: ansible_distribution == "CentosOS"

Comments

Popular posts from this blog

exam 16

ansible 5

practical 3