-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlamp-final3.yml
67 lines (57 loc) · 1.7 KB
/
lamp-final3.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
# Setup LAMP Stack
- hosts: "{{ variable_host | default('all') }}"
become: true
pre_tasks:
- pause: seconds=30
- name: Wait for connection
wait_for_connection:
timeout: 300
ignore_errors: yes
tasks:
- name: Install tools for adding PPA repositories
apt:
name: software-properties-common
state: latest
- name: apt clean
raw: apt-get -y clean && apt-get -y autoclean
- name: Add ppa repository
apt_repository:
repo: ppa:ondrej/php
state: present
update_cache: no
- name: Purge unattended upgrades
raw: apt-get -y purge unattended-upgrades
- name: Update apt cache
raw: apt-get -y update
- name: Install lamp stack
block:
- name: Install lamp stack with php5 packages
apt:
pkg:
- apache2
- mysql-server
- php5
state: present
update_cache: yes
force_apt_get: true
rescue:
- name: Install php5.6 packages
apt:
pkg:
- php5.6
- php5.6-mysql
state: present
update_cache: yes
- name: start apache server
service:
name: apache2
state: started
enabled: yes
- name: start mysql service
service:
name: mysql
state: started
enabled: yes
- name: create target directory
file: path=/var/www/html state=directory mode=0755