-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathansible_bash.sh
68 lines (52 loc) · 1.52 KB
/
ansible_bash.sh
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
#!/bin/bash
#install ansible
yum install wget -y
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
rpm -ivh epel-release-7-8.noarch.rpm
yum install ansible -y
cd $HOME
mkdir -p ansible-nginx/tasks/
touch ansible-nginx/deploy.yml
touch ansible-nginx/tasks/install_nginx.yml
#populate deploy.yml
echo -e "# ./ansible-nginx/deploy.yml
- hosts: localhost
tasks:
- include: 'tasks/install_nginx.yml'" > $HOME/ansible-nginx/deploy.yml
#populate install_nginx.yml
echo -e "# ./ansible-nginx/tasks/install_nginx.yml
- name: NGINX | Installing NGINX repo rpm
yum:
name: http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
- name: NGINX | Installing NGINX
yum:
name: nginx
state: latest
- name: NGINX | Starting NGINX
service:
name: nginx
state: started
" > $HOME/ansible-nginx/tasks/install_nginx.yml
#install nginx
sudo ansible-playbook -c local $HOME/ansible-nginx/deploy.yml
#populate with index.html
echo -e "<html>
<head>
<title>NWEA tech_quiz sample index.html</title>
</head>
<body bgcolor=white>
<table border="0" cellpadding="10">
<tr>
<td>
<h1>Hello, this is the sample page</h1>
</td>
</tr>
</table>
</body>
</html>" > /usr/share/nginx/html/index.html
#edit default.conf to listen on port 8888
sed -i -e 's/80/8888/g' /etc/nginx/conf.d/default.conf
#configure se linux to allow systemctl to function
semanage permissive -a "httpd_t"
#reload nginx
systemctl restart nginx.service