Move all shared into this new repo

This commit is contained in:
2020-04-02 15:48:20 -06:00
parent 27307f26f2
commit 66fd90a649
465 changed files with 61143 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
---
# Add Elasticsearch GPG Key
- name: Addding Elasticsearch sources GPG key
apt_key: url='https://artifacts.elastic.co/GPG-KEY-elasticsearch' state=present
# Add Elasticsearch repositories for Debian 8
- name: Adding Elasticsearch sources
apt_repository: repo='deb https://artifacts.elastic.co/packages/5.x/apt stable main' state=present
# Install Elasticsearch
- name: Installing Elasticsearch
apt:
update_cache: yes
state: present
name:
- elasticsearch

View File

@@ -0,0 +1,24 @@
---
# Add Elasticsearch GPG Key
- name: Addding Elasticsearch sources GPG key
apt_key: url='https://artifacts.elastic.co/GPG-KEY-elasticsearch' state=present
# Add Elasticsearch repositories for Debian 8
- name: Adding Elasticsearch sources
apt_repository: repo='deb https://artifacts.elastic.co/packages/6.x/apt stable main' state=present
# Install Elasticsearch
- name: Installing Elasticsearch
apt:
update_cache: yes
state: present
name:
- elasticsearch
# Fix Permissions
- name: Fixing permissions on /etc/init.d/elasticsearch
file: path=/etc/init.d/elasticsearch owner=root group=root mode=0755 state=file
# Enable service in systemd (debian does not start this daemon by default, which is not the norm)
- name: Enabling elasticsearch.service systemd unit
systemd: name=elasticsearch enabled=yes state=started

View File

@@ -0,0 +1,3 @@
---
- name: restart mariadb
service: name=mariadb state=restarted

View File

@@ -0,0 +1,9 @@
---
- name: Installing mariadb
apt:
update_cache: yes
state: present
name:
- mariadb-server-10.1
- python-mysqldb # required for ansible mysql module
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"

View File

@@ -0,0 +1,3 @@
---
- name: restart mariadb
service: name=mariadb state=restarted

View File

@@ -0,0 +1,9 @@
---
- name: Installing mariadb
apt:
update_cache: yes
state: present
name:
- mariadb-server-10.3
- python-mysqldb # required for ansible mysql module
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"

View File

@@ -0,0 +1 @@
[mysql]

View File

@@ -0,0 +1,4 @@
[mysqldump]
quick
quote-names
max_allowed_packet = 16M

View File

@@ -0,0 +1,30 @@
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

View File

@@ -0,0 +1,31 @@
---
# We use the official MySQL repositories which contains many versions of MySQL
# All of these versions will be newer than comes stock with debian
# Add MySQL GPG keys
# When I tried to setup this up initially, this pgp.mit.edu site was down
# So following https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/
# I downloaded https://dev.mysql.com/downloads/repo/apt/
# and `dpkg -i mysql-apt-config_0.8.10-1_all.deb` instead (selecting mysql 5.7)
# which according to `apt-key list` did indeed install the `A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5` fingerprinted key
- name: Addding MySQL sources GPG key
apt_key: keyserver=pgp.mit.edu id=5072E1F5 state=present
# Add MySQL repositories for Debian 8
- name: Adding MySQL sources for Debian 8 Jessie
apt_repository: repo='deb http://repo.mysql.com/apt/debian/ jessie mysql-5.7' state=present
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "8"
# Add MySQL repositories for Debian 9
- name: Adding MySQL sources for Debian 9 Jessie
apt_repository: repo='deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7' state=present
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
# Install MySQL 5.7
- name: Installing MySQL 5.7
apt:
update_cache: yes
state: present
name:
- mysql-server
- python-mysqldb # Required for ansible to createdb or createuser

View File

@@ -0,0 +1,6 @@
---
# Oracle MySQL 5.7
# Install Oracle MySQL 5.7 - Debian All Versions
- include_tasks: install-debian.yml
when: ansible_os_family == "Debian"

View File

@@ -0,0 +1 @@
[mysql]

View File

@@ -0,0 +1,4 @@
[mysqldump]
quick
quote-names
max_allowed_packet = 16M

View File

@@ -0,0 +1,11 @@
#
# The Percona Server 5.7 configuration file.
#
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
# Please make any edits and changes to the appropriate sectional files
# included below.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-server.conf.d/

View File

@@ -0,0 +1,28 @@
#
# The Percona Server 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
log-error = /var/log/mysql/error.log
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

View File

@@ -0,0 +1,14 @@
#
# The Percona Server 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0

View File

