Spread services across multiple groups
This commit is contained in:
parent
e4b0ed2fc2
commit
2355aa6e12
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
.venv
|
.venv
|
||||||
.vscode
|
.vscode
|
||||||
|
.vault_pass
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "services"]
|
||||||
|
path = services
|
||||||
|
url = https://git.lgoon.xyz/gabriel/lgoon-services
|
13
README.md
13
README.md
@ -6,13 +6,20 @@ This playbook was tested against a debian 12 image.
|
|||||||
## Usage
|
## Usage
|
||||||
```bash
|
```bash
|
||||||
ansible-playbook run.yml
|
ansible-playbook run.yml
|
||||||
|
ansible-playbook run.yml --ask-pass --ask-become-pass
|
||||||
|
ansible-playbook run.yml --vault-password-file .vault_pass
|
||||||
```
|
```
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
Should be defined in `group_vars/server/vars.yml`:
|
Should be defined in `group_vars/server/vars.yml`:
|
||||||
- **services_dir**: fodler path containing all folders with docker-compose stacks. they should have the scructure `<service>/docker-compose.yml` and optionally include `<service>/.env` files
|
- **services_dir**: folder path containing all folders with docker-compose stacks. they should have the scructure `<service>/docker-compose.yml` and optionally include `<service>/.env` files
|
||||||
- **services**: list of services in the service_dir container all `<service>` folders
|
- **services**: list of services in the service_dir container all `<service>` folders
|
||||||
- **packages**: utils packages for linxu environment
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Secrets
|
||||||
|
```bash
|
||||||
|
ansible-vault create secret.yml
|
||||||
|
ansible-vault edit secret
|
||||||
|
ansible-vault view secret
|
||||||
|
ansible-vault encrypt secret.yml
|
||||||
|
```
|
||||||
|
8
group_vars/all.yml
Normal file
8
group_vars/all.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
packages:
|
||||||
|
- git
|
||||||
|
- htop
|
||||||
|
- rsync
|
||||||
|
- wget
|
||||||
|
base_services:
|
||||||
|
- portainer
|
||||||
|
services_configs_dir: ""
|
3
group_vars/dev-server/vars.yml
Normal file
3
group_vars/dev-server/vars.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
services:
|
||||||
|
- gitea
|
||||||
|
services: "{{ base_services + services }}"
|
5
group_vars/file-server/vars.yml
Normal file
5
group_vars/file-server/vars.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
services:
|
||||||
|
- nextcloud
|
||||||
|
- syncthing
|
||||||
|
- immich
|
||||||
|
services: "{{ base_services + services }}"
|
9
group_vars/management-server/vars.yml
Normal file
9
group_vars/management-server/vars.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
# - pinry
|
||||||
|
# - piped
|
||||||
|
# - immich
|
||||||
|
# - monica
|
||||||
|
# - piwigo
|
||||||
|
# - vikunja
|
||||||
|
- syncthing
|
||||||
|
services: "{{ base_services + services }}"
|
9
group_vars/media-downloading-server/vars.yml
Normal file
9
group_vars/media-downloading-server/vars.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
# - pinry
|
||||||
|
# - piped
|
||||||
|
# - immich
|
||||||
|
# - monica
|
||||||
|
# - piwigo
|
||||||
|
# - vikunja
|
||||||
|
- syncthing
|
||||||
|
services: "{{ base_services + services }}"
|
9
group_vars/media-server/vars.yml
Normal file
9
group_vars/media-server/vars.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
# - pinry
|
||||||
|
# - piped
|
||||||
|
# - immich
|
||||||
|
# - monica
|
||||||
|
# - piwigo
|
||||||
|
# - vikunja
|
||||||
|
- syncthing
|
||||||
|
services: "{{ base_services + services }}"
|
@ -1,10 +1,9 @@
|
|||||||
packages:
|
|
||||||
- git
|
|
||||||
- htop
|
|
||||||
services:
|
services:
|
||||||
- pinry
|
# - pinry
|
||||||
- immich
|
# - piped
|
||||||
- monica
|
# - immich
|
||||||
- piwigo
|
# - monica
|
||||||
- vikunja
|
# - piwigo
|
||||||
services_dir: /home/gabriel/hosted
|
# - vikunja
|
||||||
|
- syncthing
|
9
group_vars/socialmedia-server/vars.yml
Normal file
9
group_vars/socialmedia-server/vars.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
# - pinry
|
||||||
|
# - piped
|
||||||
|
# - immich
|
||||||
|
# - monica
|
||||||
|
# - piwigo
|
||||||
|
# - vikunja
|
||||||
|
- syncthing
|
||||||
|
services: "{{ global_services + services }}"
|
@ -1,8 +1,22 @@
|
|||||||
server:
|
file-servers:
|
||||||
hosts:
|
hosts:
|
||||||
ec2-13-239-10-136.ap-southeast-2.compute.amazonaws.com:
|
debianpx:
|
||||||
|
ansible_host: 192.168.122.177
|
||||||
|
ansible_user: gabriel
|
||||||
vars:
|
vars:
|
||||||
ansible_user: admin
|
services_dir: /home/gabriel/hosted
|
||||||
ansible_ssh_private_key_file: /home/gabriel/dev/terraform/terraform-lab/ec2ml/my_ssh.pem
|
services_configs_dir: /home/gabriel/hosted/configs
|
||||||
PERSISTENT_DIRECTORY: /persistent
|
PERSISTENT_DIRECTORY: /home/gabriel/hosted/persistent
|
||||||
VOLATILE_DIRECTORY: /volatile %
|
VOLATILE_DIRECTORY: /home/gabriel/hosted/volatile
|
||||||
|
BACKUPDIR: /home/gabriel/hosted/backup
|
||||||
|
APPSDIR: /home/gabriel/hosted/apps
|
||||||
|
MEDIADIR: /home/gabriel/hosted/media
|
||||||
|
|
||||||
|
media-servers:
|
||||||
|
hosts:
|
||||||
|
algrroca:
|
||||||
|
ansible_user: root
|
||||||
|
# ansible_ssh_private_key_file: /home/gabriel/.ssh/aws_ec2_ssh.pem
|
||||||
|
# PERSISTENT_DIRECTORY: /home/srv/raidded
|
||||||
|
# VOLATILE_DIRECTORY: /home/srv/mstorage
|
||||||
|
# ansible_sudo_pass:
|
||||||
|
1
requirments.txt
Normal file
1
requirments.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
ansible
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
- name: Update packages
|
- name: Update packages
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
update_cache: yes
|
update_cache: true
|
||||||
upgrade: yes
|
upgrade: true
|
||||||
|
|
||||||
- name: Install essential packages
|
- name: Install essential packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ packages }}"
|
name: "{{ packages }}"
|
||||||
state: latest
|
state: latest
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
- name: Install aptitude
|
- name: Install aptitude
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: aptitude
|
name: aptitude
|
||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Install required system packages
|
- name: Install required system packages
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
pkg:
|
pkg:
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
@ -19,23 +19,23 @@
|
|||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Add Docker GPG apt Key
|
- name: Add Docker GPG apt Key
|
||||||
apt_key:
|
ansible.builtin.apt_key:
|
||||||
url: https://download.docker.com/linux/debian/gpg
|
url: https://download.docker.com/linux/debian/gpg
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add Docker Repository
|
- name: Add Docker Repository
|
||||||
apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: deb https://download.docker.com/linux/debian bookworm stable
|
repo: deb https://download.docker.com/linux/debian bookworm stable
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Update apt and install docker-ce
|
- name: Update apt and install docker-ce
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: docker-ce
|
name: docker-ce
|
||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Update apt and install docker-compose
|
- name: Update apt and install docker-compose
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: docker-compose
|
name: docker-compose
|
||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
@ -44,3 +44,9 @@
|
|||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: docker
|
name: docker
|
||||||
extra_args: --break-system-packages
|
extra_args: --break-system-packages
|
||||||
|
|
||||||
|
- name: adding existing user to group docker '{{ ansible_user }}'
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: '{{ ansible_user }}'
|
||||||
|
groups: docker
|
||||||
|
append: true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: dependencies.yml
|
- ansible.builtin.include_tasks: dependencies.yml
|
||||||
- include_tasks: install_docker.yml
|
- ansible.builtin.include_tasks: install_docker.yml
|
||||||
- include_tasks: start_service.yml
|
- ansible.builtin.include_tasks: start_service.yml
|
||||||
- include_tasks: nginx_config.yml
|
- ansible.builtin.include_tasks: nginx_config.yml
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Copy service folder
|
- name: Copy service folder
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ services_dir }}/nginx-npm"
|
src: "{{ services_dir }}/nginx-npm"
|
||||||
dest: /services/
|
dest: /services/
|
||||||
|
|
||||||
|
@ -8,4 +8,5 @@
|
|||||||
- name: Start Docker compose
|
- name: Start Docker compose
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose:
|
||||||
project_src: "/services/{{ item }}"
|
project_src: "/services/{{ item }}"
|
||||||
|
environment: "{{ compose_env }}"
|
||||||
with_items: "{{ services }}"
|
with_items: "{{ services }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user