2025.04.30-20:50
This commit is contained in:
120
nixos_24.11_wlin001/home/ansible.nix
Normal file
120
nixos_24.11_wlin001/home/ansible.nix
Normal file
@ -0,0 +1,120 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
home.file = {
|
||||
"/home/zulumann/Ansible/ansible.cfg" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
[defaults]
|
||||
inventory = /home/zulumann/Ansible/hosts
|
||||
|
||||
# The directory containing the playbooks
|
||||
playbook_dir = /home/zulumann/Ansible/playbooks
|
||||
|
||||
# Timeout for the connection
|
||||
timeout = 30
|
||||
|
||||
host_key_checking=False
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
home.file = {
|
||||
"/home/zulumann/Ansible/hosts" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
# Consolidation of all groups
|
||||
[hosts:children]
|
||||
pve01
|
||||
internet
|
||||
|
||||
[pve01]
|
||||
jdownloader ansible_host=192.168.10.51
|
||||
fileserver01 ansible_host=192.168.10.52
|
||||
checkmk ansible_host=192.168.10.53
|
||||
pbs01 ansible_host=192.168.10.54
|
||||
docker-lan ansible_host=192.168.10.55
|
||||
mail ansible_host=192.168.10.120
|
||||
vserver01 ansible_host=192.168.10.180
|
||||
seedbox ansible_host=192.168.20.10
|
||||
aptcache ansible_host=192.168.50.10
|
||||
rustdesk ansible_host=192.168.50.12
|
||||
radicale ansible_host=192.168.50.13
|
||||
mumble ansible_host=192.168.50.14
|
||||
meet ansible_host=192.168.50.15
|
||||
freshrss ansible_host=192.168.50.17
|
||||
owncloud ansible_host=192.168.50.18
|
||||
webserver01 ansible_host=192.168.50.19
|
||||
webserver02 ansible_host=192.168.50.20
|
||||
gitea ansible_host=192.168.50.21
|
||||
bookshelf ansible_host=192.168.50.22
|
||||
#crowdsec ansible_host=192.168.50.23
|
||||
syncthing ansible_host=192.168.50.24
|
||||
sftpgo ansible_host=192.168.50.25
|
||||
jellyfin ansible_host=192.168.60.20
|
||||
adgurd ansible_host=192.168.178.10
|
||||
|
||||
[internet]
|
||||
strato ansible_host=85.215.43.109
|
||||
|
||||
[pve01:vars]
|
||||
ansible_user=root
|
||||
ansible_port=22
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
#ansible_ssh_private_key_file = ~/.ssh/id_rsa
|
||||
|
||||
[internet:vars]
|
||||
ansible_user=root
|
||||
ansible_port=63007
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
#ansible_ssh_pass=password
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
home.file = {
|
||||
"/home/zulumann/Ansible/playbooks/apt-dist.yml" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
- name: apt dist-upgrade Debian based servers
|
||||
hosts:
|
||||
- pve01
|
||||
- strato
|
||||
tasks:
|
||||
- name: Update package lists
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Only run "update_cache=yes" if the last one is more than 3600 seconds ago
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Upgrade all Packages
|
||||
apt:
|
||||
upgrade: dist
|
||||
|
||||
- name: Pass options to dpkg on run
|
||||
apt:
|
||||
upgrade: dist
|
||||
update_cache: yes
|
||||
dpkg_options: 'force-confold,force-confdef'
|
||||
|
||||
- name: Autoremove unused packages
|
||||
become: yes
|
||||
command: apt -y autoremove
|
||||
|
||||
- name: Removes all packages from the package cache
|
||||
become: yes
|
||||
command: apt -y clean
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
lxc-update = "ansible-playbook ~/Ansible/playbooks/apt-dist.yml -i ~/Ansible/hosts";
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user