-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall-web.yml
155 lines (125 loc) · 3.97 KB
/
install-web.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
- hosts: aws
gather_facts: False
become: yes
pre_tasks:
- name: Install python for Ansible
become: yes
raw: test -e /usr/bin/python || (sudo apt -y update && apt install -y python-minimal)
register: output
changed_when: output.stdout != ""
- setup: # aka gather_facts
tasks:
- ping:
- name: Install Nginx SOFTWARE to WEB EC2
become: yes
apt: name=nginx state=present
- name: start nginx
service:
name: nginx
state: started
- name: PIP SETUP
shell: apt install -y python-pip
become: yes
- name: Install AMAZON CLI
become: yes
shell: pip install awscli --upgrade --user
- name: Install software-properties-common
become: yes
apt: name=software-properties-common state=present
- name: Add PHP 7 PPA repository
become: true
apt_repository:
repo: 'ppa:ondrej/php'
- name: Install PHP 7-1 with modules
become: yes
apt:
pkg:
- php7.1-fpm
- php7.1-cli
- php7.1-mysqlnd
- php7.1-bcmath
- php7.1-curl
- php7.1-soap
- php7.1-xml
- php7.1-zip
- php7.1-json
- php7.1-mcrypt
- php7.1-intl
- php7.1-mbstring
- php7.1-zip
- php7.1-gd
- php7.1-redis
- redis-tools
- mysql-client
- htop
- s3fs
- awscli
- wget
- ruby #for AWS deployment agent https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-ubuntu.html
- cloud-utils #aws cloud utils command ec2metadata
state: present
## AWS Credential
## - The files generated by the CLI for the profile configured in the previous section look like this.
## ~/.aws/credentials
## [default]
## aws_access_key_id=AKIAIOSFODNN7EXAMPLE
## aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
## ~/.aws/config
## [default]
## region=us-west-2
## output=json
- name: start php-fpm
service:
name: php7.1-fpm
state: started
- name: PHP version and Modules
shell: php -v && php -m
register: php_info
- name: PHP.ini timezone set America/Los_Angeles
ini_file:
path: /etc/php/7.1/fpm/php.ini
section: Date
option: date.timezone
value: America/Los_Angeles
mode: 0600
backup: yes
- debug: var=php_info.stdout_lines
- name: Install GIT
apt: pkg={{item}} state=installed
become: yes
with_items:
- git
## Composer Install!
- name: Check if Composer is installed.
stat: "path=/usr/bin/composer"
register: composer_bin
- name: Download composer installer
get_url:
url: https://getcomposer.org/installer
dest: /tmp/composer-installer
mode: 0755
when: not composer_bin.stat.exists
- name: Install composer using PHP
shell: php composer-installer
args:
chdir: /tmp/
when: not composer_bin.stat.exists
- name: Move composer file to /user/local/bin
become: yes
shell: mv composer.phar /usr/local/bin/composer
args:
chdir: /tmp/
when: not composer_bin.stat.exists
- name: Move composer file to /user/local/bin
become: yes
shell: wget https://aws-codedeploy-us-west-1.s3.amazonaws.com/latest/install && chmod +x ./install && sudo ./install auto && sudo service codedeploy-agent start && sudo update-rc.d codedeploy-agent defaults
args:
chdir: /home/ubuntu
## For code deploy AWS EC2 mast have deploy role profile https://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-create-iam-instance-profile.html
- name: Create symbolic link
become: yes
file:
src: /usr/local/bin/composer
dest: /usr/bin/composer
state: link
when: not composer_bin.stat.exists