-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
1,026 additions
and
265 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[AnsiPress] | ||
AnsiPress.local | ||
AnsiPress.ubuntu | ||
AnsiPress.debian |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: service ntp restart | ||
service: name=ntp state=restarted |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
# Install NTP | ||
- name: Installing NTP Service, Hold on... | ||
apt: name=ntp state=present | ||
notify: service ntp restart |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
--- | ||
# Setup TimeZone | ||
# AnsiPress Server TimeZone | ||
# Why you need UTC TimeZone - | ||
# http://yellerapp.com/posts/2015-01-12-the-worst-server-setup-you-can-make.html | ||
|
||
# Dont Forget to Update TimeZone in PHP (UTC) | ||
- name: Setup Timezone to UTC, Hold on... | ||
timezone: name={{ timezone }} | ||
timezone: name=Etc/UTC |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
# Setup UMASK for Better Security | ||
- name: Setup UMASK, Hold on... | ||
lineinfile: | ||
dest: "/etc/profile" | ||
regexp: "{{ item.regexp }}" | ||
line: "{{ item.line }}" | ||
with_items: | ||
- { regexp: '^umask', line: 'umask 0027' } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# Print Userful Information | ||
|
||
- name: AnsiPress HTTP Auth Details, Hold on... | ||
debug: | ||
msg: "{{ item }}" | ||
with_items: | ||
- HTTP AUTH Username = AnsiPress | ||
- HTTP AUTH Password = {{ http_auth_pass }} | ||
when: setup_http_auth.stat.islnk is not defined | ||
|
||
- name: Getting WordPress Setup Information, Hold on... | ||
debug: | ||
msg: "{{ item }}" | ||
with_items: | ||
- WordPress Username = {{ username | lower }} | ||
- WordPress Password = {{ random_password.stdout }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# We had include service restart module | ||
# Also we have to passs service_name variable which trigger | ||
# service {{ service_name }} restart | ||
- name: service fail2ban restart | ||
service: name=fail2ban state=restarted |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Installing Fail2ban, Hold on... | ||
apt: name={{ item }} state=present | ||
with_items: | ||
- fail2ban | ||
register: package_install | ||
# The notify will call the ../handlers/main.yml | ||
notify: service fail2ban restart | ||
|
||
- name: Copying Fail2ban Configuration File, Hold on... | ||
template: | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
with_items: | ||
- { src: "../templates/fail2ban/jail.local", dest: "/etc/fail2ban/jail.local" } | ||
- { src: "../templates/fail2ban/nginx-req-limit.conf", dest: "/etc/fail2ban/filter.d/nginx-req-limit.conf" } | ||
when: package_install.changed == True |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
- include: roles/security/tasks/fail2ban.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[DEFAULT] | ||
|
||
bantime = {{ bantime }} | ||
ignoreip = {{ ignoreip }} | ||
|
||
# Override /etc/fail2ban/jail.d/00-firewalld.conf: | ||
banaction = iptables-multiport | ||
|
||
[sshd] | ||
enabled = true | ||
|
||
[sshd-ddos] | ||
enabled = true | ||
|
||
[php-url-fopen] | ||
enabled = true | ||
|
||
[nginx-http-auth] | ||
enabled = true | ||
logpath = /var/log/nginx/*error.log | ||
|
||
[nginx-botsearch] | ||
enabled = true | ||
logpath = /var/log/nginx/*error.log | ||
|
||
[nginx-req-limit] | ||
enabled = true | ||
filter = nginx-req-limit | ||
action = iptables-multiport[name=ReqLimit, port="http,https", protocol=tcp] | ||
logpath = /var/log/nginx/*error.log | ||
findtime = 600 | ||
bantime = 7200 | ||
maxretry = 10 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Fail2Ban configuration file | ||
# | ||
# supports: ngx_http_limit_req_module module | ||
|
||
[Definition] | ||
|
||
failregex = limiting requests, excess:.* by zone.*client: <HOST> | ||
|
||
# Option: ignoreregex | ||
# Notes.: regex to ignore. If this regex matches, the line is ignored. | ||
# Values: TEXT | ||
# | ||
ignoreregex = |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: service memcached restart | ||
service: name=memcached state=restarted | ||
|
||
- name: service nginx restart | ||
service: name=nginx state=restarted | ||
|
||
- name: service php7.1-fpm restart | ||
service: name=php7.1-fpm state=restarted | ||
|
||
- name: service mysql restart | ||
service: name=mysql state=restarted |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# Setup MySQL Repository | ||
|
||
- name: Adding MariaDB Repository Key, Hold on... | ||
apt_key: keyserver=keyserver.ubuntu.com id=0xcbcb082a1bb943db | ||
register: apt_key | ||
|
||
- name: Adding MariaDB Repository, Hold on... | ||
apt_repository: repo='deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} main' state=present filename=mariadb | ||
register: repository | ||
|
||
- include: roles/libs/tasks/apt/update.yml | ||
when: repository.changed == True or apt_key.changed == True |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# Setup NGINX Repository | ||
|
||
- name: Adding NGINX Repository Key, Hold on... | ||
apt_key: | ||
id: B9C9F7DE | ||
url: http://download.opensuse.org/repositories/home:AnsiPress/{{ ansible_distribution }}_8.0/Release.key | ||
register: apt_key | ||
when: ansible_distribution == 'Debian' | ||
|
||
- name: Adding NGINX Repository, Hold on... | ||
apt_repository: repo='deb http://download.opensuse.org/repositories/home:/AnsiPress/{{ ansible_distribution }}_8.0/ /' state=present filename=nginx | ||
register: repository | ||
when: ansible_distribution == 'Debian' | ||
|
||
- include: roles/libs/tasks/apt/update.yml | ||
when: repository.changed == True or apt_key.changed == True |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
# Setup PHP Repository | ||
|
||
- name: Adding PHP Repository Key, Hold on... | ||
apt_key: | ||
url: https://packages.sury.org/php/apt.gpg | ||
register: apt_key | ||
when: ansible_distribution == 'Debian' | ||
|
||
- name: Adding PHP Repository, Hold on... | ||
apt_repository: repo='deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main' state=present filename=php | ||
register: repository | ||
when: ansible_distribution == 'Debian' | ||
|
||
- include: roles/libs/tasks/apt/update.yml | ||
when: repository.changed == True or apt_key.changed == True |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- include: roles/stack/tasks/memcached.yml | ||
|
||
- name: Checking NGINX Stack Required, Hold on... | ||
set_fact: stack="nginx" | ||
when: website_type == "html" | ||
|
||
- name: Checking PHP Stack Required, Hold on... | ||
set_fact: stack="php" | ||
when: website_type == "php" | ||
|
||
- name: Checking MySQL Stack Required, Hold on... | ||
set_fact: stack="mysql" | ||
when: website_type == "mysql" or website_type == "wp" or website_type == "w3tc" or website_type == "wpfc" | ||
|
||
- include: roles/stack/tasks/{{ stack }}.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
# Install Memcached | ||
- name: Installing Memcached, Hold on... | ||
apt: name=memcached state=present | ||
notify: service memcached restart |
Oops, something went wrong.