opsxcq.linux_server
Linux Server Role
This role sets up a basic configuration for a Debian Linux server that includes:
- Docker
- Monitoring using Prometheus (with Node Exporter and cAdvisor)
- Configuration of kernel parameters
- Installation of basic tools and packages
- Importing SSH and GPG keys from GitHub
Example Playbook
Here’s an example of a playbook:
- hosts: all
vars:
hostname: "template"
domain: "strm.sh"
network:
ip: "192.168.0.9"
cidr: "/24"
gateway: "192.168.0.1"
dns:
- "8.8.8.8"
- "1.1.1.1"
extra_ips:
- "192.168.0.2"
- "192.168.0.3"
- "192.168.0.4"
extra_raw: |-
iface tun0 inet static
address 10.0.0.8/24
static_hosts: "{{ lookup('file', 'hosts') }}"
loki:
url: 'http://loki.strm.sh:3100/loki/api/v1/push'
github_user: opsxcq
tasks:
- debug:
msg: "Your other tasks here"
roles:
- ../..
Optional Variables:
network.cidr
: Defaults to/24
.static_hosts
: If this variable is not set, the/etc/hosts
file will not be changed.loki
: If this is defined, it will configure system and container logs to be sent to Loki.
Requirements File
- src: git+https://github.com/opsxcq/ansible-role-linux-server.git
name: "opsxcq.linux_server"
Tmux Configuration
Tmux is included in this setup, but it uses Ctrl+A
for commands, allowing a local tmux session (using Ctrl+B
) to connect remotely.
Monitoring
In addition to Prometheus, here are tools to help monitor resource usage locally:
- htop
- iostat -x 1: Displays real-time I/O data.
- slurm -i ens192: Shows real-time network statistics for the interface ens192.