forked from HawksRepos/PTS-Team
-
Notifications
You must be signed in to change notification settings - Fork 55
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
MrDoobPG
authored and
MrDoobPG
committed
Sep 15, 2019
1 parent
4b6acd0
commit ef60576
Showing
13 changed files
with
440 additions
and
3 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
File renamed without changes.
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,14 @@ | ||
#!/bin/sh -e | ||
# | ||
# rc.local | ||
# | ||
# This script is executed at the end of each multiuser runlevel. | ||
# Make sure that the script will "exit 0" on success or any other | ||
# value on error. | ||
# | ||
# In order to enable or disable this script just change the execution | ||
# bits. | ||
# | ||
# By default this script does nothing. | ||
|
||
exit 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
######################################################################### | ||
# Title: Cloudbox: System Handler # | ||
# Author(s): desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: update locales | ||
command: dpkg-reconfigure --frontend noninteractive locales | ||
|
||
- name: update tzdata | ||
command: dpkg-reconfigure --frontend noninteractive tzdata |
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,36 @@ | ||
######################################################################### | ||
# Title: Cloudbox: System Role # | ||
# Author(s): l3uddz, desimaniac, EnorMOZ # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: APT tasks | ||
include_tasks: "subtasks/apt.yml" | ||
|
||
- name: Network tasks | ||
import_tasks: "subtasks/network.yml" | ||
|
||
- name: SYSCTL tasks | ||
include_tasks: "subtasks/sysctl.yml" | ||
|
||
- name: Check if intel_pstate directory exists. | ||
stat: | ||
path: /sys/devices/system/cpu/intel_pstate | ||
register: p | ||
|
||
- name: CPU Frequency tasks | ||
include_tasks: "subtasks/cpufrequency.yml" | ||
when: p.stat.isdir is defined and p.stat.isdir | ||
|
||
- name: Remove CPU Power task | ||
include_tasks: "subtasks/remove_cpupower.yml" | ||
|
||
- name: Set Locale task | ||
import_tasks: "subtasks/locale.yml" | ||
tags: set-locale | ||
|
||
- meta: flush_handlers |
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,65 @@ | ||
######################################################################### | ||
# Title: System: APT Tasks # | ||
# Author(s): l3uddz, desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: Set env variables | ||
set_fact: | ||
env_vars: | ||
DEBIAN_FRONTEND: noninteractive | ||
DEBIAN_PRIORITY: critical | ||
|
||
- name: Fix any potential dpkg issues | ||
shell: dpkg --configure --pending | ||
|
||
- name: Kill existing apt and apt-get | ||
shell: "killall apt apt-get >/dev/null 2>&1 || :" | ||
ignore_errors: yes | ||
|
||
- name: Fix any potential apt issues | ||
shell: apt-get install --fix-broken --quiet --yes | ||
environment: "{{ env_vars }}" | ||
ignore_errors: yes | ||
|
||
- name: Install required packages | ||
apt: | ||
state: present | ||
name: | ||
- apt-utils | ||
- byobu | ||
|
||
- name: APT update | ||
apt: | ||
update_cache: yes | ||
ignore_errors: yes | ||
|
||
# https://serverfault.com/a/839563 | ||
# https://raymii.org/s/tutorials/Silent-automatic-apt-get-upgrade.html | ||
- name: APT upgrade | ||
shell: apt-get upgrade --quiet --yes --allow-unauthenticated -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" | ||
environment: "{{ env_vars }}" | ||
when: not continuous_integration | ||
ignore_errors: yes | ||
|
||
# https://serverfault.com/a/839563 | ||
# https://raymii.org/s/tutorials/Silent-automatic-apt-get-upgrade.html | ||
- name: APT dist-upgrade | ||
shell: apt-get dist-upgrade --quiet --yes --allow-unauthenticated -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" | ||
environment: "{{ env_vars }}" | ||
when: not continuous_integration | ||
ignore_errors: yes | ||
|
||
- name: Remove useless packages from the cache | ||
apt: | ||
autoclean: yes | ||
ignore_errors: yes | ||
|
||
- name: Remove dependencies that are no longer required | ||
apt: | ||
autoremove: yes | ||
ignore_errors: yes |
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,68 @@ | ||
######################################################################### | ||
# Title: System: CPU Frequency Tasks # | ||
# Author(s): l3uddz, EnorMOZ, desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: Install 'cpufrequtils' | ||
apt: | ||
name: cpufrequtils | ||
state: present | ||
|
||
- name: Install 'linux-tools' for Ubuntu | ||
apt: | ||
state: present | ||
name: | ||
- linux-tools-common | ||
- linux-tools-generic | ||
when: ansible_distribution == 'Ubuntu' | ||
|
||
- name: Install 'linux-tools' for Debian | ||
apt: | ||
name: linux-tools | ||
state: present | ||
when: ansible_distribution == 'Debian' | ||
|
||
- name: "Install linux-tools-{{ ansible_kernel }}" | ||
shell: "apt-get install -qq $(apt-cache search -n linux-tools-{{ ansible_kernel }} | awk '{print $1}' | tail -n 1)" | ||
ignore_errors: yes | ||
|
||
- name: Check /etc/default/cpufrequtils exists | ||
stat: | ||
path: /etc/default/cpufrequtils | ||
register: cpufrequtils_file | ||
|
||
- name: Create /etc/default/cpufrequtils | ||
file: | ||
path: /etc/default/cpufrequtils | ||
state: touch | ||
when: not cpufrequtils_file.stat.exists | ||
|
||
- name: Set CPU frequency scaling governor to performance | ||
lineinfile: | ||
path: "/etc/default/cpufrequtils" | ||
regexp: '^GOVENOR\s?=' | ||
line: 'GOVENOR="performance"' | ||
state: present | ||
|
||
- name: Set CPU frequency scaling governor to performance | ||
lineinfile: | ||
path: "/etc/default/cpufrequtils" | ||
regexp: '^GOVERNOR\s?=' | ||
line: 'GOVERNOR="performance"' | ||
state: present | ||
|
||
- name: Ensure governor is enabled | ||
lineinfile: | ||
path: "/etc/default/cpufrequtils" | ||
regexp: '^ENABLE\s?=' | ||
line: 'ENABLE="true"' | ||
state: present | ||
|
||
- name: Disable ondemand CPU frequency scaling daemon | ||
shell: "update-rc.d ondemand disable" | ||
when: ansible_distribution_version == "16.04" |
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,36 @@ | ||
######################################################################### | ||
# Title: System: Locale Tasks # | ||
# Author(s): desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: "Install 'locales'" | ||
apt: | ||
name: locales | ||
state: present | ||
|
||
- name: "Generate 'locales'" | ||
locale_gen: | ||
name: "en_US.UTF-8" | ||
state: present | ||
notify: update locales | ||
|
||
- name: "Uncomment 'LANG='" | ||
replace: | ||
path: "/etc/default/locale" | ||
regexp: '^#(LANG=.*)' | ||
replace: '\1' | ||
|
||
- name: "Set Default 'locale'" | ||
ini_file: | ||
path: "/etc/default/locale" | ||
section: null | ||
option: "LANG" | ||
value: "en_US.UTF-8" | ||
state: present | ||
no_extra_spaces: yes | ||
notify: update locales |
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,63 @@ | ||
######################################################################### | ||
# Title: System: Network Tasks # | ||
# Author(s): desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: Install common packages | ||
apt: | ||
state: present | ||
name: | ||
- vnstat | ||
- pciutils | ||
|
||
- block: | ||
|
||
- name: Check for '/etc/vnstat.conf' | ||
stat: | ||
path: "/etc/vnstat.conf" | ||
register: vnstat_conf | ||
|
||
- name: Set vnstat to proper default interface | ||
lineinfile: | ||
path: "/etc/vnstat.conf" | ||
regexp: '(Interface)\s?.*' | ||
line: '\1 "{{ ansible_default_ipv4.interface }}"' | ||
state: present | ||
backrefs: yes | ||
when: (vnstat_conf.stat.exists) | ||
|
||
- name: Import rc.local if missing | ||
copy: | ||
src: "etc/rc.local" | ||
dest: "/etc/rc.local" | ||
owner: "root" | ||
group: "root" | ||
mode: 0755 | ||
force: no | ||
|
||
- name: Get nic info | ||
shell: lspci | ||
register: nic | ||
|
||
- name: Disable TSO / TX | ||
blockinfile: | ||
path: "/etc/rc.local" | ||
state: present | ||
create: no | ||
marker: "### {mark} CLOUDBOX MANAGED BLOCK ###" | ||
block: | | ||
/sbin/ifconfig {{ ansible_default_ipv4.interface }} txqueuelen 10000 | ||
ethtool -G {{ ansible_default_ipv4.interface }} rx 4096 tx 4096 | ||
ethtool -K {{ ansible_default_ipv4.interface }} tso off tx off | ||
insertbefore: "^exit 0" | ||
owner: "root" | ||
group: "root" | ||
mode: 0755 | ||
when: ('I218' in nic.stdout) or ('I219' in nic.stdout) | ||
|
||
when: (ansible_default_ipv4 is defined) and (ansible_default_ipv4.type == "ether") |
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,29 @@ | ||
######################################################################### | ||
# Title: System: Remove CPU Power Tasks # | ||
# Author(s): desimaniac # | ||
# URL: https://github.com/cloudbox/cloudbox # | ||
# -- # | ||
# Part of the Cloudbox project: https://cloudbox.works # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
- name: Check if cpupower.service exists | ||
stat: | ||
path: "/etc/systemd/system/cpupower.service" | ||
register: cpupower_service | ||
|
||
- name: Stop and disable cpupower.service | ||
systemd: | ||
state: stopped | ||
name: cpupower | ||
daemon_reload: yes | ||
enabled: no | ||
ignore_errors: yes | ||
when: cpupower_service.stat.exists | ||
|
||
- name: Delete cpupower.service | ||
file: | ||
path: /etc/systemd/system/cpupower.service | ||
state: absent | ||
when: cpupower_service.stat.exists |
Oops, something went wrong.