From 464e95c42fe35919994681ee6e43d6d427fe69be Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 08:33:34 +0100 Subject: [PATCH 01/33] bitwarden --- hosts_kestra.yml | 1 + playbooks/05_install_docker.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 2351806..35fec07 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -132,6 +132,7 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd + ansible_ssh_pass: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: hosts: diff --git a/playbooks/05_install_docker.yml b/playbooks/05_install_docker.yml index d32c674..709ade4 100644 --- a/playbooks/05_install_docker.yml +++ b/playbooks/05_install_docker.yml @@ -45,7 +45,7 @@ dest: "/etc/systemd/system/docker.service.d/override.conf" content: | [Service] - ExecStart=/usr/sbin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375 + ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375 - name: Just force systemd to reread configs ansible.builtin.systemd: From cb032363bc7a455666c3063d6e4cd061893ccba9 Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 08:34:19 +0100 Subject: [PATCH 02/33] bitwarden --- hosts_kestra.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 35fec07..60db4db 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -133,6 +133,7 @@ datacenter: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd ansible_ssh_pass: l4c1j4yd33Du5lo + ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: hosts: From bb8930fb754bbd1a8597895b15eda3cb80a38aeb Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 08:36:04 +0100 Subject: [PATCH 03/33] bitwarden --- playbooks/05_install_docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/playbooks/05_install_docker.yml b/playbooks/05_install_docker.yml index 709ade4..e4952be 100644 --- a/playbooks/05_install_docker.yml +++ b/playbooks/05_install_docker.yml @@ -14,6 +14,7 @@ - python3-pip - python3-dev state: present + update_cache: yes - name: Get keys for raspotify ansible.builtin.shell: install -m 0755 -d /etc/apt/keyrings @@ -34,6 +35,7 @@ - containerd.io - docker-buildx-plugin - docker-compose-plugin + update_cache: yes - name: Create a directory docker.service.d ansible.builtin.file: From 3b92e76740061de63175a341f6eabaaca0213184 Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 08:39:43 +0100 Subject: [PATCH 04/33] bitwarden --- playbooks/05_install_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/05_install_docker.yml b/playbooks/05_install_docker.yml index e4952be..735214b 100644 --- a/playbooks/05_install_docker.yml +++ b/playbooks/05_install_docker.yml @@ -14,7 +14,7 @@ - python3-pip - python3-dev state: present - update_cache: yes + update_cache: yes - name: Get keys for raspotify ansible.builtin.shell: install -m 0755 -d /etc/apt/keyrings From 26a4e64a0193cc96f8602753a2dfbe47e89710aa Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 08:40:56 +0100 Subject: [PATCH 05/33] bitwarden --- playbooks/05_install_docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/05_install_docker.yml b/playbooks/05_install_docker.yml index 735214b..b2c5af6 100644 --- a/playbooks/05_install_docker.yml +++ b/playbooks/05_install_docker.yml @@ -14,7 +14,7 @@ - python3-pip - python3-dev state: present - update_cache: yes + update_cache: true - name: Get keys for raspotify ansible.builtin.shell: install -m 0755 -d /etc/apt/keyrings @@ -35,7 +35,7 @@ - containerd.io - docker-buildx-plugin - docker-compose-plugin - update_cache: yes + update_cache: true - name: Create a directory docker.service.d ansible.builtin.file: From 9f5699380d57dd814a623ba31787fdd9db43d98b Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 09:05:47 +0100 Subject: [PATCH 06/33] bitwarden --- hosts_kestra.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 60db4db..42f28a5 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -96,6 +96,8 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_user: jd + ansible_ssh_user: jd + ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: hosts: @@ -132,7 +134,6 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd - ansible_ssh_pass: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: From f45bcca765bda86c9c14977bc791cbfee2c4f3dc Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 10:30:37 +0100 Subject: [PATCH 07/33] bitwarden --- playbooks/05_install_autofs.yml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 playbooks/05_install_autofs.yml diff --git a/playbooks/05_install_autofs.yml b/playbooks/05_install_autofs.yml new file mode 100644 index 0000000..928f63b --- /dev/null +++ b/playbooks/05_install_autofs.yml @@ -0,0 +1,37 @@ +- hosts: datacenter + name: Install docker1 + become: true + become_user: root + gather_facts: false + tasks: + - name: Install docker + ansible.builtin.apt: + name: + - autofs + - cifs-utils + state: present + + - name: Creating a file with content + copy: + dest: "/etc/auto.nas" + content: | + nas-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Data + nas-docker-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/docker_data + nas-photo -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Photo + nas-public -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Public + nas-install -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/install + nas-media -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Media + nas-downloads -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Download + + - name: Reconfigure zabbix agent Server + ansible.builtin.lineinfile: + path: /etc/auto.master + regexp: "^/media/nas.*" + insertafter: '^/media/nas' + line: "/media/nas /etc/auto.nas --timeout 360 --ghost" + + - name: Restart docker service + ansible.builtin.service: + name: autofs + state: restarted + \ No newline at end of file From f45fc5d610bffbb2551a237cacfd12a5a5b7cb1e Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 10:53:22 +0100 Subject: [PATCH 08/33] bitwarden --- playbooks/05_install_autofs.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/playbooks/05_install_autofs.yml b/playbooks/05_install_autofs.yml index 928f63b..7e67519 100644 --- a/playbooks/05_install_autofs.yml +++ b/playbooks/05_install_autofs.yml @@ -1,10 +1,9 @@ - hosts: datacenter - name: Install docker1 + name: Install and configure autofs become: true become_user: root - gather_facts: false tasks: - - name: Install docker + - name: Install autofs ansible.builtin.apt: name: - autofs From fc830071cb615decd49fd6a177dd8e121687e371 Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 11:52:33 +0100 Subject: [PATCH 09/33] bitwarden --- hosts_kestra.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 42f28a5..5e75be1 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -93,9 +93,9 @@ datacenter: rack.home.lan: m-server.home.lan: zabbix.home.lan: + 192.168.77.101: vars: ansible_python_interpreter: /usr/bin/python3 - ansible_user: jd ansible_ssh_user: jd ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem @@ -115,12 +115,10 @@ datacenter: hosts: morefine.home.lan: vars: - ansible_user: jd - ansible_password: q ansible_ssh_user: jd - ansible_ssh_pass: q ansible_become_user: root ansible_become_password: q + ansible_ssh_private_key_file: ssh_key.pem containers: children: @@ -131,6 +129,7 @@ datacenter: fog.home.lan: zabbix.home.lan: omv.home.lan: + 192.168.77.101: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd From 718ebc8d224d08e5d33103f0a73176159ae6cfc1 Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 18 Nov 2024 11:53:26 +0100 Subject: [PATCH 10/33] bitwarden --- hosts_kestra.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 5e75be1..031e80c 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -133,6 +133,7 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd + ansible_ssh_password: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: From ce23d4e3f46ab8ca0ced5d627ddf14cd27181bca Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:14:09 +0100 Subject: [PATCH 11/33] bitwarden --- hosts_kestra.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 031e80c..b98dffe 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -31,8 +31,6 @@ datacenter: jaydee_install_mqtt_srv: true ansible_python_interpreter: auto_silent ansible_ssh_user: jd - ansible_ssh_pass: q - ansible_password: q ansible_become_user: root ansible_become_password: q ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" From f24678b2d7aa971263f6708ac2f4818f12f0897d Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:19:59 +0100 Subject: [PATCH 12/33] bitwarden --- hosts_kestra.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index b98dffe..df1ad55 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -131,7 +131,7 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd - ansible_ssh_password: l4c1j4yd33Du5lo + # ansible_ssh_password: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: From fd5dff813d775e92a5cf43b78f5534b4ae407dd5 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:22:24 +0100 Subject: [PATCH 13/33] bitwarden --- hosts_kestra.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index df1ad55..116a286 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -116,6 +116,7 @@ datacenter: ansible_ssh_user: jd ansible_become_user: root ansible_become_password: q + ansible_ssh_password: q ansible_ssh_private_key_file: ssh_key.pem containers: @@ -131,7 +132,7 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd - # ansible_ssh_password: l4c1j4yd33Du5lo + ansible_ssh_password: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: From aeca83e32ddc37f5fe0c13b3485e3e0e23626ab5 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:29:48 +0100 Subject: [PATCH 14/33] bitwarden --- playbooks/install_mqtt_srv.yml | 75 +++++++++++++++------------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index 394ed1d..5c056b1 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -17,8 +17,8 @@ ansible.builtin.copy: src: services/mqtt_srv.service dest: /etc/systemd/system/ - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" @@ -28,34 +28,34 @@ dest: /usr/bin/ mode: '755' owner: root - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Upload service script config ansible.builtin.copy: src: scripts/mqtt_srv.cfg dest: /etc/mqtt_srv/ mode: '755' owner: root - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - - name: Upload service script1 - ansible.builtin.copy: - src: scripts/mqtt_srv.sh - dest: /jffs/scripts/mqtt_srv/ - mode: '755' - owner: admin - when: inventory_hostname in groups['router'] - become: false + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + # - name: Upload service script1 + # ansible.builtin.copy: + # src: scripts/mqtt_srv.sh + # dest: /jffs/scripts/mqtt_srv/ + # mode: '755' + # owner: admin + # when: inventory_hostname in groups['router'] + # become: false - - name: Upload service script - ansible.builtin.copy: - src: scripts/mqtt_srv.py - dest: /jffs/scripts/mqtt_srv/ - mode: '755' - owner: admin - when: inventory_hostname in groups['router'] - become: false + # - name: Upload service script + # ansible.builtin.copy: + # src: scripts/mqtt_srv.py + # dest: /jffs/scripts/mqtt_srv/ + # mode: '755' + # owner: admin + # when: inventory_hostname in groups['router'] + # become: false - name: Upload service script1 ansible.builtin.copy: @@ -63,8 +63,8 @@ dest: /etc/init.d/ mode: '755' owner: admin - when: inventory_hostname in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Upload service script2 ansible.builtin.copy: @@ -72,8 +72,8 @@ dest: /usr/bin/ mode: '755' owner: admin - when: inventory_hostname in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install bottle python package ansible.builtin.shell: pip install {{ item }} --break-system-packages @@ -83,15 +83,15 @@ - ping3 - psutil - autorandr - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Just force systemd to reread configs (2.4 and above) ansible.builtin.systemd: daemon_reload: true - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Restart mqtt_srv service @@ -99,22 +99,13 @@ name: mqtt_srv.service state: restarted enabled: true - when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Restart mqtt service ansible.builtin.shell: "(/etc/init.d/mqtt_srv.sh restart >/dev/null 2>&1 &)" async: 10 poll: 0 when: inventory_hostname in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - - name: Restart mqtt service - ansible.builtin.shell: "(/jffs/scripts/mqtt_srv/mqtt_srv.sh restart >/dev/null 2>&1 &)" - async: 10 - poll: 0 - when: inventory_hostname in groups['router'] - become: false - - - \ No newline at end of file From f0bcca6a72c1090c687844dc6e138419c0390f6a Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:38:31 +0100 Subject: [PATCH 15/33] bitwarden --- playbooks/install_mqtt_srv.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index 5c056b1..6e5f6d6 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -1,4 +1,4 @@ -- hosts: mqtt_srv +- hosts: morefine.home.lan name: Install mqtt_srv ignore_unreachable: false ignore_errors: true From 930b11f36a1c9bff9ff812bf105abc5359aa24b1 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:40:04 +0100 Subject: [PATCH 16/33] bitwarden --- playbooks/install_mqtt_srv.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index 6e5f6d6..5c056b1 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -1,4 +1,4 @@ -- hosts: morefine.home.lan +- hosts: mqtt_srv name: Install mqtt_srv ignore_unreachable: false ignore_errors: true From 860c906fb78aecee1a62d7550fbdd035178866b3 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:41:40 +0100 Subject: [PATCH 17/33] bitwarden --- hosts_kestra.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 116a286..0b8be8b 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -100,7 +100,6 @@ datacenter: nas: hosts: nas.home.lan: - vars: ansible_ssh_user: admin become_method: su From 418b5a06474a75c8e6b650be1a8386573d6c3d97 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:53:39 +0100 Subject: [PATCH 18/33] bitwarden --- playbooks/install_mqtt_srv.yml | 39 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index 5c056b1..c519a56 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -12,13 +12,15 @@ # when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] # become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + - debug: + msg: "{{ inventory_hostname }}" - name: Upload service config ansible.builtin.copy: src: services/mqtt_srv.service dest: /etc/systemd/system/ - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" @@ -28,16 +30,17 @@ dest: /usr/bin/ mode: '755' owner: root - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" + - name: Upload service script config ansible.builtin.copy: src: scripts/mqtt_srv.cfg dest: /etc/mqtt_srv/ mode: '755' owner: root - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" # - name: Upload service script1 # ansible.builtin.copy: # src: scripts/mqtt_srv.sh @@ -63,8 +66,8 @@ dest: /etc/init.d/ mode: '755' owner: admin - when: inventory_hostname in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Upload service script2 ansible.builtin.copy: @@ -72,8 +75,8 @@ dest: /usr/bin/ mode: '755' owner: admin - when: inventory_hostname in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Install bottle python package ansible.builtin.shell: pip install {{ item }} --break-system-packages @@ -83,15 +86,15 @@ - ping3 - psutil - autorandr - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Just force systemd to reread configs (2.4 and above) ansible.builtin.systemd: daemon_reload: true - when: inventory_hostname not in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Restart mqtt_srv service @@ -99,13 +102,13 @@ name: mqtt_srv.service state: restarted enabled: true - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Restart mqtt service ansible.builtin.shell: "(/etc/init.d/mqtt_srv.sh restart >/dev/null 2>&1 &)" async: 10 poll: 0 - when: inventory_hostname in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' + become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" From 1709e6aecfb92a7782d9861c3601ab3e03ac06c9 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 07:56:57 +0100 Subject: [PATCH 19/33] bitwarden --- playbooks/install_mqtt_srv.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index c519a56..59116df 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -32,7 +32,7 @@ owner: root when: inventory_hostname != 'nas.home.lan' become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - + - name: Upload service script config ansible.builtin.copy: src: scripts/mqtt_srv.cfg @@ -66,7 +66,7 @@ dest: /etc/init.d/ mode: '755' owner: admin - when: inventory_hostname != 'nas.home.lan' + when: inventory_hostname == 'nas.home.lan' become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Upload service script2 @@ -75,7 +75,7 @@ dest: /usr/bin/ mode: '755' owner: admin - when: inventory_hostname != 'nas.home.lan' + when: inventory_hostname == 'router.home.lan' become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" - name: Install bottle python package From 8d4c82d7d3337b45c6bbcb75bd67027e4555a0d0 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:07:21 +0100 Subject: [PATCH 20/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index d8d001c..88a6538 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -1,22 +1,22 @@ - hosts: datacenter name: Install zabbix agent vars: - ZABBIX_SERVER: "zabbix-server.lan" + ZABBIX_SERVER: "zabbix.home.lan" tasks: - name: Combine list1 and list2 into a merged_list var ansible.builtin.set_fact: zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf" - when: inventory_hostname not in groups['nas'] + when: inventory_hostname not in groups['nas.home.lan'] - name: Combine list1 and list2 into a merged_list var ansible.builtin.set_fact: zabbix_agent_cfg: "/opt/ZabbixAgent/etc/zabbix_agentd.conf" - when: inventory_hostname in groups['nas'] + when: inventory_hostname in groups['nas.home.lan'] - name: Print all available facts ansible.builtin.debug: - msg: "{{ false if inventory_hostname not in groups['nas'] else true }}" + msg: "{{ false if inventory_hostname not in groups['nas.home.lan'] else true }}" - name: Print all available facts ansible.builtin.debug: @@ -30,7 +30,7 @@ deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb when: - ansible_facts.architecture != "armv7l" and ansible_distribution == "Ubuntu" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet2 ansible.builtin.apt: @@ -42,7 +42,7 @@ - ansible_facts.architecture == "armv7l" or ansible_facts.architecture == "aarch64" ignore_errors: true - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet3 ansible.builtin.apt: @@ -50,7 +50,7 @@ when: - ansible_facts.architecture != "armv7l" and ansible_distribution == "Debian" and ansible_distribution_major_version == "11" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet4 ansible.builtin.apt: @@ -58,7 +58,7 @@ deb: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb when: - ansible_facts.architecture != "armv7l" and ansible_facts.architecture != "aarch64" and ansible_distribution == "Debian" and ansible_distribution_major_version == "12" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" # - name: Install a .deb package localy # ansible.builtin.apt: @@ -71,8 +71,8 @@ - zabbix-agent2-plugin-postgresql - zabbix-agent2-plugin-mssql update_cache: yes - when: inventory_hostname not in groups['nas'] - become: "{{ false if inventory_hostname in groups['nas'] else true }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ false if inventory_hostname in groups['nas.home.lan'] else true }}" - name: Reconfigure zabbix agent Server @@ -81,14 +81,14 @@ regexp: "^Server=.*" insertafter: '^# Server=' line: "Server=192.168.77.0/24" - become: "{{ false if inventory_hostname in groups['nas'] else true }}" + become: "{{ false if inventory_hostname in groups['nas.home.lan'] else true }}" - name: Reconfigure zabbix agent ServerActive ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^ServerActive=.*" line: "ServerActive={{ ZABBIX_SERVER }}" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix agent ListenPort ansible.builtin.lineinfile: @@ -100,36 +100,36 @@ # path: /"{{ zabbix_agent_cfg }}" # regexp: "^ListenIP=.*" # line: "ListenIP=0.0.0.0" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^Hostname=.*" line: "Hostname={{ansible_hostname}}" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' line: "UserParameter=system.temperature,vcgencmd measure_temp" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix-agent2 config ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - when: inventory_hostname in groups['nas'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname in groups['nas.home.lan'] - name: Reconfigure zabbix-agent2 config ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' line: "UserParameter=rpi.hw.temp,/usr/bin/vcgencmd measure_temp" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - when: inventory_hostname in groups['raspberrypi5'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname in groups['rpi5.home.lan'] @@ -142,15 +142,15 @@ regexp: "^HostMetadata=.*" insertafter: '^# HostMetadata=' line: "HostMetadata=linux;jaydee" - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups ansible.builtin.user: name: zabbix groups: video append: yes - when: inventory_hostname not in groups['nas'] - become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas.home.lan'] + become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Restart zabbix-agent2 service ansible.builtin.service: @@ -158,8 +158,8 @@ state: restarted enabled: true become: true - when: inventory_hostname not in groups['nas'] + when: inventory_hostname not in groups['nas.home.lan'] - name: Restart agent ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart - when: inventory_hostname in groups['nas'] \ No newline at end of file + when: inventory_hostname in groups['nas.home.lan'] \ No newline at end of file From 36ba99e07cb2ac31d7408d8f43c01f733e6aa1f3 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:11:53 +0100 Subject: [PATCH 21/33] bitwarden --- hosts_kestra.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 0b8be8b..f2de466 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -115,7 +115,7 @@ datacenter: ansible_ssh_user: jd ansible_become_user: root ansible_become_password: q - ansible_ssh_password: q + # ansible_ssh_password: q ansible_ssh_private_key_file: ssh_key.pem containers: @@ -131,7 +131,7 @@ datacenter: vars: ansible_python_interpreter: /usr/bin/python3 ansible_ssh_user: jd - ansible_ssh_password: l4c1j4yd33Du5lo + # ansible_ssh_password: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem nas: From a8ceb732197918877636acf2d56986007a0df3af Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:22:13 +0100 Subject: [PATCH 22/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 54 ++++++++------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 88a6538..b84a264 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -1,22 +1,23 @@ - hosts: datacenter name: Install zabbix agent + become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}" vars: ZABBIX_SERVER: "zabbix.home.lan" tasks: - - name: Combine list1 and list2 into a merged_list var + - name: Get config for not nas ansible.builtin.set_fact: zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf" - when: inventory_hostname not in groups['nas.home.lan'] + when: inventory_hostname != 'nas.home.lan' - - name: Combine list1 and list2 into a merged_list var + - name: Get config for nas ansible.builtin.set_fact: zabbix_agent_cfg: "/opt/ZabbixAgent/etc/zabbix_agentd.conf" - when: inventory_hostname in groups['nas.home.lan'] + when: inventory_hostname == 'nas.home.lan' - name: Print all available facts ansible.builtin.debug: - msg: "{{ false if inventory_hostname not in groups['nas.home.lan'] else true }}" + msg: "{{ false if inventory_hostname == 'nas.home.lan' else true }}" - name: Print all available facts ansible.builtin.debug: @@ -30,7 +31,6 @@ deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb when: - ansible_facts.architecture != "armv7l" and ansible_distribution == "Ubuntu" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet2 ansible.builtin.apt: @@ -42,7 +42,6 @@ - ansible_facts.architecture == "armv7l" or ansible_facts.architecture == "aarch64" ignore_errors: true - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet3 ansible.builtin.apt: @@ -50,7 +49,6 @@ when: - ansible_facts.architecture != "armv7l" and ansible_distribution == "Debian" and ansible_distribution_major_version == "11" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Install a .deb package from the internet4 ansible.builtin.apt: @@ -58,7 +56,6 @@ deb: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb when: - ansible_facts.architecture != "armv7l" and ansible_facts.architecture != "aarch64" and ansible_distribution == "Debian" and ansible_distribution_major_version == "12" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" # - name: Install a .deb package localy # ansible.builtin.apt: @@ -71,9 +68,7 @@ - zabbix-agent2-plugin-postgresql - zabbix-agent2-plugin-mssql update_cache: yes - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ false if inventory_hostname in groups['nas.home.lan'] else true }}" - + when: inventory_hostname != 'nas.home.lan' - name: Reconfigure zabbix agent Server ansible.builtin.lineinfile: @@ -81,14 +76,13 @@ regexp: "^Server=.*" insertafter: '^# Server=' line: "Server=192.168.77.0/24" - become: "{{ false if inventory_hostname in groups['nas.home.lan'] else true }}" + become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}" - name: Reconfigure zabbix agent ServerActive ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^ServerActive=.*" line: "ServerActive={{ ZABBIX_SERVER }}" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix agent ListenPort ansible.builtin.lineinfile: @@ -100,41 +94,26 @@ # path: /"{{ zabbix_agent_cfg }}" # regexp: "^ListenIP=.*" # line: "ListenIP=0.0.0.0" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^Hostname=.*" line: "Hostname={{ansible_hostname}}" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - - - name: Reconfigure zabbix-agent2 hostname - ansible.builtin.lineinfile: - path: "{{ zabbix_agent_cfg }}" - insertafter: '^# UserParameter=' - line: "UserParameter=system.temperature,vcgencmd measure_temp" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - name: Reconfigure zabbix-agent2 config ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - when: inventory_hostname in groups['nas.home.lan'] + when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan' - name: Reconfigure zabbix-agent2 config ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' line: "UserParameter=rpi.hw.temp,/usr/bin/vcgencmd measure_temp" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - when: inventory_hostname in groups['rpi5.home.lan'] - - - - - + when: inventory_hostname == 'rpi5.home.lan' - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: @@ -142,24 +121,21 @@ regexp: "^HostMetadata=.*" insertafter: '^# HostMetadata=' line: "HostMetadata=linux;jaydee" - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" - - name: Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups + - name: Add the user 'to group video ansible.builtin.user: name: zabbix groups: video append: yes - when: inventory_hostname not in groups['nas.home.lan'] - become: "{{ 'no' if inventory_hostname in groups['nas.home.lan'] else 'yes' }}" + when: inventory_hostname != 'nas.home.lan' - name: Restart zabbix-agent2 service ansible.builtin.service: name: zabbix-agent2.service state: restarted enabled: true - become: true - when: inventory_hostname not in groups['nas.home.lan'] + when: inventory_hostname != 'nas.home.lan' - name: Restart agent ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart - when: inventory_hostname in groups['nas.home.lan'] \ No newline at end of file + when: inventory_hostname == 'nas.home.lan' \ No newline at end of file From dad85f7a1bcc2d2707ec3986bb265dd8e521d1e8 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:41:18 +0100 Subject: [PATCH 23/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index b84a264..fffb1cd 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -105,6 +105,7 @@ ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" insertafter: '^# UserParameter=' + regexp: "^UserParameter=system.certs.*" line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py" when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan' From eb5b16f97709ee64588694f790a3fa9404a8abf7 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:43:05 +0100 Subject: [PATCH 24/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index fffb1cd..5db702d 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -99,7 +99,7 @@ ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^Hostname=.*" - line: "Hostname={{ansible_hostname}}" + line: "Hostname={{ inventory_hostname }}" - name: Reconfigure zabbix-agent2 config ansible.builtin.lineinfile: From a905876c2a934fe79ddeb54cc5c849eb92e614ea Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 14:45:36 +0100 Subject: [PATCH 25/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 5db702d..31eeaf4 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -122,6 +122,13 @@ regexp: "^HostMetadata=.*" insertafter: '^# HostMetadata=' line: "HostMetadata=linux;jaydee" + - name: Reconfigure zabbix-agent2 hostname + ansible.builtin.lineinfile: + path: "{{ zabbix_agent_cfg }}" + regexp: "^HostMetadata=.*" + insertafter: '^# HostMetadata=' + line: "HostMetadata=server;jaydee" + when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan' - name: Add the user 'to group video ansible.builtin.user: From 02e1838ad0a6ca0681332c11fd3f07c3c6eb1d2d Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 15:26:24 +0100 Subject: [PATCH 26/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 31eeaf4..821ffb7 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -22,6 +22,12 @@ - name: Print all available facts ansible.builtin.debug: var: ansible_facts.architecture + - name: Print all available facts + ansible.builtin.debug: + var: ansible_distribution + - name: Print all available facts + ansible.builtin.debug: + var: ansible_distribution_major_version # - name: Upload zabbix package # ansible.builtin.copy: # src: packages/zabbix-release_6.4-1+ubuntu22.04_all.deb @@ -30,7 +36,7 @@ ansible.builtin.apt: deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb when: - - ansible_facts.architecture != "armv7l" and ansible_distribution == "Ubuntu" + - ansible_facts.architecture != "armv7l" and ( ansible_distribution == "Ubuntu" or ansible_distribution == "Linux Mint" ) - name: Install a .deb package from the internet2 ansible.builtin.apt: From 6d03c8e29d8bf19127c6eea68a30372aef0b5489 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 15:33:44 +0100 Subject: [PATCH 27/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 3 ++- playbooks/00_set_hostname.yml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 playbooks/00_set_hostname.yml diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 821ffb7..0805c17 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -72,8 +72,9 @@ - zabbix-agent2 - zabbix-agent2-plugin-mongodb - zabbix-agent2-plugin-postgresql - - zabbix-agent2-plugin-mssql + - zabbix-agent2-plugin-mysql update_cache: yes + ignore_errors: true when: inventory_hostname != 'nas.home.lan' - name: Reconfigure zabbix agent Server diff --git a/playbooks/00_set_hostname.yml b/playbooks/00_set_hostname.yml new file mode 100644 index 0000000..da363a0 --- /dev/null +++ b/playbooks/00_set_hostname.yml @@ -0,0 +1,17 @@ +- hosts: datacenter + name: Set hostname + become: true + tasks: + - name: Modify hostyname + ansible.builtin.hostname: + name: "{{ inventory_hostname }}" + use: systemd + - name: Print all available facts + ansible.builtin.debug: + var: ansible_facts.architecture + - name: Print all available facts + ansible.builtin.debug: + var: "{{ ansible_distribution }}" + - name: Print all available facts + ansible.builtin.debug: + var: ansible_facts.distribution_version \ No newline at end of file From 269dca95556d83f141d0e268d8c321bb9a72c21f Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 15:34:38 +0100 Subject: [PATCH 28/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 0805c17..63b4c6a 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -32,11 +32,11 @@ # ansible.builtin.copy: # src: packages/zabbix-release_6.4-1+ubuntu22.04_all.deb # dest: /tmp/ - - name: Install a .deb package from the internet1 + - name: Install a .deb package from the internet11 ansible.builtin.apt: deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb when: - - ansible_facts.architecture != "armv7l" and ( ansible_distribution == "Ubuntu" or ansible_distribution == "Linux Mint" ) + - ansible_facts.architecture != "armv7l" and ansible_distribution == "Ubuntu" or ansible_distribution == "Linux Mint" - name: Install a .deb package from the internet2 ansible.builtin.apt: From f53d71c708d5845f1c0c35715f7db6e40b548d17 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 15:36:43 +0100 Subject: [PATCH 29/33] bitwarden --- playbooks/00_install_zabbix_agent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 63b4c6a..f4f1c76 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -36,7 +36,7 @@ ansible.builtin.apt: deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb when: - - ansible_facts.architecture != "armv7l" and ansible_distribution == "Ubuntu" or ansible_distribution == "Linux Mint" + - ansible_facts.architecture != "armv7l" and ( ansible_distribution == "Ubuntu" or ansible_distribution == "Linux Mint" ) - name: Install a .deb package from the internet2 ansible.builtin.apt: From a6b98abd55610549d8500774ab063043ab55f799 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 16:26:31 +0100 Subject: [PATCH 30/33] bitwarden --- hosts.yml | 2 ++ playbooks/00_install_zabbix_agent.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/hosts.yml b/hosts.yml index 97de24b..9bb3108 100644 --- a/hosts.yml +++ b/hosts.yml @@ -89,6 +89,7 @@ datacenter: servers: hosts: rpi5-1.home.lan: + rpi5.home.lan: omv.home.lan: rack.home.lan: m-server.home.lan: @@ -129,6 +130,7 @@ datacenter: servers: hosts: rpi5-1.home.lan: + rpi5.home.lan: m-server.home.lan: fog.home.lan: zabbix.home.lan: diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index f4f1c76..aa1d8ec 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -62,6 +62,7 @@ deb: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb when: - ansible_facts.architecture != "armv7l" and ansible_facts.architecture != "aarch64" and ansible_distribution == "Debian" and ansible_distribution_major_version == "12" + ignore_errors: true # - name: Install a .deb package localy # ansible.builtin.apt: From 3aa45a7d3738922222924e905d1010f72e986e51 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 18:24:40 +0100 Subject: [PATCH 31/33] bitwarden --- hosts_kestra.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index f2de466..7073efd 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -87,6 +87,7 @@ datacenter: servers: hosts: rpi5-1.home.lan: + rpi5.home.lan: omv.home.lan: rack.home.lan: m-server.home.lan: @@ -97,6 +98,7 @@ datacenter: ansible_ssh_user: jd ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem + identity_file: ssh_key.pem nas: hosts: nas.home.lan: @@ -123,6 +125,7 @@ datacenter: servers: hosts: rpi5-1.home.lan: + rpi5.home.lan: m-server.home.lan: fog.home.lan: zabbix.home.lan: @@ -134,6 +137,7 @@ datacenter: # ansible_ssh_password: l4c1j4yd33Du5lo ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem + identity_file: ssh_key.pem nas: hosts: nas.home.lan: From 57bf458024384dce7df00a2ab4131c07670fc1d0 Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 18:25:39 +0100 Subject: [PATCH 32/33] bitwarden --- hosts_kestra.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts_kestra.yml b/hosts_kestra.yml index 7073efd..b81d8aa 100644 --- a/hosts_kestra.yml +++ b/hosts_kestra.yml @@ -138,6 +138,7 @@ datacenter: ansible_become_password: l4c1j4yd33Du5lo ansible_ssh_private_key_file: ssh_key.pem identity_file: ssh_key.pem + ansible_ssh_pass: l4c1j4yd33Du5lo nas: hosts: nas.home.lan: From e2ad4647c8117e533cf9d2aca6aa41920aff5d0d Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 19 Nov 2024 23:36:39 +0100 Subject: [PATCH 33/33] bitwarden --- hosts_init.yml | 36 ++++++++++++++++++++++++++++------ playbooks/install_mqtt_srv.yml | 26 ++++++++++++++++++------ 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/hosts_init.yml b/hosts_init.yml index e141576..5a6704d 100644 --- a/hosts_init.yml +++ b/hosts_init.yml @@ -1,7 +1,31 @@ --- -odroid_cluster: - hosts: - 192.168.77.16[1:5]: - vars: - ansible_ssh_user: root - ansible_ssh_pass: 1234 \ No newline at end of file +datacenter: + children: + servers: + hosts: + rpi5-1.home.lan: + rpi5.home.lan: + m-server.home.lan: + fog.home.lan: + zabbix.home.lan: + omv.home.lan: + 192.168.77.101: + vars: + ansible_python_interpreter: /usr/bin/python3 + ansible_ssh_user: jd + # ansible_ssh_password: l4c1j4yd33Du5lo + ansible_become_password: l4c1j4yd33Du5lo + identity_file: ssh_key.pem + ansible_ssh_pass: l4c1j4yd33Du5lo + ansible_become_user: root + nas: + hosts: + nas.home.lan: + 192.168.77.106: + vars: + ansible_ssh_user: admin + become_method: su + become_user: admin + # ansible_user: admin + # ansible_pass: l4c1!j4yd33?Du5lo1 + ansible_python_interpreter: /share/ZFS530_DATA/.qpkg/QPython312/bin/python3 diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index 59116df..01bf8ba 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -2,6 +2,8 @@ name: Install mqtt_srv ignore_unreachable: false ignore_errors: true + vars: + dest_folder: "/tmp/ans_repo" tasks: # - name: Install python3-pip # ansible.builtin.apt: @@ -11,13 +13,25 @@ # when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router'] # become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - + - name: include vault + ansible.builtin.include_vars: + file: ../jaydee.yml + - name: GIT pull + become: true + tags: + - git_pull + git: + repo: "https://{{ git_user | urlencode }}:{{ git_password | urlencode }}@gitlab.sectorq.eu/jaydee/mqtt_srv.git" + dest: "{{ dest_folder }}" + update: yes + clone: yes + version: main - debug: msg: "{{ inventory_hostname }}" - name: Upload service config ansible.builtin.copy: - src: services/mqtt_srv.service + src: "{{ dest_folder }}/mqtt_srv.service" dest: /etc/systemd/system/ when: inventory_hostname != 'nas.home.lan' become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}" @@ -26,7 +40,7 @@ - name: Upload service script ansible.builtin.copy: - src: scripts/mqtt_srv.py + src: "{{ dest_folder }}/mqtt_srv.py" dest: /usr/bin/ mode: '755' owner: root @@ -35,7 +49,7 @@ - name: Upload service script config ansible.builtin.copy: - src: scripts/mqtt_srv.cfg + src: "{{ dest_folder }}/mqtt_srv.cfg" dest: /etc/mqtt_srv/ mode: '755' owner: root @@ -62,7 +76,7 @@ - name: Upload service script1 ansible.builtin.copy: - src: scripts/mqtt_srv.sh + src: "{{ dest_folder }}/mqtt_srv.sh" dest: /etc/init.d/ mode: '755' owner: admin @@ -71,7 +85,7 @@ - name: Upload service script2 ansible.builtin.copy: - src: scripts/mqtt_srv.py + src: "{{ dest_folder }}/mqtt_srv.py" dest: /usr/bin/ mode: '755' owner: admin