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 / main.yml
Created December 20, 2020 13:42
Ansible Playbook for Task14.3
- hosts: httpd
vars_files:
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml"
tasks:
- name: Install web server software
package:
name: "{{ package_name }}"
state: present
@hackcoderr
hackcoderr / Ubuntu-20.yml
Created December 20, 2020 13:41
Ubuntu-20 Ansible playbook
package_name: apache2
service_name: apache2
doc_root: /var/www/html
@hackcoderr
hackcoderr / RedHat-8.yml
Last active December 20, 2020 13:40
RedHat-8 Ansible playbook
package_name: httpd
service_name: httpd
doc_root: /var/www/html
@hackcoderr
hackcoderr / web.conf
Created December 12, 2020 07:10
Create a configuration file for webserver with .conf extension
Listen {{ http_port }}
<Virtualhost {{ ansible_facts['default_ipv4']['address'] }}:{{ http_port }}>
DocumentRoot {{ doc_root }}
</Virtualhost>
@hackcoderr
hackcoderr / httpd.yml
Last active December 11, 2020 18:38
How to retain Idempotency in Ansible while restarting HTTPD service ?
- hosts: httpd
vars_prompt:
- name: "doc_root"
prompt: "Enter document root name "
private: no
- name: "http_port"
prompt: "Enter port no "
private: no
tasks:
@hackcoderr
hackcoderr / haproxy.yml
Last active January 8, 2022 17:07
Deploying Apache webserver, configuring & updating HAProxy dynamically using Ansible
- hosts: webserver
tasks:
- name: "installing the httpd server"
package:
name: "httpd"
state: present
- name: "installing the php on the webserver"
package:
name: "php"
hadoop_path: "/home/ec2-user/hadoop-1.2.1-1.x86_64.rpm"
jdk_path: "/home/ec2-user/jdk-8u171-linux-x64.rpm"
hadoop_software: "/root/hadoop-1.2.1-1.x86_64.rpm"
jdk_software: "/root/jdk-8u171-linux-x64.rpm"
core_site: "/home/ec2-user/client_files/core-site.xml"
- hosts: client
vars_files:
- client_var.yml
tasks:
- name: "Copying the hadoop File"
copy:
src: "{{ hadoop_path }}"
dest: "/root/"
- name: "Copying the JDK File"
copy:
hadoop_path: "/home/ec2-user/hadoop-1.2.1-1.x86_64.rpm"
jdk_path: "/home/ec2-user/jdk-8u171-linux-x64.rpm"
hadoop_software: "/root/hadoop-1.2.1-1.x86_64.rpm"
jdk_software: "/root/jdk-8u171-linux-x64.rpm"
core_site: "/home/ec2-user/datanode_files/core-site.xml"
- hosts: datanode
vars_files:
- data_var.yml
tasks:
- name: "Copying the hadoop File"
copy:
src: "{{ hadoop_path }}"
dest: "/root/"
- name: "Copying the JDK File"
copy: