2 Commits

Author SHA1 Message Date
150efee902 testing 2022-10-22 22:57:14 -04:00
4b90ca5262 testing 2022-10-22 22:56:35 -04:00
9 changed files with 113 additions and 34 deletions

10
.gitignore vendored
View File

@@ -1,3 +1,13 @@
.vagrant .vagrant
.playbook .playbook
/*.yml
/*.yaml
!backup.yml
!moxie.yml
!docker.yml
!dockerbox.yml
!hypervisor.yml
!minecraft.yml
!proxy.yml
!unifi.yml
/environments/ /environments/

View File

@@ -1,39 +1,25 @@
# Homelab # Project Moxie
This repository contains Ansible to automate Debian GNU/Linux servers, deploying
server technologies that are either useful in a personal capacity or provide
educational value on automating enterprise infrastructure.
Development is accomplished using Vagrant to allow easy reproducibility in an Project Moxie is a personal IT homelab project written in Ansible and executed by Jenkins. It is a growing collection of infrastructure as code (IaC) I write out of curiosity and for reference purposes, keeping a handful of beneficial projects managed and secured.
isolated virtual environment that be ran on your local machine.
## Quick Start ## Quick Start
These steps assume a basic understanding of GNU/Linux, Hypervisors, Vagrant, and Ansible.
To configure a local virtual machine for testing, follow these simple steps.
### Prerequisites ### Prerequisites
- [Vagrant](https://developer.hashicorp.com/vagrant/docs/installation)
- [Supported hypervisor](https://developer.hashicorp.com/vagrant/docs/providers) Vagrant and VirtualBox are used to develop Project Moxie. You will need to install these before continuing.
- Ansible
### Installation ### Installation
1. Clone this repository 1. Clone this repository
``` ```
git clone https://git.krislamo.org/kris/homelab git clone https://github.com/krislamo/moxie
```
OR download from the mirror on GitHub:
```
git clone https://github.com/krislamo/homelab
``` ```
2. Set the `PLAYBOOK` environmental variable to a development playbook name in the `dev/` directory
2. Find available playbooks for development The following `PLAYBOOK` names are available: `dockerbox`, `hypervisor`, `minecraft`, `bitwarden`, `nextcloud`, `nginx`
```
cd homelab
```
```
find dev -maxdepth 1 -name "*.yml" -exec basename {} .yml \;
```
3. Set the `PLAYBOOK` environmental variable to a value listed in the last step, e.g.,
``` ```
export PLAYBOOK=dockerbox export PLAYBOOK=dockerbox
``` ```
@@ -43,10 +29,11 @@ These steps assume a basic understanding of GNU/Linux, Hypervisors, Vagrant, and
``` ```
#### Copyright and License #### Copyright and License
Copyright (C) 2020-2022 Kris Lamoureux Copyright (C) 2020-2021 Kris Lamoureux
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

View File

@@ -5,8 +5,9 @@
- host_vars/proxy.yml - host_vars/proxy.yml
roles: roles:
- base - base
- mariadb # - mariadb
- proxy - proxy
- docker # - docker
- gitea # - gitea
- bitwarden # - bitwarden
- kutt

3
roles/.gitignore vendored
View File

@@ -1,11 +1,14 @@
# Sort roles: tail -n +6 roles/.gitignore | sort
/* /*
!.gitignore !.gitignore
!requirements.yml !requirements.yml
# roles
!base*/ !base*/
!bitwarden*/ !bitwarden*/
!docker*/ !docker*/
!gitea*/ !gitea*/
!jenkins*/ !jenkins*/
!kutt*/
!libvirt*/ !libvirt*/
!mariadb*/ !mariadb*/
!minecraft*/ !minecraft*/

View File

@@ -0,0 +1,15 @@
# container settings
kutt_name: kutt
kutt_webport: 3030
kutt_web: "127.0.0.1:{{ kutt_webport }}"
# database settings
kutt_dbname: "{{ kutt_name }}"
kutt_dbuser: "{{ kutt_name }}"
kutt_postgres_volume: postgres_data
# redis
kutt_redis_volume: redis_data
# host
kutt_root: "{{ docker_compose_root }}/{{ kutt_name }}"

22
roles/kutt/tasks/main.yml Normal file
View File

@@ -0,0 +1,22 @@
- name: Create Kutt directory
file:
path: "{{ kutt_root }}"
state: directory
- name: Install Kutt's docker-compose file
template:
src: docker-compose.yml.j2
dest: "{{ kutt_root }}/docker-compose.yml"
notify: restart_kutt
- name: Install Kutt's docker-compose variables
template:
src: compose-env.j2
dest: "{{ kutt_root }}/.env"
notify: restart_kutt
- name: Start and enable Gitea service
service:
name: "{{ docker_compose_service }}@{{ kutt_name }}"
state: started
enabled: true

View File

@@ -0,0 +1,11 @@
# {{ ansible_managed }}
kutt_version={{ kutt_version }}
kutt_name={{ kutt_name }}
kutt_web={{ kutt_web }}
kutt_dbname={{ kutt_dbname }}
kutt_dbuser={{ kutt_dbuser }}
kutt_dbpass={{ kutt_dbpass }}
kutt_redis_version={{ kutt_redis_version }}
kutt_postgres_version={{ kutt_postgres_version }}
kutt_postgres_volume={{ kutt_postgres_volume }}

View File

@@ -0,0 +1,36 @@
version: "3.7"
services:
kutt:
image: kutt/kutt:${kutt_version}
container_name: ${kutt_name}
depends_on:
- postgres
- redis
command: ["./wait-for-it.sh", "postgres:5432", "--", "npm", "start"]
ports:
- ${kutt_web}:3000
environment:
DB_HOST: postgres
DB_NAME: ${kutt_dbname}
DB_USER: ${kutt_dbuser}
DB_PASSWORD: ${kutt_dbpass}
REDIS_HOST: redis
redis:
image: redis:${kutt_redis_version}
volumes:
- {{ kutt_redis_volume }}:/data
postgres:
image: postgres:${kutt_postgres_version}
environment:
POSTGRES_USER: ${kutt_dbuser}
POSTGRES_PASSWORD: ${kutt_dbpass}
POSTGRES_DB: ${kutt_dbname}
volumes:
- {{ kutt_postgres_volume }}:/var/lib/postgresql/data
volumes:
{{ kutt_redis_volume }}:
{{ kutt_postgres_volume }}:

View File

@@ -46,12 +46,6 @@ server {
proxy_pass {{ item.proxy_pass }}; proxy_pass {{ item.proxy_pass }};
{% if item.proxy_ssl_verify is defined and item.proxy_ssl_verify is false %} {% if item.proxy_ssl_verify is defined and item.proxy_ssl_verify is false %}
proxy_ssl_verify off; proxy_ssl_verify off;
{% endif %}
{% if item.websockets is defined and item.websockets %}
proxy_http_version 1.1;
proxy_set_header Connection $http_connection;
proxy_set_header Origin http://$host;
proxy_set_header Upgrade $http_upgrade;
{% endif %} {% endif %}
} }
} }