This commit is contained in:
2024-09-26 17:06:04 +02:00
commit a3192e55c3
13 changed files with 184 additions and 0 deletions

11
.project Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>maketank-ansible</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

7
inventory.yaml Normal file
View File

@@ -0,0 +1,7 @@
mkt:
hosts:
rechner02.maketank.net:
mx03.maketank.net:
uncle02.maketank.net:
mon01.maketank.net:

View File

@@ -0,0 +1,24 @@
- name: Install autofs
apt:
state: present
name:
- autofs
- name: Create /net
file:
path: /net
state: directory
- name: Update auto.master
lineinfile:
path: /etc/auto.master
regexp: '^#/net'
line: /net -hosts
register: auto_master_update
- name: Restart autofs
service:
name: autofs
state: restarted
when: auto_master_update.changed

View File

@@ -0,0 +1,14 @@
- name: Install common packages
become: true
become_user: admin
homebrew:
state: present
name:
- btop
- htop
- rsync
- rclone
- vim
- curl
- arping

View File

@@ -0,0 +1,63 @@
- name: Install common packages
apt:
state: present
name:
- btop
- htop
- iotop
- net-tools
- tcpdump
- curl
- vim
- rclone
- rsync
- borgmatic
- cifs-utils
- nfs-common
- etckeeper
- iputils-arping
- bwm-ng
- iftop
- name: Remove packages in VMs
apt:
state: absent
purge: true
name:
- smartmontools
- lm-sensors
- ipmitools
- openipmi
when: ansible_facts['virtualization_role'] == "guest"
- name: Install packages on physical hosts
apt:
state: present
name:
- lm-sensors
- hdparm
when: ansible_facts['virtualization_role'] == "host"
- name: Update /etc/hosts
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.1\.1'
line: 127.0.1.1 {{ ansible_nodename }}
- name: Kernel modules
include_role:
name: modules
- name: sudo for Linux
include_role:
name: sudo
#- name: autofs for Linux
# include_role:
# name: autofs
#
# Set vm.swappiness to 5 in /etc/sysctl.conf
- sysctl:
name: vm.swappiness
value: '5'
state: present

View File

@@ -0,0 +1,6 @@
- name: Common Tasks for all hosts
include_tasks: "{{ ansible_system | lower }}.yaml"
- name: Prometheus
include_role:
name: prometheus-node-exporter

View File

@@ -0,0 +1,5 @@
- name: Kernel module nf_conntrack
community.general.modprobe:
name: nf_conntrack
state: present
persistent: present

View File

@@ -0,0 +1,25 @@
- name: Install node-exporter
become: true
become_user: admin
homebrew:
state: present
name:
- node_exporter
# TODO: Fix this
#- name: Check service running
# become: true
# become_user: admin
# command: "/opt/homebrew/bin/brew services info --json node_exporter"
# register: service_running
# ignore_errors: True
#
#- name: Debug
# debug:
# msg: "{{ service_running }}"
#
#- name: Start service
# become: true
# become_user: admin
# command: "/opt/homebrew/bin/brew services start node_exporter"
# when: {{ service_running[*].status }} != "started"

View File

@@ -0,0 +1,5 @@
- name: Install node-exporter
apt:
state: present
name:
- prometheus-node-exporter

View File

@@ -0,0 +1,2 @@
- name: Prometheus Node Exporter
include_tasks: "{{ ansible_system | lower }}.yaml"

View File

@@ -0,0 +1,13 @@
- name: Install sudo
apt:
name: sudo
state: present
- name: ensure Admini role
user:
comment: Administrative User
user: admini
password: $6$WmyMaztTbqI6Ga19$AADxgXtK.3q/ne0v.rimlKWRmZoX0bXApWRmoVTiQAdcGrfMwiInDHWElz5zfQiBGTZM6wOnSletT9JfdO6Zl0
groups:
- sudo
append: true

7
site.yaml Normal file
View File

@@ -0,0 +1,7 @@
- hosts: all
gather_facts: true
roles:
- role: common
tags: common