Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4c8e86486 | |||
| 8411365d0c | |||
| fa0c63ab83 | |||
| 52b1298334 | |||
| 48d44de2c9 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,4 +3,4 @@
|
||||
private
|
||||
.vscode
|
||||
.ansible
|
||||
.git
|
||||
.git.vault_password
|
||||
|
||||
1
.vault_password
Normal file
1
.vault_password
Normal file
@ -0,0 +1 @@
|
||||
changeme
|
||||
44
README.md
44
README.md
@ -1,3 +1,45 @@
|
||||
# HomeCloudPlaybooks
|
||||
|
||||
My Ansible Playbooks live here
|
||||
This repository contains Ansible playbooks for setting up and configuring a home cloud environment.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Ansible 2.9 or higher
|
||||
- Python 3.6 or higher
|
||||
- `sshpass` installed on the control node
|
||||
|
||||
## Usage
|
||||
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://gitea.tobjend.de/tobi/HomeCloudPlaybooks.git
|
||||
cd HomeCloudPlaybooks
|
||||
```
|
||||
|
||||
2. **Install Ansible collections:**
|
||||
```bash
|
||||
ansible-galaxy collection install -r playbooks/requirements.yml
|
||||
```
|
||||
|
||||
3. **Configure the inventory:**
|
||||
- Copy the `inventory/hosts.yml.example` to `inventory/hosts.yml`.
|
||||
- Update the `inventory/hosts.yml` file with your host information.
|
||||
|
||||
4. **Configure secrets:**
|
||||
- This project uses Ansible Vault to manage secrets.
|
||||
- Create a `vault_password.txt` file with your vault password.
|
||||
- Run the playbooks using the `--vault-password-file` option:
|
||||
```bash
|
||||
ansible-playbook playbooks/main.yml --vault-password-file vault_password.txt
|
||||
```
|
||||
|
||||
## Inventory Structure
|
||||
|
||||
The inventory is located in the `inventory` directory. The main inventory file is `hosts.yml`. The inventory is organized into groups of hosts.
|
||||
|
||||
## Roles
|
||||
|
||||
The following roles are available in the `playbooks/roles` directory:
|
||||
|
||||
- `gitea`: Installs and configures Gitea, a self-hosted Git service.
|
||||
- ... (more roles to be documented here)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[defaults]
|
||||
inventory = ./inventory/hosts.yml
|
||||
remote_user = ubuntu
|
||||
private_key_file = ./private/astronomican.pem
|
||||
vault_password_file = ./.vault_password
|
||||
host_key_checking = False
|
||||
interpreter_python = auto_silent
|
||||
roles_path = ./roles
|
||||
roles_path = ./playbooks/roles
|
||||
20
inventory/group_vars/all.yml
Normal file
20
inventory/group_vars/all.yml
Normal file
@ -0,0 +1,20 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
66383465623264336234336665613539316135346265343564393666396566636137316131663731
|
||||
3063396330653439623765346564616539383933393239320a323961643536303333623434353337
|
||||
39303265323535633635653639656262396533383035653639643634656132653933383635613936
|
||||
6263343134616462350a666665363234613864353438313663393230313534346238633731623464
|
||||
65626432663566396237666232346537386332653634313137663238653631613031663038306161
|
||||
64316562393664393737303336646562323436323230303835323738633435613363363836646137
|
||||
32393766643936303732643164363433316239303065363438376431646131623038303238353564
|
||||
39306339373137623831396238643965636162383063353238376437653236383030633335326662
|
||||
61633136396461326264313339653937316332656635643230383539626136613666393438653637
|
||||
64393038643934366231323632663236343932333061316533666536656461373564616235303632
|
||||
61636231626533303730353563373664383337393866346437623538636130396565336639643137
|
||||
38616165343833366132346138333930393838303266633038303063626364376431653665303537
|
||||
36306661633133313839363630303332613164393261313139336239633964376631343732643061
|
||||
66613337333465333036333534666565373261313865333539666139663735363834643031333836
|
||||
65316232336363306561353339633364396638643937333830353262326138653231353863376635
|
||||
37633832323861623833383936383066366639653833356465393263376335333664323863363863
|
||||
63376235343461303163653662623765383530373561666365313165646161303635303536643137
|
||||
62613535306661663738363062326133343734313931653534326265313238623531376430613032
|
||||
356163313666656235343236333166653234
|
||||
@ -14,3 +14,10 @@ all:
|
||||
ansible_host: 141.147.24.166
|
||||
ansible_user: ubuntu
|
||||
ansible_ssh_private_key_file: ~/.ssh/ora-cloud/sublime-key.key
|
||||
nextcloud:
|
||||
ansible_host: 1.2.3.4 # Placeholder IP
|
||||
ansible_user: ubuntu
|
||||
ansible_ssh_private_key_file: ~/.ssh/ora-cloud/sublime-key.key
|
||||
nextcloud_servers:
|
||||
hosts:
|
||||
nextcloud:
|
||||
@ -1,21 +1,3 @@
|
||||
- name: Set up reverse Proxy
|
||||
hosts: sublimePorte
|
||||
become: true
|
||||
roles:
|
||||
# - common
|
||||
# - zsh_with_style
|
||||
# - docker
|
||||
# - portainer
|
||||
#- network
|
||||
# - containers
|
||||
- name: Set up webservices
|
||||
hosts: webservices
|
||||
become: true
|
||||
roles:
|
||||
- gitea
|
||||
# - authentik
|
||||
# - common
|
||||
# - zsh_with_style
|
||||
# - docker
|
||||
# - portainer
|
||||
# - containers
|
||||
---
|
||||
- import_playbook: portainer.yml
|
||||
- import_playbook: nextcloud.yml
|
||||
|
||||
5
playbooks/nextcloud.yml
Normal file
5
playbooks/nextcloud.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: Set up Nextcloud
|
||||
hosts: nextcloud_servers
|
||||
become: true
|
||||
roles:
|
||||
- nextcloud
|
||||
7
playbooks/portainer.yml
Normal file
7
playbooks/portainer.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- name: Set up Portainer
|
||||
hosts: sublimePorte
|
||||
become: true
|
||||
roles:
|
||||
- docker
|
||||
- portainer
|
||||
- openwebui
|
||||
10
playbooks/requirements.yml
Normal file
10
playbooks/requirements.yml
Normal file
@ -0,0 +1,10 @@
|
||||
# requirements.yml
|
||||
|
||||
# This file lists the Ansible collections required by the playbooks.
|
||||
# The collections are based on the commented-out roles in main.yml.
|
||||
|
||||
collections:
|
||||
- name: community.general
|
||||
version: "3.0.0"
|
||||
- name: community.crypto
|
||||
version: "2.0.0"
|
||||
@ -1,8 +0,0 @@
|
||||
---
|
||||
common_packages:
|
||||
- git
|
||||
- nano
|
||||
- tree
|
||||
- htop
|
||||
- iputils-ping
|
||||
- zsh
|
||||
@ -1,20 +0,0 @@
|
||||
---
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
become: true
|
||||
|
||||
- name: Install Common packages
|
||||
apt:
|
||||
name: "{{ common_packages }}"
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Set zsh as the default shell
|
||||
shell: chsh -s $(which zsh) {{ ansible_user }}
|
||||
become: true
|
||||
when: ansible_user != "root"
|
||||
register: chsh_result
|
||||
failed_when: chsh_result.rc != 0
|
||||
changed_when: false
|
||||
@ -1,16 +0,0 @@
|
||||
---
|
||||
# Pi-Hole container configuration
|
||||
pi_hole_container_name: "pihole"
|
||||
pi_hole_image: "pihole/pihole:latest"
|
||||
pi_hole_host_port: "314"
|
||||
pi_hole_dns_port: "53"
|
||||
pi_hole_timezone: "Europe/Berlin"
|
||||
pi_hole_volume_dir: "/opt/pi-hole" # Directory to store Pi-Hole data
|
||||
pi_hole_web_password: "risICE3!risICE3!" # Change this to a secure password
|
||||
blocklists:
|
||||
- https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt
|
||||
- https://raw.githubusercontent.com/daylamtayari/Pi-Hole-Blocklist/master/Pi-Hole-Blocklist.txt
|
||||
- https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.txt
|
||||
|
||||
# Docker network configuration
|
||||
docker_network_name: "pi-hole-net"
|
||||
@ -1,15 +0,0 @@
|
||||
services:
|
||||
pihole:
|
||||
image: pihole/pihole:latest
|
||||
ports:
|
||||
- '53:53/tcp'
|
||||
- '53:53/udp'
|
||||
- '67:67/udp'
|
||||
- '80:80/tcp'
|
||||
environment:
|
||||
- TZ=Europe/Berlin
|
||||
- WEBPASSWORD=risICE3!risICE3!
|
||||
volumes:
|
||||
- './etc-pihole:/etc/pihole'
|
||||
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||
restart: unless-stopped
|
||||
@ -1,3 +0,0 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: portainer
|
||||
@ -1,114 +0,0 @@
|
||||
---
|
||||
- name: Ensure Pi-Hole data directory exists
|
||||
file:
|
||||
path: "{{ pi_hole_volume_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
become: true
|
||||
|
||||
- name: Generate Docker Compose file for Pi-Hole
|
||||
template:
|
||||
src: pi-hole-compose.j2
|
||||
dest: /opt/pi-hole/docker-compose.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
become: true
|
||||
|
||||
- name: Ensure Docker network exists
|
||||
community.docker.docker_network:
|
||||
name: "{{ docker_network_name }}"
|
||||
driver: bridge
|
||||
state: present
|
||||
|
||||
- name: Ensure systemd-resolved is installed
|
||||
ansible.builtin.apt:
|
||||
name: systemd-resolved
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Disable DNSStubListener in resolved.conf
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/systemd/resolved.conf
|
||||
regexp: '^#?DNSStubListener='
|
||||
line: 'DNSStubListener=no'
|
||||
create: true
|
||||
mode: '0644' # Secure file permissions
|
||||
become: true
|
||||
|
||||
- name: Restart systemd-resolved service
|
||||
ansible.builtin.service:
|
||||
name: systemd-resolved
|
||||
state: restarted
|
||||
become: true
|
||||
changed_when: false
|
||||
|
||||
- name: Verify port 53 is no longer in use by systemd-resolved
|
||||
ansible.builtin.command: ss -tuln | grep ':53'
|
||||
register: port_check
|
||||
failed_when: port_check.rc == 0 and '127.0.0.53:53' in port_check.stdout
|
||||
changed_when: false
|
||||
become: true
|
||||
|
||||
- name: Ensure Docker service directory exists
|
||||
file:
|
||||
path: /etc/systemd/system/docker.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
become: true
|
||||
|
||||
- name: Add custom DNS settings to Docker service
|
||||
lineinfile:
|
||||
path: /etc/systemd/system/docker.service.d/docker.conf
|
||||
create: true
|
||||
line: |
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --dns 8.8.8.8 --dns 8.8.4.4
|
||||
regexp: '^ExecStart='
|
||||
insertafter: '^\[Service\]'
|
||||
state: present
|
||||
mode: '0644'
|
||||
become: true
|
||||
|
||||
- name: Reload systemd daemon
|
||||
systemd:
|
||||
daemon_reload: true
|
||||
become: true
|
||||
|
||||
- name: Restart Docker service
|
||||
service:
|
||||
name: docker
|
||||
state: restarted
|
||||
become: true
|
||||
|
||||
- name: Deploy Pi-Hole container using Docker Compose V2
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: /opt/pi-hole
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Ensure Pi-Hole container is running
|
||||
community.docker.docker_container_info:
|
||||
name: "{{ pi_hole_container_name }}"
|
||||
register: container_info
|
||||
|
||||
- name: Restart Pi-Hole container if not running
|
||||
community.docker.docker_container:
|
||||
name: "{{ pi_hole_container_name }}"
|
||||
state: started
|
||||
restart: true
|
||||
when: not container_info.container.State.Running
|
||||
|
||||
- name: Wait for the container to be fully operational
|
||||
command: docker exec {{ pi_hole_container_name }} pihole status
|
||||
register: pihole_status
|
||||
until: "'Pi-hole blocking is enabled' in pihole_status.stdout"
|
||||
retries: 30
|
||||
delay: 5
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
@ -1,21 +0,0 @@
|
||||
services:
|
||||
pihole:
|
||||
container_name: {{ pi_hole_container_name }}
|
||||
image: {{ pi_hole_image }}
|
||||
ports:
|
||||
- "{{ pi_hole_host_port }}:80/tcp"
|
||||
- "{{ pi_hole_dns_port }}:53/tcp"
|
||||
- "{{ pi_hole_dns_port }}:53/udp"
|
||||
environment:
|
||||
TZ: {{ pi_hole_timezone }}
|
||||
WEBPASSWORD: {{ pi_hole_web_password }}
|
||||
volumes:
|
||||
- "{{ pi_hole_volume_dir }}/etc-pihole:/etc/pihole"
|
||||
- "{{ pi_hole_volume_dir }}/etc-dnsmasq.d:/etc/dnsmasq.d"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
{{ docker_network_name }}:
|
||||
driver: bridge
|
||||
@ -1,10 +0,0 @@
|
||||
# roles/gitea/defaults/main.yml
|
||||
gitea_version: "latest"
|
||||
gitea_container_name: "gitea"
|
||||
gitea_data_path: "/opt/gitea"
|
||||
gitea_port: 3000
|
||||
postgres_host: "localhost"
|
||||
postgres_port: 5432
|
||||
postgres_db: "postgres"
|
||||
postgres_user: "tobi"
|
||||
postgres_password: "risICE3"
|
||||
@ -1,3 +0,0 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: postgres
|
||||
@ -1,33 +0,0 @@
|
||||
- name: Create Gitea data directory
|
||||
file:
|
||||
path: "{{ gitea_data_path }}"
|
||||
state: directory
|
||||
owner: "1000"
|
||||
group: "1000"
|
||||
mode: '0755'
|
||||
become: true
|
||||
|
||||
- name: Copy Docker Compose file
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ gitea_data_path }}/docker-compose.yml"
|
||||
mode: '0644'
|
||||
become: true
|
||||
|
||||
- name: Deploy Gitea container using Docker Compose V2
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ gitea_data_path }}"
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Ensure Gitea container is running
|
||||
community.docker.docker_container_info:
|
||||
name: "{{ gitea_container_name }}"
|
||||
register: container_info
|
||||
|
||||
- name: Restart Gitea container if not running
|
||||
community.docker.docker_container:
|
||||
name: "{{ gitea_container_name }}"
|
||||
state: started
|
||||
restart: true
|
||||
when: not container_info.container.State.Running
|
||||
@ -1,17 +0,0 @@
|
||||
services:
|
||||
gitea:
|
||||
image: gitea/gitea:{{ gitea_version }}
|
||||
container_name: {{ gitea_container_name }}
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- DB_TYPE=postgres
|
||||
- DB_HOST={{ postgres_host }}:{{ postgres_port }}
|
||||
- DB_NAME={{ postgres_db }}
|
||||
- DB_USER={{ postgres_user }}
|
||||
- DB_PASSWD={{ postgres_password }}
|
||||
restart: always
|
||||
volumes:
|
||||
- {{ gitea_data_path }}:/data
|
||||
ports:
|
||||
- "{{ gitea_port }}:3000"
|
||||
@ -5,7 +5,7 @@ nginx_proxy_manager_data_path: "/opt/nginx-proxy-manager/data"
|
||||
nginx_proxy_manager_letsencrypt_path: "/opt/nginx-proxy-manager/letsencrypt"
|
||||
nginx_proxy_manager_compose_path: "/opt/nginx-proxy-manager/docker-compose.yml"
|
||||
nginx_proxy_manager_admin_email: "tobend85@gmail.com"
|
||||
nginx_proxy_manager_admin_password: "risICE3"
|
||||
nginx_proxy_manager_admin_password: "{{ vault_nginx_proxy_manager_admin_password }}"
|
||||
nginx_proxy_manager_port: "9900"
|
||||
nginx_proxy_manager_ssl_port: "443"
|
||||
# Docker network configuration
|
||||
@ -18,5 +18,5 @@ wireguard_easy_admin_port: "51821"
|
||||
wireguard_easy_data_dir: "/etc/wireguard"
|
||||
wireguard_easy_config_dir: "/opt/network"
|
||||
wireguard_easy_host: "130.162.231.152"
|
||||
wireguard_easy_password: "admin"
|
||||
wireguard_easy_password: "{{ vault_wireguard_easy_password }}"
|
||||
wireguard_easy_password_hash: ""
|
||||
|
||||
36
playbooks/roles/nextcloud/README.md
Normal file
36
playbooks/roles/nextcloud/README.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Ansible Role: Nextcloud Docker Compose
|
||||
|
||||
An Ansible role to deploy Nextcloud using Docker Compose.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
```yaml
|
||||
nextcloud_data_dir: "/opt/nextcloud"
|
||||
nextcloud_port: 8080
|
||||
nextcloud_db_name: "nextcloud"
|
||||
nextcloud_db_user: "nextcloud"
|
||||
nextcloud_admin_user: "admin"
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- docker
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: "servers"
|
||||
roles:
|
||||
- role: "nextcloud"
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
6
playbooks/roles/nextcloud/defaults/main.yml
Normal file
6
playbooks/roles/nextcloud/defaults/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
nextcloud_data_dir: "/opt/nextcloud"
|
||||
nextcloud_port: 8080
|
||||
nextcloud_db_name: "nextcloud"
|
||||
nextcloud_db_user: "nextcloud"
|
||||
nextcloud_admin_user: "admin"
|
||||
12
playbooks/roles/nextcloud/meta/main.yml
Normal file
12
playbooks/roles/nextcloud/meta/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
galaxy_info:
|
||||
author: "Your Name"
|
||||
description: "An Ansible role to deploy Nextcloud using Docker Compose"
|
||||
license: "MIT"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: "Ubuntu"
|
||||
versions:
|
||||
- "focal"
|
||||
- "bionic"
|
||||
dependencies:
|
||||
- role: docker
|
||||
16
playbooks/roles/nextcloud/tasks/main.yml
Normal file
16
playbooks/roles/nextcloud/tasks/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: "Create Nextcloud directory"
|
||||
ansible.builtin.file:
|
||||
path: "{{ nextcloud_data_dir }}"
|
||||
state: "directory"
|
||||
mode: "0755"
|
||||
|
||||
- name: "Create Nextcloud docker-compose.yml"
|
||||
ansible.builtin.template:
|
||||
src: "docker-compose.yml.j2"
|
||||
dest: "{{ nextcloud_data_dir }}/docker-compose.yml"
|
||||
|
||||
- name: "Start Nextcloud services"
|
||||
community.docker.docker_compose:
|
||||
project_src: "{{ nextcloud_data_dir }}"
|
||||
state: "present"
|
||||
33
playbooks/roles/nextcloud/templates/docker-compose.yml.j2
Normal file
33
playbooks/roles/nextcloud/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,33 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
restart: always
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB={{ nextcloud_db_name }}
|
||||
- POSTGRES_USER={{ nextcloud_db_user }}
|
||||
- POSTGRES_PASSWORD={{ vault_nextcloud_db_password }}
|
||||
|
||||
app:
|
||||
image: nextcloud
|
||||
restart: always
|
||||
ports:
|
||||
- "{{ nextcloud_port }}:80"
|
||||
links:
|
||||
- db
|
||||
volumes:
|
||||
- nextcloud:/var/www/html
|
||||
environment:
|
||||
- POSTGRES_HOST=db
|
||||
- POSTGRES_DB={{ nextcloud_db_name }}
|
||||
- POSTGRES_USER={{ nextcloud_db_user }}
|
||||
- POSTGRES_PASSWORD={{ vault_nextcloud_db_password }}
|
||||
- NEXTCLOUD_ADMIN_USER={{ nextcloud_admin_user }}
|
||||
- NEXTCLOUD_ADMIN_PASSWORD={{ vault_nextcloud_admin_password }}
|
||||
|
||||
volumes:
|
||||
db:
|
||||
nextcloud:
|
||||
34
playbooks/roles/openwebui/README.md
Normal file
34
playbooks/roles/openwebui/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Ansible Role: Open WebUI Docker Compose
|
||||
|
||||
An Ansible role to deploy Open WebUI using Docker Compose.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
```yaml
|
||||
openwebui_data_dir: "/opt/open-webui"
|
||||
openwebui_port: 8080
|
||||
openwebui_ollama_base_url: "http://localhost:11434"
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- docker
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: "servers"
|
||||
roles:
|
||||
- role: "openwebui"
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
4
playbooks/roles/openwebui/defaults/main.yml
Normal file
4
playbooks/roles/openwebui/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
openwebui_data_dir: "/opt/open-webui"
|
||||
openwebui_port: 8080
|
||||
openwebui_ollama_base_url: "http://localhost:11434"
|
||||
12
playbooks/roles/openwebui/meta/main.yml
Normal file
12
playbooks/roles/openwebui/meta/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
galaxy_info:
|
||||
author: "Your Name"
|
||||
description: "An Ansible role to deploy Open WebUI using Docker Compose"
|
||||
license: "MIT"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: "Ubuntu"
|
||||
versions:
|
||||
- "focal"
|
||||
- "bionic"
|
||||
dependencies:
|
||||
- role: docker
|
||||
16
playbooks/roles/openwebui/tasks/main.yml
Normal file
16
playbooks/roles/openwebui/tasks/main.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: "Create Open WebUI directory"
|
||||
ansible.builtin.file:
|
||||
path: "{{ openwebui_data_dir }}"
|
||||
state: "directory"
|
||||
mode: "0755"
|
||||
|
||||
- name: "Create Open WebUI docker-compose.yml"
|
||||
ansible.builtin.template:
|
||||
src: "docker-compose.yml.j2"
|
||||
dest: "{{ openwebui_data_dir }}/docker-compose.yml"
|
||||
|
||||
- name: "Start Open WebUI services"
|
||||
community.docker.docker_compose:
|
||||
project_src: "{{ openwebui_data_dir }}"
|
||||
state: "present"
|
||||
13
playbooks/roles/openwebui/templates/docker-compose.yml.j2
Normal file
13
playbooks/roles/openwebui/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,13 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
container_name: open-webui
|
||||
ports:
|
||||
- "{{ openwebui_port }}:8080"
|
||||
volumes:
|
||||
- "{{ openwebui_data_dir }}:/app/backend/data"
|
||||
environment:
|
||||
- OLLAMA_BASE_URL={{ openwebui_ollama_base_url }}
|
||||
restart: always
|
||||
@ -1,7 +0,0 @@
|
||||
---
|
||||
postgres_container_name: postgres
|
||||
postgres_port: 5432
|
||||
postgres_user: tobi
|
||||
postgres_password: risICE3
|
||||
postgres_data_dir: /var/lib/postgresql/data/pgdata
|
||||
postgres_volume: /opt/postgresData
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
- name: Run PostgreSQL Docker container
|
||||
docker_container:
|
||||
name: "{{ postgres_container_name }}"
|
||||
image: postgres
|
||||
state: started
|
||||
ports:
|
||||
- "{{ postgres_port }}:5432"
|
||||
env:
|
||||
POSTGRES_USER: "{{ postgres_user }}"
|
||||
POSTGRES_PASSWORD: "{{ postgres_password }}"
|
||||
PGDATA: "{{ postgres_data_dir }}"
|
||||
volumes:
|
||||
- "{{ postgres_volume }}:{{ postgres_data_dir }}"
|
||||
@ -1,116 +0,0 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your Oh My Zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
#ZSH_THEME="powerlevel9k/powerlevel9k"
|
||||
#POWERLEVEL9K_MODE="nerdfont-complete"
|
||||
#source $ZSH/themes/powerlevel9k/powerlevel9k.zsh-theme
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time Oh My Zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="robbyrussell"
|
||||
|
||||
# Set list of themes to pick from when loading at random
|
||||
# Setting this variable when ZSH_THEME=random will cause zsh to load
|
||||
# a theme from this variable instead of looking in $ZSH/themes/
|
||||
# If set to an empty array, this variable will have no effect.
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
CASE_SENSITIVE="false"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment one of the following lines to change the auto-update behavior
|
||||
# zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# zstyle ':omz:update' frequency 13
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# You can also set it to another string to have that shown instead of the default red dots.
|
||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# You can set one of the optional three formats:
|
||||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# or set a custom format using the strftime function format specifications,
|
||||
# see 'man strftime' for details.
|
||||
HIST_STAMPS="dd.mm.yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
|
||||
plugins=(git zsh-syntax-highlighting)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='nvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch $(uname -m)"
|
||||
|
||||
# Set personal aliases, overriding those provided by Oh My Zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
|
||||
# users are encouraged to define aliases within a top-level file in
|
||||
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
|
||||
# - $ZSH_CUSTOM/aliases.zsh
|
||||
# - $ZSH_CUSTOM/macos.zsh
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
alias zshconfig="nano ~/.zshrc"
|
||||
|
||||
#alias ls="colorls"
|
||||
#function cd { builtin cd "$@" && colorls }
|
||||
#PATH=$PATH:~/.local/share/gem/ruby/3.3.0/bin
|
||||
alias cat="batcat"
|
||||
alias top="htop"
|
||||
archey
|
||||
ls
|
||||
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: zsh_with_style/subroles/zsh
|
||||
@ -1,33 +0,0 @@
|
||||
- name: Check if Oh My Zsh is already installed
|
||||
stat:
|
||||
path: "{{ user_home }}/.oh-my-zsh"
|
||||
register: oh_my_zsh_installed
|
||||
notify: Debug Oh My Zsh installation status
|
||||
|
||||
|
||||
- name: Debug Oh My Zsh installation status
|
||||
debug:
|
||||
msg: "Oh My Zsh is {{ 'installed' if oh_my_zsh_installed.stat.exists else 'not installed' }}"
|
||||
when: oh_my_zsh_installed is defined
|
||||
|
||||
- name: Download Oh My Zsh install script using wget
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||
dest: /tmp/install-ohmyzsh.sh
|
||||
mode: '0755' # Makes it executable
|
||||
when: not oh_my_zsh_installed.stat.exists
|
||||
|
||||
- name: Install Oh My Zsh for the current user
|
||||
shell: |
|
||||
RUNZSH=no CHSH=no sh /tmp/install-ohmyzsh.sh
|
||||
args:
|
||||
creates: "{{ user_home }}/.oh-my-zsh"
|
||||
when: not oh_my_zsh_installed.stat.exists
|
||||
become: true
|
||||
become_user: "{{ ansible_user }}"
|
||||
|
||||
- name: Clone zsh-syntax-highlighting repository
|
||||
git:
|
||||
repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
|
||||
dest: "{{ user_home }}/.oh-my-zsh/plugins/zsh-syntax-highlighting"
|
||||
version: master
|
||||
@ -1,2 +0,0 @@
|
||||
---
|
||||
# No dependencies for this subrole
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Install zsh
|
||||
apt:
|
||||
name: zsh
|
||||
state: present
|
||||
|
||||
- name: Set zsh as the default shell
|
||||
shell: chsh -s $(which zsh) {{ ansible_user }}
|
||||
become: true
|
||||
when: ansible_user != "root"
|
||||
register: chsh_result
|
||||
failed_when: chsh_result.rc != 0
|
||||
changed_when: false
|
||||
@ -1,91 +0,0 @@
|
||||
---
|
||||
- name: Set home directory for the user
|
||||
set_fact:
|
||||
user_home: "/home/{{ ansible_user }}"
|
||||
|
||||
- name: Set up Zsh
|
||||
include_role:
|
||||
name: zsh_with_style/subroles/zsh
|
||||
|
||||
- name: Set up Oh My Zsh
|
||||
include_role:
|
||||
name: zsh_with_style/subroles/ohmyzsh
|
||||
|
||||
- name: Install bat
|
||||
apt:
|
||||
name: bat
|
||||
state: present
|
||||
update_cache: true
|
||||
become: true
|
||||
|
||||
- name: Ensure ~/.local/bin directory exists
|
||||
file:
|
||||
path: "{{ user_home }}/.local/bin"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy the archey 4 .deb package to the remote host
|
||||
copy:
|
||||
src: archey4_4.15.0.0-1_all.deb # Name of the .deb file in the `files` folder
|
||||
dest: /tmp/archey4_4.15.0.0-1_all.deb
|
||||
mode: '0644'
|
||||
|
||||
- name: Install archey 4
|
||||
apt:
|
||||
deb: /tmp/archey4_4.15.0.0-1_all.deb
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Create symlink from batcat to bat
|
||||
file:
|
||||
src: /usr/bin/batcat
|
||||
dest: "{{ user_home }}/.local/bin/bat"
|
||||
state: link
|
||||
|
||||
- name: Deploy custom .zshrc file
|
||||
copy:
|
||||
src: .zshrc
|
||||
dest: ~{{ ansible_user }}/.zshrc
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: '0644'
|
||||
when: ansible_user != "root"
|
||||
|
||||
- name: Source .zshrc to apply changes
|
||||
shell: |
|
||||
source {{ user_home }}/.zshrc
|
||||
args:
|
||||
executable: /bin/zsh
|
||||
become_user: "{{ ansible_user }}"
|
||||
become: true
|
||||
changed_when: false
|
||||
|
||||
# - name: Ensure Ruby is installed
|
||||
# apt:
|
||||
# name: ruby
|
||||
# state: present
|
||||
# become: yes
|
||||
|
||||
# - name: Get Ruby version
|
||||
# command: ruby -e 'puts RUBY_VERSION'
|
||||
# register: ruby_version_output
|
||||
# become: yes
|
||||
|
||||
# - name: Set Ruby version fact
|
||||
# set_fact:
|
||||
# ruby_version: "{{ ruby_version_output.stdout }}"
|
||||
|
||||
# # - name: Ensure gem binary directory is in the user's PATH
|
||||
# # lineinfile:
|
||||
# # path: "{{ ansible_user_dir }}/.zshrc"
|
||||
# # line: 'export PATH="$HOME/.local/share/gem/ruby/{{ ruby_version }}/bin:$PATH"'
|
||||
# # create: yes
|
||||
# # become: yes
|
||||
# # become_user: "{{ ansible_user }}"
|
||||
|
||||
|
||||
# - name: Install colorls gem for the current user
|
||||
# gem:
|
||||
# name: colorls
|
||||
# become: yes
|
||||
# become_user: "{{ ansible_user }}"
|
||||
Loading…
x
Reference in New Issue
Block a user