added roles folder
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
- name: create file structure for home-assistant docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/{{ ansible_user }}/home-assistant-components
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
- name: create subfolder home-assistant
|
||||
ansible.builtin.file:
|
||||
path: /home/{{ ansible_user }}/home-assistant-components/home-assistant
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
- name: create subfolder config
|
||||
ansible.builtin.file:
|
||||
path: /home/{{ ansible_user }}/home-assistant-components/home-assistant/config
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
- name: create subfolder media
|
||||
ansible.builtin.file:
|
||||
path: /home/{{ ansible_user }}/home-assistant-components/home-assistant/media
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
@@ -0,0 +1,23 @@
|
||||
#- name: create file structure for postgres docker installation
|
||||
|
||||
- name: check if directory exists
|
||||
ansible.builtin.stat:
|
||||
path: /home/"{{ ansible_user }}"/home-assistant-components
|
||||
register: ha_comp_folder
|
||||
|
||||
- name: create file structure for home-assistant docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/"{{ ansible_user }}"/home-assistant-components
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
when: not ha_comp_folder.stat.exists
|
||||
|
||||
- name: create subfolder home-assistant
|
||||
ansible.builtin.file:
|
||||
path: /home/"{{ ansible_user }}"/home-assistant-components/postgres
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0755"
|
||||
9
roles/install_caddy_docker/tasks/copy_files.yml
Normal file
9
roles/install_caddy_docker/tasks/copy_files.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- name: copy Caddyfile and docker-compose file to the remote caddy host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/caddy/Caddyfile
|
||||
dest: /home/mario/caddy
|
||||
- src: /home/mario/persistant-data/ansible/data/caddy/docker-compose.yml
|
||||
dest: /home/mario/caddy
|
||||
@@ -0,0 +1,7 @@
|
||||
- name: create file structure for caddy docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/caddy
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
0
roles/install_caddy_docker/tasks/main.yml
Normal file
0
roles/install_caddy_docker/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: pull and start caddy container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/mario/caddy; docker network create proxy-network; docker compose up -d
|
||||
29
roles/install_homeassistant_docker/tasks/copy_files.yml
Normal file
29
roles/install_homeassistant_docker/tasks/copy_files.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
- name: copy ha docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/docker-compose.yml
|
||||
dest: /home/ramon/home-assistant-components/home-assistant/
|
||||
when: "{{ ha }}"
|
||||
|
||||
- src: /home/mario/persistant-data/ansible/data/postgres/docker-compose.yml
|
||||
dest: /home/ramon/home-assistant-components/postgres/
|
||||
when: "{{ pg }}"
|
||||
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/docker-compose.yml
|
||||
dest: /home/ramon/home-assistant-components/mosquitto/
|
||||
when: "{{ mq }}"
|
||||
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/mosquitto.log
|
||||
dest: /home/ramon/home-assistant-components/mosquitto/log/
|
||||
when: "{{ mq }}"
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/mosquitto.conf
|
||||
dest: /home/ramon/home-assistant-components/mosquitto/config/
|
||||
when: "{{ mq }}"
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
# dest: /home/ramon/home-assistant/mosquitto/log
|
||||
@@ -0,0 +1,13 @@
|
||||
- name: copy docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/docker-compose-max.yml
|
||||
dest: /home/mario/home-assistant/docker-compose.yml
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
dest: /home/mario/home-assistant/mosquitto/config
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
dest: /home/mario/home-assistant/mosquitto/config
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
dest: /home/mario/home-assistant/mosquitto/log
|
||||
@@ -0,0 +1,13 @@
|
||||
- name: copy docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/docker-compose-min.yml
|
||||
dest: /home/mario/home-assistant/docker-compose-ha-only.yml
|
||||
#- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
# dest: /home/mario/home-assistant/mosquitto/config
|
||||
#- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
# dest: /home/mario/home-assistant/mosquitto/config
|
||||
#- src: /home/mario/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
# dest: /home/mario/home-assistant/mosquitto/log
|
||||
13
roles/install_homeassistant_docker/tasks/copy_ha_files.yml
Normal file
13
roles/install_homeassistant_docker/tasks/copy_ha_files.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
- name: copy ha docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/homeassistant/docker-compose.yml
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/home-assistant/
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
# dest: /home/ramon/home-assistant/mosquitto/log
|
||||
@@ -0,0 +1,19 @@
|
||||
- name: copy mosquitto docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/docker-compose.yml
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/mosquitto/
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/mosquitto.conf
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/mosquitto/config/
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/mosquitto.log
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/mosquitto/log/
|
||||
- src: /home/mario/persistant-data/ansible/data/mosquitto/mosquitto.passwd
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/mosquitto/config/
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
# dest: /home/ramon/home-assistant/mosquitto/log
|
||||
@@ -0,0 +1,13 @@
|
||||
- name: copy postgres docker-compose file to the remote homeassistant host
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- src: /home/mario/persistant-data/ansible/data/postgres/docker-compose.yml
|
||||
dest: /home/{{ ansible_user }}/home-assistant-components/postgres/
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.conf
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.passwd
|
||||
# dest: /home/ramon/home-assistant/mosquitto/config
|
||||
#- src: /home/ramon/persistant-data/ansible/data/homeassistant/mosquitto/mosquitto.log
|
||||
# dest: /home/ramon/home-assistant/mosquitto/log
|
||||
@@ -0,0 +1,70 @@
|
||||
- name: create file structure for homeassistant docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create subfolder config
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/config
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create subfolder media
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/media
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create file structure for nodered docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/nodered
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create file structure for mosquitto docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/mosquitto
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create subfolder for mosquitto config
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/mosquitto/config
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create subfolder for mosquitto data
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/mosquitto/data
|
||||
state: directory
|
||||
owner: 1883
|
||||
group: 1883
|
||||
mode: "0755"
|
||||
- name: create subfolder for mosquitto log
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/mosquitto/log
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create file structure for influxdb docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/influxdb
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
- name: create file structure for grafana docker installation
|
||||
ansible.builtin.file:
|
||||
path: /home/mario/home-assistant/grafana
|
||||
state: directory
|
||||
owner: mario
|
||||
group: mario
|
||||
mode: "0755"
|
||||
0
roles/install_homeassistant_docker/tasks/main.yml
Normal file
0
roles/install_homeassistant_docker/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: pull and start caddy container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/mario/home-assistant; docker compose up -d
|
||||
@@ -0,0 +1,4 @@
|
||||
- name: pull and start homeassistant container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/{{ ansible_user }}/home-assistant-components/home-assistant; docker compose up -d
|
||||
@@ -0,0 +1,4 @@
|
||||
- name: pull and start postgres container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/{{ ansible_user }}/home-assistant-components/mosquitto; docker compose up -d
|
||||
@@ -0,0 +1,4 @@
|
||||
- name: pull and start postgres container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/{{ ansible_user }}/home-assistant-components/postgres; docker compose up -d
|
||||
@@ -0,0 +1,4 @@
|
||||
- name: pull and start caddy container
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: cd /home/mario/home-assistant; docker compose down -d
|
||||
0
roles/upgrade_os/tasks/main.yml
Normal file
0
roles/upgrade_os/tasks/main.yml
Normal file
0
roles/upgrade_os/tasks/pi_restart.yml
Normal file
0
roles/upgrade_os/tasks/pi_restart.yml
Normal file
16
roles/upgrade_os/tasks/pi_update.yml
Normal file
16
roles/upgrade_os/tasks/pi_update.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
- name: create file to write in
|
||||
become: false
|
||||
command: touch output.txt
|
||||
|
||||
- name: call apt update
|
||||
become: true
|
||||
shell: apt update
|
||||
register: os_info
|
||||
|
||||
- name: write to output.txt
|
||||
copy:
|
||||
content: "{{os_info.stdout_lines}}"
|
||||
dest: output.txt
|
||||
|
||||
- debug:
|
||||
msg: "{{os_info.stdout_lines}}"
|
||||
12
roles/upgrade_os/tasks/pi_upgrade.yml
Normal file
12
roles/upgrade_os/tasks/pi_upgrade.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
- name: call apt update
|
||||
become: true
|
||||
shell: apt update
|
||||
register: os_info
|
||||
|
||||
- name: write to output.txt
|
||||
copy:
|
||||
content: "{{os_info.stdout_lines}}"
|
||||
dest: output.txt
|
||||
|
||||
- debug:
|
||||
msg: "{{os_info.stdout_lines}}"
|
||||
Reference in New Issue
Block a user