@@ -0,0 +1,21 @@
---
# Add Percona repositories for Debian 9
- name: Adding Percona sources for Debian 9 Jessie
apt:
deb: https://repo.percona.com/apt/percona-release_0.1-6.stretch_all.deb
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
# Add Percona repositories for Debian 10
- name: Adding Percona sources for Debian 10 Buster
apt:
deb: https://repo.percona.com/apt/percona-release_latest.buster_all.deb
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
# Install Percona Server 5.7
- name: Installing MySQL Percona Server 5.7
apt:
update_cache: yes
state: present
name:
- percona-server-server-5.7
- python-mysqldb # Required for ansible to createdb or createuser

View File

@@ -0,0 +1,6 @@
---
# Percona Server 5.7
# Install Percona MySQL 5.7 - Debian All Versions
- include_tasks: install-debian.yml
when: ansible_os_family == "Debian"

View File

@@ -0,0 +1,26 @@
---
# We use the official PostgreSQL repositories which contains many versions of PostgreSQL
# Most of these versions will be newer than comes stock with debian
# Add GPG keys
- name: Addding PostgreSQL sources GPG key
apt_key: url='https://www.postgresql.org/media/keys/ACCC4CF8.asc' state=present
# Add PostgreSQL repositories for Debian 9
- name: Adding PostgreSQL sources for Debian 9 Jessie
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' state=present
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
# Add PostgreSQL repositories for Ubuntu 16.04
- name: Adding PostgreSQL sources for Ubuntu 16.04
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' state=present
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04"
# Install PostgreSQL 10
- name: Installing PostgreSQL 10
apt:
update_cache: yes
state: present
name:
- postgresql-10
- python-psycopg2 # Required for ansible postgres manipulation

View File

@@ -0,0 +1,6 @@
---
# postgresql-10
# Install PostgreSQL 10 - Debian and Ubuntu
- include_tasks: install-debian.yml
when: ansible_os_family == "Debian"

View File

@@ -0,0 +1,21 @@
---
# We use the official PostgreSQL repositories which contains many versions of PostgreSQL
# Most of these versions will be newer than comes stock with debian
# Add GPG keys
- name: Addding PostgreSQL sources GPG key
apt_key: url='https://www.postgresql.org/media/keys/ACCC4CF8.asc' state=present
# Add PostgreSQL repositories for Debian 9
- name: Adding PostgreSQL sources for Debian 9 Jessie
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' state=present
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
# Install PostgreSQL 10
- name: Installing PostgreSQL 9.6
apt:
update_cache: yes
state: present
name:
- postgresql-9.6
- python-psycopg2 # Required for ansible postgres manipulation

View File

@@ -0,0 +1,6 @@
---
# postgresql-9.6
# Install PostgreSQL 9.6 - Debian All Versions
- include_tasks: install-debian.yml
when: ansible_os_family == "Debian"

View File

@@ -0,0 +1,9 @@
[Unit]
Description=Disable Transparent Huge Pages (THP)
[Service]
Type=simple
ExecStart=/bin/sh -c "echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled && echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag"
[Install]
WantedBy=multi-user.target

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
---
- name: restart redis
service: name=redis-server state=restarted
- name: disable thp
systemd:
name: disable-thp.service
daemon_reload: yes
enabled: yes
state: started

40
db/redis/tasks/main.yml Normal file
View File

@@ -0,0 +1,40 @@
---
- name: Installing redis
apt:
update_cache: yes
state: present
name: redis-server
# Enable Memory Overcommit /etc/sysctl.conf vm.overcommit_memory = 1
# View with sysctl -a |grep overcommit
- name: Enable Memory Overcommit /etc/sysctl.conf vm.overcommit_memory = 1
sysctl:
name: vm.overcommit_memory
value: 1
reload: yes
state: present
notify: restart redis # Only runs if file changed!
# Disable Swapping /etc/sysctl.conf vm.swappiness = 0
- name: Setting /etc/sysctl.conf vm.swappiness = 0
sysctl:
name: vm.swappiness
value: 0
reload: yes
state: present
notify: restart redis # Only runs if file changed!
# Disable THP (Transparent Huge Pages)
# View with cat /sys/kernel/mm/transparent_hugepage/enabled
# View with cat /sys/kernel/mm/transparent_hugepage/defrag
# Copy systemd unit /etc/systemd/system/disable-thp.service
- name: Disable Transperent Huge Pages using Systemd unit /etc/systemd/system/disable-thp.service
template:
src: "files/disable-thp.service"
dest: "/etc/systemd/system/disable-thp.service"
owner: root
group: root
mode: 0644 # -rw-r--r--
notify:
- disable thp
- restart redis # Only runs if file changed!