Refactor server roles into one that handles all OS physical or virtual
This commit is contained in:
67
server/tasks/agnostic/main.yml
Normal file
67
server/tasks/agnostic/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
# ------------------------------------------------------------------------------
|
||||
# These tasks run for ALL servers be it Debian, CentOS, Virtual or Physical
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Copy profiles to /etc/profile.d/
|
||||
- include_tasks: ../../../../functions/copy_etc-profile.d.yml
|
||||
|
||||
# Copy scripts to /usr/local/bin
|
||||
- include_tasks: ../../../../functions/copy_usr-local-bin.yml
|
||||
|
||||
# Rsync /etc/vim
|
||||
- name: Synchronizing /etc/vim
|
||||
synchronize:
|
||||
src: vim/vim
|
||||
dest: /etc/
|
||||
delete: yes
|
||||
group: no
|
||||
owner: no
|
||||
rsync_opts:
|
||||
- "--exclude=.git"
|
||||
|
||||
- name: Sed /etc/vim/vimrc
|
||||
replace:
|
||||
path: /etc/vim/vimrc
|
||||
regexp: '~/.vim/plugged'
|
||||
replace: '/etc/vim/plugged'
|
||||
|
||||
- name: Symlink /usr/share/vim/vimfiles
|
||||
file:
|
||||
src: /etc/vim
|
||||
dest: /usr/share/vim/vimfiles
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
|
||||
# Increase number of TCP connections per port (debian default 128)
|
||||
- name: Increasing number of TCP connections per port /etc/sysctl.conf net.core.somaxconn = 4096
|
||||
sysctl:
|
||||
name: net.core.somaxconn
|
||||
value: '4096'
|
||||
reload: yes
|
||||
state: present
|
||||
|
||||
# Increase open files (ulimit), default debian 1024
|
||||
# View ulimit -a
|
||||
- name: Increase soft open file limit (ulimit)
|
||||
pam_limits:
|
||||
domain: '*'
|
||||
limit_type: soft
|
||||
limit_item: nofile
|
||||
value: '65535'
|
||||
- name: Increase hard open file limit (ulimit)
|
||||
pam_limits:
|
||||
domain: '*'
|
||||
limit_type: hard
|
||||
limit_item: nofile
|
||||
value: '65535'
|
||||
|
||||
# Enable Memory Overcommit /etc/sysctl.conf vm.overcommit_memory = 1
|
||||
# View with sysctl -a |grep max_user_watches (default on debian is 8192)
|
||||
- name: Increase fs.inotify.max_user_watches in /etc/sysctl.conf
|
||||
sysctl:
|
||||
name: fs.inotify.max_user_watches
|
||||
value: '524288'
|
||||
reload: yes
|
||||
state: present
|
||||
57
server/tasks/debian/all.yml
Normal file
57
server/tasks/debian/all.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
# ------------------------------------------------------------------------------
|
||||
# These tasks run for any Debian/Ubuntu server (physical or virtual)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Copy Debian 9 sources.list
|
||||
- name: Copying Debian 9 apt/sources.list
|
||||
copy: src=debian/9/sources.list dest=/etc/apt/sources.list
|
||||
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
|
||||
|
||||
# Copy Debian 10 sources.list
|
||||
- name: Copying Debian 10 apt/sources.list
|
||||
copy: src=debian/10/sources.list dest=/etc/apt/sources.list
|
||||
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
|
||||
|
||||
# Copy Ubuntu 16.04 sources.list
|
||||
- name: Copying Ubuntu 16.04 apt/sources.list
|
||||
copy: src=ubuntu/16.04/sources.list dest=/etc/apt/sources.list
|
||||
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04"
|
||||
|
||||
# Ignore apt translations
|
||||
- name: Ignoring apt tranlations
|
||||
copy: src=debian/99translations dest=/etc/apt/apt.conf.d/99translations
|
||||
|
||||
# Install common apps for all debian machines
|
||||
- name: Installing common Debian/Ubuntu applications
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- apt-transport-https # For https apt repos
|
||||
- openssh-server # SSH server
|
||||
- sudo # Sudo access for users
|
||||
- net-tools # Deprecated ifconfig
|
||||
- nmap # Port scanner
|
||||
- ethtool # LAN information for debugging
|
||||
- iperf # Network performance for debugging
|
||||
- sysstat # Performance stats
|
||||
- iotop # Data I/O top (for hard drive read/write analysis)
|
||||
- iftop # Network top to watch network usage
|
||||
- vim # Vim text editor
|
||||
- nano # Nano text editor
|
||||
- rsync # Rsync protocol
|
||||
- curl # Web downloader
|
||||
- wget # Web downloader
|
||||
- htop # Graphical top alternative
|
||||
- mlocate # Full-text search for all files
|
||||
- ntp # Date sync
|
||||
- zip # Zip utility
|
||||
- unzip # Unzip utility
|
||||
- gzip # Gzip utility
|
||||
- git # Git source control
|
||||
- nfs-common # Connect to a NFS server
|
||||
- cifs-utils # Connect to a Samba server
|
||||
- dos2unix # Convert dos line endings to unix and visa versa
|
||||
- acl # I customize directories often with ACL
|
||||
- dnsutils # Dig command and other dns commands
|
||||
20
server/tasks/debian/main.yml
Normal file
20
server/tasks/debian/main.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
# Debian Server
|
||||
# ------------------------------------------------------------------------------
|
||||
- name: Configuring debian/ubuntu server
|
||||
include_tasks: all.yml
|
||||
|
||||
# Physical Debian Server
|
||||
# ------------------------------------------------------------------------------
|
||||
- name: Configuring physical debian/ubuntu server
|
||||
include_tasks: physical.yml
|
||||
when: type == 'physical'
|
||||
|
||||
|
||||
# Virtual Debian Server
|
||||
# ------------------------------------------------------------------------------
|
||||
# Currently NO virtual specific debian customizations
|
||||
#- name: Configuring virtual debian/ubuntu server
|
||||
# include_tasks: virtual.yml
|
||||
# when: type == 'virtual'
|
||||
|
||||
19
server/tasks/debian/physical.yml
Normal file
19
server/tasks/debian/physical.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
# ------------------------------------------------------------------------------
|
||||
# These tasks run for physical Debian/Ubuntu servers
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Physical Debian/Ubuntu Server
|
||||
- name: Installing physical Debian/Ubuntu server applications
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- ifenslave # NIC bonding and LACP
|
||||
- bridge-utils # NIC bridging
|
||||
- vlan # NIC VLAN tagging
|
||||
- ethtool # LAN speed and blinking
|
||||
- firmware-linux # Install all firmware including nonfree and misc
|
||||
- kpartx # To examine subpartitions of VM images
|
||||
- ntfs-3g # To examine NTFS VM images
|
||||
- smartmontools # S.M.A.R.T hard drive tools
|
||||
12
server/tasks/main.yml
Normal file
12
server/tasks/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# Any server (OS agnostic)
|
||||
# ------------------------------------------------------------------------------
|
||||
- name: Configure any server (OS agnostic)
|
||||
include_tasks: agnostic/main.yml
|
||||
|
||||
|
||||
# Debian server
|
||||
# ------------------------------------------------------------------------------
|
||||
- name: Configure debian/ubuntu server
|
||||
include_tasks: debian/main.yml
|
||||
when: ansible_os_family == "Debian"
|
||||
Reference in New Issue
Block a user