This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum install php-mysqlnd php-fpm mariadb-server httpd tar curl php-json wget -y | |
amazon-linux-extras install php7.3 | |
curl https://wordpress.org/latest.tar.gz --output wordpress.tar.gz | |
tar xf wordpress.tar.gz | |
cp -r wordpress /var/www/html | |
systemctl start httpd | |
systemctl enable httpd | |
setenforce 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
<?php | |
print `/usr/sbin/ifconfig`; | |
?> | |
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: loadBalancer | |
roles: | |
- role: "lb_role" | |
- hosts: webserver | |
roles: | |
- role: "web_role" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# tasks file for web_role | |
- name: "installing the httpd server" | |
package: | |
name: "httpd" | |
state: present | |
- name: "installing the php on the webserver" | |
package: | |
name: "php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# tasks file for lb_role | |
- name: "installing the haproxy software into loadBalancer" | |
package: | |
name: "haproxy" | |
state: present | |
- name: "copying the haproxy.cfg.j2 file to the loadBalancer" | |
template: | |
dest: "/etc/haproxy/haproxy.cfg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: tag_Name_AWS_Ansible_Instance | |
roles: | |
- role: "web_role" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<body bgcolor=grey> | |
<center> | |
<h1 style="color:blue" >Deploying Apache Web Server on AWS Instance through Ansible Role </h1> | |
</center> | |
</body> | |
</head> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# tasks file for web_role | |
- package: | |
name: "httpd" | |
state: present | |
- copy: | |
dest: "/var/www/html/" | |
src: "files/home.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[defaults] | |
inventory=/home/ec2-user/hosts | |
host_key_checking = False | |
private_key_file=/home/ec2-user/key.pem | |
ask_pass=false | |
roles_path= /home/ec2-user/aws | |
[privilege_escalation] | |
become=true | |
become_method=sudo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: "localhost" | |
vars_files: | |
- secrets.yml | |
tasks: | |
- name: "Provisioning OS on AWS using Ansible" | |
ec2: | |
key_name: "key" | |
instance_type: "t2.micro" | |
image: "ami-0a9d27a9f4f5c0efc" |
NewerOlder