From 3b69def1b8584fa2551e8a5cbd59ecda55e6a78e Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 10 Mar 2026 08:54:22 +0100 Subject: [PATCH] added next folders for migration --- inventory/inventory.yml | 51 ++++++++++++++++++++ playbooks/pi_install_caddy.yml | 16 +++++++ playbooks/pi_install_home-assistant.yml | 63 +++++++++++++++++++++++++ playbooks/pi_install_homeassistant.yml | 31 ++++++++++++ playbooks/pi_uname.yml | 16 +++++++ playbooks/pi_upgrade.yml | 33 +++++++++++++ playbooks/roles | 1 + 7 files changed, 211 insertions(+) create mode 100644 inventory/inventory.yml create mode 100644 playbooks/pi_install_caddy.yml create mode 100644 playbooks/pi_install_home-assistant.yml create mode 100644 playbooks/pi_install_homeassistant.yml create mode 100644 playbooks/pi_uname.yml create mode 100644 playbooks/pi_upgrade.yml create mode 120000 playbooks/roles diff --git a/inventory/inventory.yml b/inventory/inventory.yml new file mode 100644 index 0000000..3203225 --- /dev/null +++ b/inventory/inventory.yml @@ -0,0 +1,51 @@ +for_installation: + hosts: + new_hosts: + ansible_host: 192.168.0.68 + become_method: sudo + become_user: testuser + vars: + ansible_host_key_checking: false + ansible_user: testuser + ansible_password: a123456 + become_method: sudo + become_user: testuser + ansible_become_password: a123456 +ha: + hosts: + homeassistant: + ansible_host: 192.168.0.57 + caddy: + ansible_host: 192.168.0.68 + vars: + ansible_host_key_checking: false + ansible_user: mario + ansible_password: migO0472 +nc: + hosts: + nextcloud: + ansible_host: 192.168.0.70 + vars: + ansible_host_key_checking: false + ansible_user: mario + ansible_password: migO0472 +proxy: + hosts: + caddy: + ansible_host: 192.168.0.59 + vars: + ansible_host_key_checking: false + ansible_user: mario + ansible_password: migO0472 +prod: + hosts: + homeassistant: + ansible_host: 192.168.0.57 + nextcloud: + ansible_host: 192.168.0.70 + caddy: + ansible_host: 192.168.0.59 + vars: + ansible_host_key_checking: false + ansible_user: mario + ansible_password: migO0472 diff --git a/playbooks/pi_install_caddy.yml b/playbooks/pi_install_caddy.yml new file mode 100644 index 0000000..d2f1e58 --- /dev/null +++ b/playbooks/pi_install_caddy.yml @@ -0,0 +1,16 @@ +- name: Install the caddy docker release + hosts: new_hosts + + tasks: + - name: call the caddy install role + ansible.builtin.include_role: + name: install_caddy_docker + tasks_from: create_folder_structure.yml + - name: install_caddy_docker + ansible.builtin.include_role: + name: install_caddy_docker + tasks_from: copy_files.yml + - name: call the caddy start role + ansible.builtin.include_role: + name: install_caddy_docker + tasks_from: start_docker_container.yml diff --git a/playbooks/pi_install_home-assistant.yml b/playbooks/pi_install_home-assistant.yml new file mode 100644 index 0000000..a1bff4a --- /dev/null +++ b/playbooks/pi_install_home-assistant.yml @@ -0,0 +1,63 @@ +- name: Install the homeassistant docker with additional features as choosen + hosts: new_hosts + gather_facts: True + + tasks: + # - name: call the homeassistant stop role + # ansible.builtin.include_role: + # name: install_homeassistant_docker + # tasks_from: stop_docker_container.yml + + - name: call the install docker role + ansible.builtin.include_role: + name: create_folder_structure + tasks_from: create_ha_folder_structure.yml + when: "{{ ha}}" + + - name: copy the ha docker files + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: copy_ha_files.yml + when: "{{ ha }}" + + - name: copy the postgres docker files + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: copy_postgres_files.yml + when: "{{ pg }}" + + - name: copy the mosquitto docker files + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: copy_mosquitto_files.yml + when: "{{ mq }}" + + # - name: install homeassistant docker with grafana + # ansible.builtin.include_role: + # name: install_homeassistant_docker + # tasks_from: copy_files_ha-grafana.yml + # when: "{{ grafana }}" + + # - name: install homeassistant docker (HA + PostgresDB) + # ansible.builtin.include_role: + # name: install homeassistant docker only + # tasks_from: copy_files_ha-only.yml + # when: "{{ ha-only }}" + + - name: call the homeassistant ha start role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: start_ha_docker_container.yml + when: "{{ ha }}" + + - name: call the homeassistant postgres start role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: start_postgres_docker_container.yml + when: "{{ pg }}" + + - name: call the homeassistant mosquitto start role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: start_mosquitto_docker_container.yml + when: "{{ mq }}" diff --git a/playbooks/pi_install_homeassistant.yml b/playbooks/pi_install_homeassistant.yml new file mode 100644 index 0000000..de9cc68 --- /dev/null +++ b/playbooks/pi_install_homeassistant.yml @@ -0,0 +1,31 @@ +- name: Install the homeassistant docker with additional features as choosen + hosts: new_hosts + gather_facts: True + + tasks: + - name: call the homeassistant stop role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: stop_docker_container.yml + + - name: call the install docker role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: create_folder_structure.yml + + - name: install homeassistant docker with grafana + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: copy_files_ha-grafana.yml + when: "{{ grafana }}" + + - name: install homeassistant docker (HA + PostgresDB) + ansible.builtin.include_role: + name: install homeassistant docker only + tasks_from: copy_files_ha-only.yml + when: "{{ ha-only }}" + + - name: call the homeassistant start role + ansible.builtin.include_role: + name: install_homeassistant_docker + tasks_from: start_docker_container.yml diff --git a/playbooks/pi_uname.yml b/playbooks/pi_uname.yml new file mode 100644 index 0000000..3c3a56a --- /dev/null +++ b/playbooks/pi_uname.yml @@ -0,0 +1,16 @@ +- name: execute uname on the inventory hosts as demo + hosts: nextcloud + tasks: + - name: create file to write in + become: false + command: touch output.txt + + - name: get system informations + become: true + shell: apt update + register: os_info + + - debug: + msg: "{{os_info.stdout_lines}}" + + #when: inventory_hostname in groups['proxy'] diff --git a/playbooks/pi_upgrade.yml b/playbooks/pi_upgrade.yml new file mode 100644 index 0000000..f63935c --- /dev/null +++ b/playbooks/pi_upgrade.yml @@ -0,0 +1,33 @@ +- name: Update the Pi OS + hosts: nextcloud + + tasks: + - name: call the update role + ansible.builtin.include_role: + name: upgrade_os + tasks_from: pi_update.yml + + - name: call the upgrade role + ansible.builtin.include_role: + name: upgrade_os + tasks_from: pi_upgrade.yml + + - name: call the restart role + ansible.builtin.include_role: + name: upgrade_os + tasks_from: pi_restart.yml + +# tasks: +# - name: create file to write in +# become: false +# command: touch output.txt +# +# - name: get system informations +# become: true +# shell: apt update +# register: os_info +# +# - debug: +# msg: "{{os_info.stdout_lines}}" + + #when: inventory_hostname in groups['proxy'] diff --git a/playbooks/roles b/playbooks/roles new file mode 120000 index 0000000..7b9ade8 --- /dev/null +++ b/playbooks/roles @@ -0,0 +1 @@ +../roles/ \ No newline at end of file