Procházet zdrojové kódy

move compose in, outline for ansible

Josh Bicking před 4 roky
rodič
revize
816956d0ef

+ 2 - 0
.gitignore

@@ -1,2 +1,4 @@
 htpasswd
 .env
+playbook.retry
+keys/

+ 9 - 3
README.md

@@ -1,8 +1,10 @@
-# docker-compose-server
+# Ansible & Docker homelab configurations
 
-A docker-compose config for my personal server.
+Set up a series of machines for web hosting & data storage.
 
-## Using these files
+# Using these files
+
+## Docker
 
 The easiest way to use these files is to copy the config of a service you want into your own `docker-compose.yaml` file. You'll need to change my domain names to your own.
 
@@ -14,3 +16,7 @@ For example, if your compose file uses the `CONTAINERS_DIR` and `POSTGRES_PASSWO
 CONTAINERS_DIR=/home/user/my-container-data
 POSTGRES_PASSWORD=mysecretpassword
 ```
+
+## Ansible
+
+The hostnames & keys may be changed to set up a generic web & storage instance, ready to run docker-compose/host a NAS.

+ 26 - 0
ansible.cfg

@@ -0,0 +1,26 @@
+# config file for ansible -- https://ansible.com/
+# ===============================================
+
+[defaults]
+
+[inventory]
+
+[privilege_escalation]
+
+[paramiko_connection]
+
+[ssh_connection]
+
+[persistent_connection]
+
+[accelerate]
+
+[selinux]
+
+[colors]
+
+[diff]
+# Always print diff when running ( same as always running with -D/--diff )
+always = yes
+# Set how many context lines to show in diff
+context = 5

+ 5 - 0
hosts

@@ -0,0 +1,5 @@
+[web]
+web-internal ansible_ssh_private_key_file=~/.ssh/internal_ed25519
+
+[nas]
+nas-internal ansible_ssh_private_key_file=~/.ssh/internal_ed25519

+ 13 - 0
playbook.yml

@@ -0,0 +1,13 @@
+---
+- hosts: all
+  roles:
+    - basic
+
+- hosts: web
+  roles:
+    - web
+
+- hosts: nas
+  roles:
+    - nas
+

+ 8 - 0
roles/basic/tasks/main.yml

@@ -0,0 +1,8 @@
+---
+- name: Remove localhost hostname definition
+  lineinfile:
+    path: /etc/hosts
+    # hostnamectl doesn't update the hostname in this entry, so we can't 
+    # match against {{ ansible_facts['nodename'] }}.
+    regexp: "^127\\.0\\.1\\.1[ \\t]+"
+    state: absent

+ 0 - 0
conf.d/forward.conf → templates/web/compose/conf.d/forward.conf


+ 0 - 0
conf.d/proxy_timeout.conf → templates/web/compose/conf.d/proxy_timeout.conf


+ 0 - 0
conf.d/real_ip.conf → templates/web/compose/conf.d/real_ip.conf


+ 0 - 0
conf.d/static.conf → templates/web/compose/conf.d/static.conf


+ 0 - 0
docker-compose.yaml → templates/web/compose/docker-compose.yaml