Skip to content

Instantly share code, notes, and snippets.

View hackcoderr's full-sized avatar
:octocat:
Engineering leads passionate about getting his hands dirty with new technology.

Sachin Kumar hackcoderr

:octocat:
Engineering leads passionate about getting his hands dirty with new technology.
View GitHub Profile
@hackcoderr
hackcoderr / my_script.txt
Created February 4, 2021 13:24
For deploying the Wordpress on EC2 instance
#!/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
@hackcoderr
hackcoderr / web_role-files-index.php
Created December 27, 2020 19:20
php file for webserver
<pre>
<?php
print `/usr/sbin/ifconfig`;
?>
</pre>
@hackcoderr
hackcoderr / lb_web.yml
Created December 27, 2020 17:53
Role playbook for lb and webserver
- hosts: loadBalancer
roles:
- role: "lb_role"
- hosts: webserver
roles:
- role: "web_role"
@hackcoderr
hackcoderr / web_role-tasks-main.yml
Last active December 27, 2020 19:15
Role for install webserver in managed node
---
# 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"
@hackcoderr
hackcoderr / lb_role-tasks-main.yml
Last active December 27, 2020 19:11
Role for install HAProxy Server on managed node
---
# 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"
@hackcoderr
hackcoderr / web.yml
Last active January 1, 2021 17:36
playbook your deploying the webserver with role
- hosts: tag_Name_AWS_Ansible_Instance
roles:
- role: "web_role"
@hackcoderr
hackcoderr / role-files-home.html
Created December 24, 2020 11:40
role files for ansible
<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>
---
# tasks file for web_role
- package:
name: "httpd"
state: present
- copy:
dest: "/var/www/html/"
src: "files/home.html"
@hackcoderr
hackcoderr / anisble.cfg
Last active January 1, 2021 17:37
file for Ansible configuration
[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
@hackcoderr
hackcoderr / ec2.yml
Last active December 27, 2020 11:18
Launching the ec2 instance through Ansible playbook
- 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"