From 239332bafb18f3698d49c06e5ecf36b827333574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Kopi=C4=87?= Date: Mon, 12 Feb 2024 19:48:45 +0100 Subject: [PATCH] Added WIP nextcloud playbook --- facts_example | 995 ++++++++++++++++++ ...{install_borgbackup.yml => borgbackup.yml} | 10 +- playbooks/nextcloud.yml | 60 ++ ...ix_agent_install.yml => zabbix_agent2.yml} | 0 templates/borgbackup.j2 | 4 +- templates/disk-power.rules | 1 + templates/io-scheduler.j2 | 7 + 7 files changed, 1070 insertions(+), 7 deletions(-) create mode 100644 facts_example rename playbooks/{install_borgbackup.yml => borgbackup.yml} (70%) create mode 100644 playbooks/nextcloud.yml rename playbooks/{zabbix_agent_install.yml => zabbix_agent2.yml} (100%) create mode 100644 templates/disk-power.rules create mode 100644 templates/io-scheduler.j2 diff --git a/facts_example b/facts_example new file mode 100644 index 0000000..8b33cda --- /dev/null +++ b/facts_example @@ -0,0 +1,995 @@ +{ + "ansible_facts": { + "ansible_all_ipv4_addresses": [ + "192.168.1.80" + ], + "ansible_all_ipv6_addresses": [ + "fe80::2459:6f18:a7d1:f689" + ], + "ansible_apparmor": { + "status": "enabled" + }, + "ansible_architecture": "aarch64", + "ansible_bios_date": "NA", + "ansible_bios_vendor": "NA", + "ansible_bios_version": "NA", + "ansible_board_asset_tag": "NA", + "ansible_board_name": "NA", + "ansible_board_serial": "NA", + "ansible_board_vendor": "NA", + "ansible_board_version": "NA", + "ansible_chassis_asset_tag": "NA", + "ansible_chassis_serial": "NA", + "ansible_chassis_vendor": "NA", + "ansible_chassis_version": "NA", + "ansible_cmdline": { + "cgroup_enable": "memory", + "console": "ttyS0,115200", + "consoleblank": "0", + "loglevel": "1", + "root": "UUID=e738c9da-cfd1-4ee1-a82e-57999983725a", + "rootfstype": "ext4", + "rootwait": true, + "splash": "verbose", + "swapaccount": "1", + "ubootpart": "fc0a35f1-01", + "usb-storage.quirks": "0x2537:0x1066:u,0x2537:0x1068:u" + }, + "ansible_date_time": { + "date": "2024-02-11", + "day": "11", + "epoch": "1707659246", + "epoch_int": "1707659246", + "hour": "14", + "iso8601": "2024-02-11T13:47:26Z", + "iso8601_basic": "20240211T144726541651", + "iso8601_basic_short": "20240211T144726", + "iso8601_micro": "2024-02-11T13:47:26.541651Z", + "minute": "47", + "month": "02", + "second": "26", + "time": "14:47:26", + "tz": "CET", + "tz_dst": "CEST", + "tz_offset": "+0100", + "weekday": "Sunday", + "weekday_number": "0", + "weeknumber": "06", + "year": "2024" + }, + "ansible_default_ipv4": { + "address": "192.168.1.80", + "alias": "wlan0", + "broadcast": "192.168.1.255", + "gateway": "192.168.1.1", + "interface": "wlan0", + "macaddress": "12:01:0c:3e:7e:9a", + "mtu": 1500, + "netmask": "255.255.255.0", + "network": "192.168.1.0", + "prefix": "24", + "type": "ether" + }, + "ansible_default_ipv6": {}, + "ansible_device_links": { + "ids": { + "mmcblk0": [ + "mmc-SD16G_0xda362931" + ], + "mmcblk0p1": [ + "mmc-SD16G_0xda362931-part1" + ] + }, + "labels": { + "mmcblk0p1": [ + "armbi_root" + ] + }, + "masters": {}, + "uuids": { + "mmcblk0p1": [ + "e738c9da-cfd1-4ee1-a82e-57999983725a" + ] + } + }, + "ansible_devices": { + "loop0": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop1": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop2": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop3": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop4": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop5": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop6": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "loop7": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "1", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "0", + "sectorsize": "512", + "size": "0.00 Bytes", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "mmcblk0": { + "holders": [], + "host": "", + "links": { + "ids": [ + "mmc-SD16G_0xda362931" + ], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": { + "mmcblk0p1": { + "holders": [], + "links": { + "ids": [ + "mmc-SD16G_0xda362931-part1" + ], + "labels": [ + "armbi_root" + ], + "masters": [], + "uuids": [ + "e738c9da-cfd1-4ee1-a82e-57999983725a" + ] + }, + "sectors": "29941761", + "sectorsize": 512, + "size": "14.28 GB", + "start": "8192", + "uuid": "e738c9da-cfd1-4ee1-a82e-57999983725a" + } + }, + "removable": "0", + "rotational": "0", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "30253056", + "sectorsize": "512", + "serial": "0xda362931", + "size": "14.43 GB", + "support_discard": "4194304", + "vendor": null, + "virtual": 1 + }, + "mtdblock0": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "0", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "none", + "sectors": "4096", + "sectorsize": "512", + "size": "2.00 MB", + "support_discard": "0", + "vendor": null, + "virtual": 1 + }, + "zram0": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "0", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "", + "sectors": "493896", + "sectorsize": "4096", + "size": "241.16 MB", + "support_discard": "4096", + "vendor": null, + "virtual": 1 + }, + "zram1": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "0", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "", + "sectors": "102400", + "sectorsize": "4096", + "size": "50.00 MB", + "support_discard": "4096", + "vendor": null, + "virtual": 1 + }, + "zram2": { + "holders": [], + "host": "", + "links": { + "ids": [], + "labels": [], + "masters": [], + "uuids": [] + }, + "model": null, + "partitions": {}, + "removable": "0", + "rotational": "0", + "sas_address": null, + "sas_device_handle": null, + "scheduler_mode": "", + "sectors": "0", + "sectorsize": "4096", + "size": "0.00 Bytes", + "support_discard": "4096", + "vendor": null, + "virtual": 1 + } + }, + "ansible_distribution": "Debian", + "ansible_distribution_file_parsed": true, + "ansible_distribution_file_path": "/etc/os-release", + "ansible_distribution_file_variety": "Debian", + "ansible_distribution_major_version": "12", + "ansible_distribution_minor_version": "2", + "ansible_distribution_release": "bookworm", + "ansible_distribution_version": "12.2", + "ansible_dns": { + "nameservers": [ + "192.168.1.160", + "208.67.222.222" + ] + }, + "ansible_domain": "", + "ansible_effective_group_id": 0, + "ansible_effective_user_id": 0, + "ansible_end0": { + "active": false, + "device": "end0", + "features": { + "esp_hw_offload": "off [fixed]", + "esp_tx_csum_hw_offload": "off [fixed]", + "fcoe_mtu": "off [fixed]", + "generic_receive_offload": "on", + "generic_segmentation_offload": "on", + "highdma": "on [fixed]", + "hsr_dup_offload": "off [fixed]", + "hsr_fwd_offload": "off [fixed]", + "hsr_tag_ins_offload": "off [fixed]", + "hsr_tag_rm_offload": "off [fixed]", + "hw_tc_offload": "off [fixed]", + "l2_fwd_offload": "off [fixed]", + "large_receive_offload": "off [fixed]", + "loopback": "off [fixed]", + "macsec_hw_offload": "off [fixed]", + "netns_local": "off [fixed]", + "ntuple_filters": "off [fixed]", + "receive_hashing": "off [fixed]", + "rx_all": "off [fixed]", + "rx_checksumming": "on", + "rx_fcs": "off [fixed]", + "rx_gro_hw": "off [fixed]", + "rx_gro_list": "off", + "rx_udp_gro_forwarding": "off", + "rx_udp_tunnel_port_offload": "off [fixed]", + "rx_vlan_filter": "off [fixed]", + "rx_vlan_offload": "on [fixed]", + "rx_vlan_stag_filter": "off [fixed]", + "rx_vlan_stag_hw_parse": "on [fixed]", + "scatter_gather": "on", + "tcp_segmentation_offload": "off", + "tls_hw_record": "off [fixed]", + "tls_hw_rx_offload": "off [fixed]", + "tls_hw_tx_offload": "off [fixed]", + "tx_checksum_fcoe_crc": "off [fixed]", + "tx_checksum_ip_generic": "off [fixed]", + "tx_checksum_ipv4": "on", + "tx_checksum_ipv6": "on", + "tx_checksum_sctp": "off [fixed]", + "tx_checksumming": "on", + "tx_esp_segmentation": "off [fixed]", + "tx_fcoe_segmentation": "off [fixed]", + "tx_gre_csum_segmentation": "off [fixed]", + "tx_gre_segmentation": "off [fixed]", + "tx_gso_list": "off [fixed]", + "tx_gso_partial": "off [fixed]", + "tx_gso_robust": "off [fixed]", + "tx_ipxip4_segmentation": "off [fixed]", + "tx_ipxip6_segmentation": "off [fixed]", + "tx_lockless": "off [fixed]", + "tx_nocache_copy": "off", + "tx_scatter_gather": "on", + "tx_scatter_gather_fraglist": "off [fixed]", + "tx_sctp_segmentation": "off [fixed]", + "tx_tcp6_segmentation": "off [fixed]", + "tx_tcp_ecn_segmentation": "off [fixed]", + "tx_tcp_mangleid_segmentation": "off [fixed]", + "tx_tcp_segmentation": "off [fixed]", + "tx_tunnel_remcsum_segmentation": "off [fixed]", + "tx_udp_segmentation": "off [fixed]", + "tx_udp_tnl_csum_segmentation": "off [fixed]", + "tx_udp_tnl_segmentation": "off [fixed]", + "tx_vlan_offload": "off [fixed]", + "tx_vlan_stag_hw_insert": "off [fixed]", + "vlan_challenged": "off [fixed]" + }, + "hw_timestamp_filters": [], + "macaddress": "02:01:0c:3e:7e:9a", + "module": "dwmac_sun8i", + "mtu": 1500, + "pciid": "1c30000.ethernet", + "promisc": false, + "speed": -1, + "timestamping": [], + "type": "ether" + }, + "ansible_env": { + "HOME": "/root", + "LANG": "en_US.UTF-8", + "LANGUAGE": "en_US.UTF-8", + "LC_MESSAGES": "en_US.UTF-8", + "LOGNAME": "root", + "MAIL": "/var/mail/root", + "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "PWD": "/home/tkopic", + "SHELL": "/usr/bin/bash", + "SUDO_COMMAND": "/bin/sh -c echo BECOME-SUCCESS-vbrudttcxlaxczcduvhmnoodktvkctbv ; /usr/bin/python3 /home/tkopic/.ansible/tmp/ansible-tmp-1707659242.0725713-6268-133748069844039/AnsiballZ_setup.py", + "SUDO_GID": "1000", + "SUDO_UID": "1000", + "SUDO_USER": "tkopic", + "TERM": "xterm-256color", + "USER": "root" + }, + "ansible_fibre_channel_wwn": [], + "ansible_fips": false, + "ansible_form_factor": "NA", + "ansible_fqdn": "localhost", + "ansible_hostname": "orangepizeroplus", + "ansible_hostnqn": "", + "ansible_interfaces": [ + "lo", + "end0", + "wlan1", + "wlan0" + ], + "ansible_is_chroot": false, + "ansible_iscsi_iqn": "", + "ansible_kernel": "6.1.63-current-sunxi64", + "ansible_kernel_version": "#1 SMP Mon Nov 20 10:52:19 UTC 2023", + "ansible_lo": { + "active": true, + "device": "lo", + "features": { + "esp_hw_offload": "off [fixed]", + "esp_tx_csum_hw_offload": "off [fixed]", + "fcoe_mtu": "off [fixed]", + "generic_receive_offload": "on", + "generic_segmentation_offload": "on", + "highdma": "on [fixed]", + "hsr_dup_offload": "off [fixed]", + "hsr_fwd_offload": "off [fixed]", + "hsr_tag_ins_offload": "off [fixed]", + "hsr_tag_rm_offload": "off [fixed]", + "hw_tc_offload": "off [fixed]", + "l2_fwd_offload": "off [fixed]", + "large_receive_offload": "off [fixed]", + "loopback": "on [fixed]", + "macsec_hw_offload": "off [fixed]", + "netns_local": "on [fixed]", + "ntuple_filters": "off [fixed]", + "receive_hashing": "off [fixed]", + "rx_all": "off [fixed]", + "rx_checksumming": "on [fixed]", + "rx_fcs": "off [fixed]", + "rx_gro_hw": "off [fixed]", + "rx_gro_list": "off", + "rx_udp_gro_forwarding": "off", + "rx_udp_tunnel_port_offload": "off [fixed]", + "rx_vlan_filter": "off [fixed]", + "rx_vlan_offload": "off [fixed]", + "rx_vlan_stag_filter": "off [fixed]", + "rx_vlan_stag_hw_parse": "off [fixed]", + "scatter_gather": "on", + "tcp_segmentation_offload": "on", + "tls_hw_record": "off [fixed]", + "tls_hw_rx_offload": "off [fixed]", + "tls_hw_tx_offload": "off [fixed]", + "tx_checksum_fcoe_crc": "off [fixed]", + "tx_checksum_ip_generic": "on [fixed]", + "tx_checksum_ipv4": "off [fixed]", + "tx_checksum_ipv6": "off [fixed]", + "tx_checksum_sctp": "on [fixed]", + "tx_checksumming": "on", + "tx_esp_segmentation": "off [fixed]", + "tx_fcoe_segmentation": "off [fixed]", + "tx_gre_csum_segmentation": "off [fixed]", + "tx_gre_segmentation": "off [fixed]", + "tx_gso_list": "on", + "tx_gso_partial": "off [fixed]", + "tx_gso_robust": "off [fixed]", + "tx_ipxip4_segmentation": "off [fixed]", + "tx_ipxip6_segmentation": "off [fixed]", + "tx_lockless": "on [fixed]", + "tx_nocache_copy": "off [fixed]", + "tx_scatter_gather": "on [fixed]", + "tx_scatter_gather_fraglist": "on [fixed]", + "tx_sctp_segmentation": "on", + "tx_tcp6_segmentation": "on", + "tx_tcp_ecn_segmentation": "on", + "tx_tcp_mangleid_segmentation": "on", + "tx_tcp_segmentation": "on", + "tx_tunnel_remcsum_segmentation": "off [fixed]", + "tx_udp_segmentation": "on", + "tx_udp_tnl_csum_segmentation": "off [fixed]", + "tx_udp_tnl_segmentation": "off [fixed]", + "tx_vlan_offload": "off [fixed]", + "tx_vlan_stag_hw_insert": "off [fixed]", + "vlan_challenged": "on [fixed]" + }, + "hw_timestamp_filters": [], + "ipv4": { + "address": "127.0.0.1", + "broadcast": "", + "netmask": "255.0.0.0", + "network": "127.0.0.0", + "prefix": "8" + }, + "ipv6": [ + { + "address": "::1", + "prefix": "128", + "scope": "host" + } + ], + "mtu": 65536, + "promisc": false, + "timestamping": [], + "type": "loopback" + }, + "ansible_loadavg": { + "15m": 0.00537109375, + "1m": 0.080078125, + "5m": 0.0166015625 + }, + "ansible_local": {}, + "ansible_locally_reachable_ips": { + "ipv4": [ + "127.0.0.0/8", + "127.0.0.1", + "192.168.1.80" + ], + "ipv6": [ + "::1", + "fe80::2459:6f18:a7d1:f689" + ] + }, + "ansible_lsb": { + "codename": "bookworm", + "description": "Armbian 23.11.1 bookworm", + "id": "Debian", + "major_release": "12", + "release": "12" + }, + "ansible_lvm": "N/A", + "ansible_machine": "aarch64", + "ansible_machine_id": "e77db82292bb4252b21c89a5f5919783", + "ansible_memfree_mb": 207, + "ansible_memory_mb": { + "nocache": { + "free": 361, + "used": 121 + }, + "real": { + "free": 207, + "total": 482, + "used": 275 + }, + "swap": { + "cached": 0, + "free": 241, + "total": 241, + "used": 0 + } + }, + "ansible_memtotal_mb": 482, + "ansible_mounts": [ + { + "block_available": 3090180, + "block_size": 4096, + "block_total": 3675363, + "block_used": 585183, + "device": "/dev/mmcblk0p1", + "fstype": "ext4", + "inode_available": 857900, + "inode_total": 903440, + "inode_used": 45540, + "mount": "/", + "options": "rw,noatime,errors=remount-ro,commit=600", + "size_available": 12657377280, + "size_total": 15054286848, + "uuid": "e738c9da-cfd1-4ee1-a82e-57999983725a" + }, + { + "block_available": 3090180, + "block_size": 4096, + "block_total": 3675363, + "block_used": 585183, + "device": "/dev/mmcblk0p1", + "fstype": "ext4", + "inode_available": 857900, + "inode_total": 903440, + "inode_used": 45540, + "mount": "/var/log.hdd", + "options": "rw,noatime,errors=remount-ro,commit=600,bind", + "size_available": 12657377280, + "size_total": 15054286848, + "uuid": "e738c9da-cfd1-4ee1-a82e-57999983725a" + }, + { + "block_available": 10970, + "block_size": 4096, + "block_total": 11990, + "block_used": 1020, + "device": "/dev/zram1", + "fstype": "ext4", + "inode_available": 12757, + "inode_total": 12800, + "inode_used": 43, + "mount": "/var/log", + "options": "rw,relatime,discard", + "size_available": 44933120, + "size_total": 49111040, + "uuid": "N/A" + } + ], + "ansible_nodename": "orangepizeroplus", + "ansible_os_family": "Debian", + "ansible_pkg_mgr": "apt", + "ansible_proc_cmdline": { + "cgroup_enable": "memory", + "console": "ttyS0,115200", + "consoleblank": "0", + "loglevel": "1", + "root": "UUID=e738c9da-cfd1-4ee1-a82e-57999983725a", + "rootfstype": "ext4", + "rootwait": true, + "splash": "verbose", + "swapaccount": "1", + "ubootpart": "fc0a35f1-01", + "usb-storage.quirks": "0x2537:0x1066:u,0x2537:0x1068:u" + }, + "ansible_processor": [ + "0", + "1", + "2", + "3" + ], + "ansible_processor_cores": 1, + "ansible_processor_count": 4, + "ansible_processor_nproc": 4, + "ansible_processor_threads_per_core": 1, + "ansible_processor_vcpus": 4, + "ansible_product_name": "NA", + "ansible_product_serial": "NA", + "ansible_product_uuid": "NA", + "ansible_product_version": "NA", + "ansible_python": { + "executable": "/usr/bin/python3", + "has_sslcontext": true, + "type": "cpython", + "version": { + "major": 3, + "micro": 2, + "minor": 11, + "releaselevel": "final", + "serial": 0 + }, + "version_info": [ + 3, + 11, + 2, + "final", + 0 + ] + }, + "ansible_python_version": "3.11.2", + "ansible_real_group_id": 0, + "ansible_real_user_id": 0, + "ansible_selinux": { + "status": "disabled" + }, + "ansible_selinux_python_present": true, + "ansible_service_mgr": "systemd", + "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPiuEfhBtKHbciBS7vP84gTqzGbw7MrMmERioZX7mf7fX/A0Lst03sgrX3krYhFYEAfNV4ueVt5GN737mK4vjiM=", + "ansible_ssh_host_key_ecdsa_public_keytype": "ecdsa-sha2-nistp256", + "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIHxweeOl71D59mjQBb92POy2uokyHKkhfAM4gzoKRbr5", + "ansible_ssh_host_key_ed25519_public_keytype": "ssh-ed25519", + "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABgQDbL3SGz4iuJEKBBtVGwyETHfmDNNSVrGx0siAiDW4w2dpX1tm8mRh4cbCaDNseoTkmXSrsfTTJXxnjA2/T9HAfhY7r5pYiofMAfCl4k+aiMCdNG/lNBIuzpkq4NO/7vlddQWpBIl/gWgXu30VR2gblI6G8q78GSROEYP7HmBAlmOsFXuwCZUSaMt22DC5l/dINtClICBvJvP2RDQ6vW9DKzFqNSB7ZWVJvf9Flzpz6Oa3YDttsFXTkW24rcW6Gba2qxV71GskswH0wp9T8zHMpSruRvM4nJr6Eb5g6Gu8vHHHjaRn/wr4GZORRR+SeN3+2qmc6XcNZF0QB+2+ypcBs+W6EI3bKcTJswa9HcoPUkTwCcoRGMPCeOu5B7N6CrKpXHpGTR5uR2NJ3ck9GzKO3bCc1iJ4m2minrfA6fw+4RFonAQpPQL4zhtmbwIGNKV3kjMr7SD+HhISVnTbKuHhrefhqHRKmBQOq4lYQUUW15Og5wa4ho16WyY3dyoouwg8=", + "ansible_ssh_host_key_rsa_public_keytype": "ssh-rsa", + "ansible_swapfree_mb": 241, + "ansible_swaptotal_mb": 241, + "ansible_system": "Linux", + "ansible_system_capabilities": [], + "ansible_system_capabilities_enforced": "False", + "ansible_system_vendor": "NA", + "ansible_uptime_seconds": 1603, + "ansible_user_dir": "/root", + "ansible_user_gecos": "root", + "ansible_user_gid": 0, + "ansible_user_id": "root", + "ansible_user_shell": "/usr/bin/bash", + "ansible_user_uid": 0, + "ansible_userspace_bits": "64", + "ansible_virtualization_role": "NA", + "ansible_virtualization_tech_guest": [], + "ansible_virtualization_tech_host": [], + "ansible_virtualization_type": "NA", + "ansible_wlan0": { + "active": true, + "device": "wlan0", + "features": { + "esp_hw_offload": "off [fixed]", + "esp_tx_csum_hw_offload": "off [fixed]", + "fcoe_mtu": "off [fixed]", + "generic_receive_offload": "on", + "generic_segmentation_offload": "on", + "highdma": "off [fixed]", + "hsr_dup_offload": "off [fixed]", + "hsr_fwd_offload": "off [fixed]", + "hsr_tag_ins_offload": "off [fixed]", + "hsr_tag_rm_offload": "off [fixed]", + "hw_tc_offload": "off [fixed]", + "l2_fwd_offload": "off [fixed]", + "large_receive_offload": "off [fixed]", + "loopback": "off [fixed]", + "macsec_hw_offload": "off [fixed]", + "netns_local": "on [fixed]", + "ntuple_filters": "off [fixed]", + "receive_hashing": "off [fixed]", + "rx_all": "off [fixed]", + "rx_checksumming": "off [fixed]", + "rx_fcs": "off [fixed]", + "rx_gro_hw": "off [fixed]", + "rx_gro_list": "off", + "rx_udp_gro_forwarding": "off", + "rx_udp_tunnel_port_offload": "off [fixed]", + "rx_vlan_filter": "off [fixed]", + "rx_vlan_offload": "off [fixed]", + "rx_vlan_stag_filter": "off [fixed]", + "rx_vlan_stag_hw_parse": "off [fixed]", + "scatter_gather": "on", + "tcp_segmentation_offload": "off", + "tls_hw_record": "off [fixed]", + "tls_hw_rx_offload": "off [fixed]", + "tls_hw_tx_offload": "off [fixed]", + "tx_checksum_fcoe_crc": "off [fixed]", + "tx_checksum_ip_generic": "off [fixed]", + "tx_checksum_ipv4": "off [fixed]", + "tx_checksum_ipv6": "off [fixed]", + "tx_checksum_sctp": "off [fixed]", + "tx_checksumming": "off", + "tx_esp_segmentation": "off [fixed]", + "tx_fcoe_segmentation": "off [fixed]", + "tx_gre_csum_segmentation": "off [fixed]", + "tx_gre_segmentation": "off [fixed]", + "tx_gso_list": "off [fixed]", + "tx_gso_partial": "off [fixed]", + "tx_gso_robust": "off [fixed]", + "tx_ipxip4_segmentation": "off [fixed]", + "tx_ipxip6_segmentation": "off [fixed]", + "tx_lockless": "off [fixed]", + "tx_nocache_copy": "off", + "tx_scatter_gather": "on", + "tx_scatter_gather_fraglist": "off [fixed]", + "tx_sctp_segmentation": "off [fixed]", + "tx_tcp6_segmentation": "off [fixed]", + "tx_tcp_ecn_segmentation": "off [fixed]", + "tx_tcp_mangleid_segmentation": "off [fixed]", + "tx_tcp_segmentation": "off [fixed]", + "tx_tunnel_remcsum_segmentation": "off [fixed]", + "tx_udp_segmentation": "off [fixed]", + "tx_udp_tnl_csum_segmentation": "off [fixed]", + "tx_udp_tnl_segmentation": "off [fixed]", + "tx_vlan_offload": "off [fixed]", + "tx_vlan_stag_hw_insert": "off [fixed]", + "vlan_challenged": "off [fixed]" + }, + "hw_timestamp_filters": [], + "ipv4": { + "address": "192.168.1.80", + "broadcast": "192.168.1.255", + "netmask": "255.255.255.0", + "network": "192.168.1.0", + "prefix": "24" + }, + "ipv6": [ + { + "address": "fe80::2459:6f18:a7d1:f689", + "prefix": "64", + "scope": "link" + } + ], + "macaddress": "12:01:0c:3e:7e:9a", + "mtu": 1500, + "pciid": "mmc1:0001:1", + "promisc": false, + "timestamping": [], + "type": "ether" + }, + "ansible_wlan1": { + "active": false, + "device": "wlan1", + "features": { + "esp_hw_offload": "off [fixed]", + "esp_tx_csum_hw_offload": "off [fixed]", + "fcoe_mtu": "off [fixed]", + "generic_receive_offload": "on", + "generic_segmentation_offload": "on", + "highdma": "off [fixed]", + "hsr_dup_offload": "off [fixed]", + "hsr_fwd_offload": "off [fixed]", + "hsr_tag_ins_offload": "off [fixed]", + "hsr_tag_rm_offload": "off [fixed]", + "hw_tc_offload": "off [fixed]", + "l2_fwd_offload": "off [fixed]", + "large_receive_offload": "off [fixed]", + "loopback": "off [fixed]", + "macsec_hw_offload": "off [fixed]", + "netns_local": "on [fixed]", + "ntuple_filters": "off [fixed]", + "receive_hashing": "off [fixed]", + "rx_all": "off [fixed]", + "rx_checksumming": "off [fixed]", + "rx_fcs": "off [fixed]", + "rx_gro_hw": "off [fixed]", + "rx_gro_list": "off", + "rx_udp_gro_forwarding": "off", + "rx_udp_tunnel_port_offload": "off [fixed]", + "rx_vlan_filter": "off [fixed]", + "rx_vlan_offload": "off [fixed]", + "rx_vlan_stag_filter": "off [fixed]", + "rx_vlan_stag_hw_parse": "off [fixed]", + "scatter_gather": "on", + "tcp_segmentation_offload": "off", + "tls_hw_record": "off [fixed]", + "tls_hw_rx_offload": "off [fixed]", + "tls_hw_tx_offload": "off [fixed]", + "tx_checksum_fcoe_crc": "off [fixed]", + "tx_checksum_ip_generic": "off [fixed]", + "tx_checksum_ipv4": "off [fixed]", + "tx_checksum_ipv6": "off [fixed]", + "tx_checksum_sctp": "off [fixed]", + "tx_checksumming": "off", + "tx_esp_segmentation": "off [fixed]", + "tx_fcoe_segmentation": "off [fixed]", + "tx_gre_csum_segmentation": "off [fixed]", + "tx_gre_segmentation": "off [fixed]", + "tx_gso_list": "off [fixed]", + "tx_gso_partial": "off [fixed]", + "tx_gso_robust": "off [fixed]", + "tx_ipxip4_segmentation": "off [fixed]", + "tx_ipxip6_segmentation": "off [fixed]", + "tx_lockless": "off [fixed]", + "tx_nocache_copy": "off", + "tx_scatter_gather": "on", + "tx_scatter_gather_fraglist": "off [fixed]", + "tx_sctp_segmentation": "off [fixed]", + "tx_tcp6_segmentation": "off [fixed]", + "tx_tcp_ecn_segmentation": "off [fixed]", + "tx_tcp_mangleid_segmentation": "off [fixed]", + "tx_tcp_segmentation": "off [fixed]", + "tx_tunnel_remcsum_segmentation": "off [fixed]", + "tx_udp_segmentation": "off [fixed]", + "tx_udp_tnl_csum_segmentation": "off [fixed]", + "tx_udp_tnl_segmentation": "off [fixed]", + "tx_vlan_offload": "off [fixed]", + "tx_vlan_stag_hw_insert": "off [fixed]", + "vlan_challenged": "off [fixed]" + }, + "hw_timestamp_filters": [], + "macaddress": "12:01:0c:3e:7c:9a", + "mtu": 1500, + "pciid": "mmc1:0001:1", + "promisc": false, + "timestamping": [], + "type": "ether" + }, + "discovered_interpreter_python": "/usr/bin/python3", + "gather_subset": [ + "all" + ], + "module_setup": true + }, + "changed": false +} diff --git a/playbooks/install_borgbackup.yml b/playbooks/borgbackup.yml similarity index 70% rename from playbooks/install_borgbackup.yml rename to playbooks/borgbackup.yml index 8f374d4..f926ca5 100644 --- a/playbooks/install_borgbackup.yml +++ b/playbooks/borgbackup.yml @@ -8,7 +8,7 @@ borg_backup_name_format: "backup-$(date +%Y-%m-%d-%H:%M)" borg_backup_compression: "lzma,6" borg_backup_paths: "/etc /var" - borg_exclude_paths: "--exclude={{borg_repo_path}} --exclude=*.log --exclude=*.log.gz" + borg_exclude_paths: "--exclude={{ borg_repo_path }} --exclude=*.log --exclude=*.log.gz" tasks: - name: "Install borg backup" @@ -17,14 +17,14 @@ state: latest - name: "Create backup repository" - ansible.builtin.command: borg init -e {{borg_repo_encryption}} {{borg_repo_path}} + ansible.builtin.command: borg init -e {{ borg_repo_encryption }} {{ borg_repo_path }} args: - creates: "{{borg_repo_path}}" + creates: "{{ borg_repo_path }}" - name: "Configure backup script" ansible.builtin.template: src: ../templates/borgbackup.j2 - dest: "{{borg_script_install_path}}" + dest: "{{ borg_script_install_path }}" owner: root group: root mode: '744' @@ -34,4 +34,4 @@ name: "Borg backup" minute: "0" hour: "1" - job: "{{borg_script_install_path}}" + job: "{{ borg_script_install_path }}" diff --git a/playbooks/nextcloud.yml b/playbooks/nextcloud.yml new file mode 100644 index 0000000..7eb1e3f --- /dev/null +++ b/playbooks/nextcloud.yml @@ -0,0 +1,60 @@ +--- +- hosts: all + become: yes + vars: + iosched_nvme: none + iosched_ssd: kyber + iosched_mmc: kyber + iosched_hdd: bfq + php_threads: {{ ansible_facts['ansible_processor_nproc'] }} + php_memory: {{ ansible_facts['ansible_memtotal_mb'] // 2 }} + postgres_db_name: nextclouddb + postgres_db_user: nextclouduser + postgres_db_password: + postgres_shared_buffers: + postgres_work_mem: + postgres_temp_buffers: + redis_memory: + + tasks: + - name: "Update cache & Full system update" + apt: + update_cache: true + upgrade: dist + cache_valid_time: 3600 + force_apt_get: true + + - name: "Install system basics" + apt: + name: apt-transport-https lsb-release ca-certificates curl sudo wget zip hdparm + status: latest + + - name: "Configure powesaving rules and io schedulers" + ansible.builtin.template: + src: ../templates/io-scheduler.j2 + dest: /etc/udev/rules.d/60-io-scheduler.rules + ansible.builtin.copy: + src: ../templates/disk-power.rules + dest: /etc/udev/rules.d/65-disk-power.rules + + - name: "Install Nginx" + + - name: "Install PHP" + + - name: "Install Redis" + + - name: "Install PostgreSQL" + + - name: "Create Nextcloud user" + ansible.builtin.user: + name: nextcloud + groups: nextcloud redis postgres www-data + home: /var/lib/nextcloud + + - name: "Download and extract Nextcloud" + ansible.builtin.unarchive: + src: https://download.nextcloud.com/server/releases/latest.zip + dest: /nextcloud/ + remote_src: yes + owner: nextcloud + group: nextcloud diff --git a/playbooks/zabbix_agent_install.yml b/playbooks/zabbix_agent2.yml similarity index 100% rename from playbooks/zabbix_agent_install.yml rename to playbooks/zabbix_agent2.yml diff --git a/templates/borgbackup.j2 b/templates/borgbackup.j2 index 3d066e8..a4becd0 100644 --- a/templates/borgbackup.j2 +++ b/templates/borgbackup.j2 @@ -1,11 +1,11 @@ #!/bin/bash # Borg repo location -REPOSITORY={{borg_repo_path}} +REPOSITORY={{ borg_repo_path }} echo "`date +[%F/%T]` Starting the backup" # Create backup -borg create -v --compression {{borg_backup_compression}} --stats $REPOSITORY::{{borg_backup_name_format}} {{borg_backup_paths}} {{borg_exclude_paths}} +borg create -v --compression {{ borg_backup_compression }} --stats $REPOSITORY::{{ borg_backup_name_format }} {{ borg_backup_paths }} {{ borg_exclude_paths }} # Clean old backups borg prune -v $REPOSITORY --keep-daily=3 --keep-weekly=2 --keep-monthly=12 echo "`date +[%F/%T]` Done!" diff --git a/templates/disk-power.rules b/templates/disk-power.rules new file mode 100644 index 0000000..f7e5621 --- /dev/null +++ b/templates/disk-power.rules @@ -0,0 +1 @@ +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", RUN+="/sbin/hdparm -B 127 -S 60 $env{DEVNAME}" diff --git a/templates/io-scheduler.j2 b/templates/io-scheduler.j2 new file mode 100644 index 0000000..bcc0adc --- /dev/null +++ b/templates/io-scheduler.j2 @@ -0,0 +1,7 @@ +# set scheduler for NVMe +ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="{{ iosched_nvme }}" +# set scheduler for SSD and eMMC +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="{{ iosched_ssd }}" +ACTION=="add|change", KERNEL=="mmcblk[0-9]*", ATTR{queue/scheduler}="{{ iosched_mmc }}" +# set scheduler for rotating disks +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="{{ iosched_hdd }}"