1
0
Fork 0

Compare commits

...

10 commits

Author SHA1 Message Date
b6a8bb2ab8
ci: add alfheim.vxm.cz to known hosts
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-15 15:05:49 +02:00
d0ad9e6c7a
fix(playbook): /etc/caddy chmod 0755, /usr/bin/caddy chmod 0755 owner root group root
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-15 14:58:08 +02:00
21bb91be7d
fix(playbook): add missing owner and group to files and copy
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-15 14:25:41 +02:00
dfdcf551fc
fix(playbook): ansible-lint issues
- prefix functions with ansible.builtin
- missing mode for file and copy functions
- boolean values use true|false values and no other (yes,no,...)

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-15 14:14:46 +02:00
3ff9c88db7
feat(inventory): add alfheim server
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-15 14:12:38 +02:00
2d1f9cd955
feat: update caddy to v2.10.0
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-14 21:47:07 +02:00
cdbd1e6dcc
ci: use depdendency proxy for pipeline base images
- ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX} for golang and ansible

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-05-14 21:45:40 +02:00
b6d419db88
ci: specify caddy version 2025-03-02 23:53:02 +01:00
1619192748
fix(playbook.yml): location of caddy binary for original systemd unit file 2025-01-01 01:08:30 +01:00
92948eb258
feat(playbook.yml): create /etc/caddy, Caddyfile and .env file 2025-01-01 00:58:34 +01:00
3 changed files with 44 additions and 12 deletions

View file

@ -4,13 +4,14 @@ stages:
build:
stage: build
image: golang:bookworm
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golang:bookworm
before_script:
- bash hack/install-xcaddy.sh
script:
- >
xcaddy
build
v2.10.0
--output ./caddy
--with github.com/caddy-dns/cloudflare
artifacts:
@ -19,7 +20,7 @@ build:
deploy:
stage: deploy
image: alpine/ansible:latest
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine/ansible:latest
before_script:
- "command -v ssh-agent >/dev/null || ( apk add --no-cache openssh-client )"
- eval $(ssh-agent -s)
@ -27,5 +28,6 @@ deploy:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -H valhalla.vxm.cz >> ~/.ssh/known_hosts
- ssh-keyscan -H alfheim.vxm.cz >> ~/.ssh/known_hosts
script:
- ansible-playbook -i inventory.ini playbook.yml

View file

@ -1 +1,2 @@
valhalla.vxm.cz ansible_user=root
alfheim.vxm.cz ansible_user=root

View file

@ -8,28 +8,57 @@
state: present
- name: Ensure user "caddy" exists
user:
ansible.builtin.user:
name: caddy
system: yes
system: true
shell: /usr/sbin/nologin
home: /var/lib/caddy
create_home: yes
create_home: true
group: caddy
- name: Ensure directory "/etc/caddy" exists
ansible.builtin.file:
path: /etc/caddy
state: directory
mode: "0755"
owner: root
group: root
- name: Ensure file "/etc/caddy/Caddyfile" exists
ansible.builtin.file:
path: /etc/caddy/Caddyfile
state: touch
mode: "0644"
owner: caddy
group: caddy
- name: Ensure file "/etc/caddy/.env" exists"
ansible.builtin.file:
path: /etc/caddy/.env
state: touch
mode: "0600"
owner: caddy
group: caddy
- name: Copy Caddy binary
copy:
ansible.builtin.copy:
src: caddy
dest: /usr/local/bin/caddy
dest: /usr/bin/caddy
mode: "0755"
owner: root
group: root
- name: Check if systemd unit file exists
stat:
ansible.builtin.stat:
path: /etc/systemd/system/caddy.service
register: systemd_unit_file
- name: Create systemd unit file for Caddy
copy:
ansible.builtin.copy:
dest: /etc/systemd/system/caddy.service
mode: "0644"
owner: root
group: root
content: |
# caddy.service
# See: https://github.com/caddyserver/dist/blob/master/init/caddy.service
@ -56,12 +85,12 @@
when: not systemd_unit_file.stat.exists
- name: Enable and start Caddy service
systemd:
ansible.builtin.systemd:
name: caddy
enabled: yes
enabled: true
state: started
- name: Restart Caddy service
systemd:
ansible.builtin.systemd:
name: caddy
state: reloaded