Ansible Playbook for Apache

 ---

- hosts: 10.200.20.150

  user: root

  become: true


  vars:

    mysql_root_password: secrete password


  tasks:

    - name: Make sure we can connect

      ping:

    - name: Install Apache

      yum: pkg=httpd state=latest

    - name: Copying the demo file

      template: src=./provisioning/index.html dest=/var/www/html

                owner=apache group=apache mode=0644

    - name: Enable Apache on System Boot

      service: name=httpd enabled=yes


      notify:

        - start apache

        - setup firewalld

        - reload firewalld


      handlers:

        - name: start apache

          service: name=httpd state=started

        - name: setup firewalld

          firewalld:

            service: http

            permanent: true

            state: enabled

        - name: reload firewalld

          service: name=firewalld state=restarted


    - name: Install PHP

      yum: name={{item}} state=installed

      with_items:

        - php

        - php-fpm

        - php-mysql

        - php-xml

    - name: Install MySQL

      yum: 

        name={{item}} state=installed

      with_items:

        - mysql-server-5.6

        - python-mysqldb

Comments

Popular Posts