Day 88: Ansible Blockinfile Module

(topic deleted by author)

Hi Guys, I’ve got on Day 88.

playbook.yml

  • name: Install/configrure httpd on web servers
    hosts: all
    become: yes
    tasks:
    • name: Install httpd package
      ansible.builtin.yum:
      name: httpd
      state: present

    • name: Ensure httpd is started and enabled
      ansible.builtin.service:
      name: httpd
      state: started
      enabled: yes

    • name: Deploy custom index.html
      ansible.builtin.blockinfile:
      path: /var/www/html/index.html
      block: |
      Welcome to XfusionCorp!

      This is  Nautilus sample file, created using
      Ansible!
      
      Please do not modify this file manually!
      

      create: yes

    • name: Change file ownership, group and permissions
      ansible.builtin.file:
      path: /var/www/html/index.html
      owner: apache
      group: apache
      mode: “0755”