浏览代码

Add caddy role

Colin Powell 4 年之前
父节点
当前提交
874d4dfe37
共有 5 个文件被更改,包括 154 次插入1 次删除
  1. 16 1
      ansible/hosts
  2. 12 0
      ansible/playbook.yml
  3. 100 0
      ansible/roles/caddy/files/Caddyfile
  4. 3 0
      ansible/roles/caddy/handlers/main.yml
  5. 23 0
      ansible/roles/caddy/tasks/main.yml

+ 16 - 1
ansible/hosts

@@ -1,4 +1,13 @@
-[jails] 
+[physical]
+pandora.unbl.ink
+phoebe.local
+titan.local
+prometheus.local
+dione.local
+janus.local
+rhea.local
+
+[jails]
 mail.local
 git.local
 jump.local
@@ -71,3 +80,9 @@ ttrss.local
 
 [tor]
 tor.local
+
+[pbp]
+pbp.local
+
+[fifteen5]
+fifteen5.local

+ 12 - 0
ansible/playbook.yml

@@ -0,0 +1,12 @@
+---
+- hosts: proxy
+  roles:
+    - role: caddy
+
+- hosts: pbp
+  roles:
+    - role: pbp
+
+- hosts: fifteen5
+  roles:
+    - role: fifteen5

+ 100 - 0
ansible/roles/caddy/files/Caddyfile

@@ -0,0 +1,100 @@
+jump.unbl.ink {
+	root /var/www
+}
+search.unbl.ink {
+	proxy / search.local:4004 {
+		transparent
+	}
+}
+git.unbl.ink {
+	proxy / git.local:3000 {
+		transparent
+	}
+}
+five.unbl.ink {
+	proxy / fifteen5.local:8000 {
+		transparent
+		websocket
+	}
+}
+five.five.unbl.ink {
+	proxy / fifteen5.local:8000 {
+		transparent
+		websocket
+	}
+}
+admin.five.unbl.ink {
+	proxy / fifteen5.local:8000 {
+		transparent
+		websocket
+	}
+}
+my.five.unbl.ink {
+	proxy / fifteen5.local:8000 {
+		transparent
+		websocket
+	}
+}
+saml-okta.five.unbl.ink {
+	proxy / fifteen5.local:8000 {
+		transparent
+		websocket
+	}
+}
+play.unbl.ink {
+	proxy / mopidy.local:6680 {
+		transparent
+		websocket
+	}
+}
+stream.unbl.ink {
+	proxy / mopidy.local:8000 {
+		transparent
+	}
+}
+
+matrix.unbl.ink:8448 {
+	proxy / matrix.local:8008 {
+		transparent
+	}
+}
+matrix.unbl.ink {
+	proxy /_matrix matrix.local:8008 {
+		transparent
+	}
+}
+chat.unbl.ink {
+	proxy / matrix.local {
+		transparent
+		websocket
+	}
+}
+media.unbl.ink {
+	proxy / iapetus.local:8096 {
+		transparent
+		websocket
+	}
+}
+reader.unbl.ink {
+	proxy / ttrss.local {
+		transparent
+		websocket
+	}
+}
+logs.unbl.ink {
+	proxy / logging.local:5601 {
+		transparent
+		websocket
+	}
+}
+pbp.unbl.ink {
+	proxy / pbp.local {
+		transparent
+	}
+}
+data.unbl.ink {
+	proxy / rhea.local:19999 {
+		transparent
+		websocket
+	}
+}

+ 3 - 0
ansible/roles/caddy/handlers/main.yml

@@ -0,0 +1,3 @@
+---
+- name: Caddy restarted
+  command: service caddy restart

+ 23 - 0
ansible/roles/caddy/tasks/main.yml

@@ -0,0 +1,23 @@
+---
+- name: Package cache updated
+  shell: pkg update -f
+  become: true
+
+- name: Caddy package installed
+  pkgng:
+    name: "caddy"
+    state: present
+  become: true
+
+- name: Caddy enabled
+  shell: sysrc caddy_enable="YES"
+  become: true
+
+- name: Caddyfile installed
+  copy:
+    src: Caddyfile
+    dest: /usr/local/www/Caddyfile
+    owner: root
+    mode: 0644
+  notify: Caddy restarted
+  become: true