Skip to content

Latest commit

 

History

History
44 lines (38 loc) · 1014 Bytes

lamp-stack-ansible-playbook.md

File metadata and controls

44 lines (38 loc) · 1014 Bytes
---
# Setup LAMP Stack
-  hosts: host1
   tasks:
 
      -  name: Add ppa repository
         become: yes
         apt_repository: repo=ppa:ondrej/php
 
      -  name: Install lamp stack
         become: yes
         apt:
            pkg:
              - apache2   
              - mysql-server
              - php7.0
              - php7.0-mysql   
            state: present
            update cache: yes
 
      -  name: start apache server
          become: yes
          service: 
              name: apache2
               state: started
                enabled: yes
 
      -  name: start mysql service
          become: yes
          services:
             name: mysql
             state: started
             enabled: yes
 
      -  name:  create target directory
          file: path=/var/www/html state=directory mode=0755
 
      - name:  deploy index.html
         became: yes
          copy: 
              src: /etc/ansible/index/index.html
              dest: var/www/html/index/index.html