commit 7820343da6afca76b38ea926b54aaf15c16baf8c Author: br0tkasten Date: Sun Nov 14 19:07:46 2021 +0100 initial diff --git a/files/hugo.openrc b/files/hugo.openrc new file mode 100644 index 0000000..df58dd1 --- /dev/null +++ b/files/hugo.openrc @@ -0,0 +1,3 @@ +#!/sbin/openrc-run + +command=/srv/hugo/generate.sh diff --git a/files/webhook.openrc b/files/webhook.openrc new file mode 100644 index 0000000..9f1377c --- /dev/null +++ b/files/webhook.openrc @@ -0,0 +1,6 @@ +#!/sbin/openrc-run + +pidfile="/run/$RC_SVCNAME.pid" +command="/usr/bin/webhook" +command_args="-hooks /srv/hugo/hooks.json -verbose" +command_background="yes" diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..35abc37 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: webserver diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..235c1d1 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,49 @@ +--- +- name: install software + package: name={{ install_software }} state=present update_cache=yes + +- name: generate ssh key + openssh_keypair: + path: "/root/.ssh/id_rsa" + type: rsa + size: 2048 + state: present + force: no + +- name: read ssh key + command: "cat /root/.ssh/id_rsa.pub" + register: key + +- name: show ssh public key + debug: + msg: "{{ key.stdout }}" + +- name: checkout site + git: + repo: https://git.br0tkasten.de/br0tkasten/www.br0tkasten.de.git + dest: /srv/hugo + version: master + +- name: deploy hugo init script + copy: + src: hugo.openrc + dest: /etc/init.d/hugo + mode: 0755 + +- name: enable hugo service + service: + name: hugo + state: started + enabled: yes + +- name: deploy webhook init script + copy: + src: webhook.openrc + dest: /etc/init.d/webhook + mode: 0755 + +- name: start & enable webhook + service: + name: webhook + state: started + enabled: yes diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..e4f25e5 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,5 @@ +--- +install_software: + - git + - hugo + - webhook