Skip to content

Commit f5e7347

Browse files
committed
Added caddy build with Cloudflare DNS module.
1 parent fbcdaa2 commit f5e7347

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

infra/ansible/playbooks/caddy.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
- name: Run Go playbook
2+
ansible.builtin.import_playbook: go.yaml
3+
vars:
4+
host: "{{ host }}"
5+
16
- name: Caddy Setup
27
hosts: "{{ host }}"
38

@@ -41,15 +46,42 @@
4146
vars:
4247
ansible_ssh_user: "{{ admin_user }}"
4348

44-
- name: Install Caddy
49+
- name: Download and install XCaddy GPG key
50+
shell:
51+
cmd: curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
52+
creates: /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
53+
vars:
54+
ansible_ssh_user: "{{ admin_user }}"
55+
56+
- name: Add XCaddy repository
57+
shell:
58+
cmd: curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list
59+
creates: /etc/apt/sources.list.d/caddy-xcaddy.list
60+
vars:
61+
ansible_ssh_user: "{{ admin_user }}"
62+
63+
- name: Install Caddy and XCaddy
4564
become: true
4665
apt:
4766
update_cache: yes
48-
name: caddy
67+
name:
68+
- caddy
69+
- xcaddy
4970
state: present
5071
vars:
5172
ansible_ssh_user: "{{ admin_user }}"
5273

74+
- name: Build Cloudflare DNS module for caddy
75+
shell:
76+
cmd: |
77+
xcaddy build --with github.com/caddy-dns/cloudflare
78+
sudo mv /home/{{ ansible_ssh_user }}/caddy /usr/bin/caddy
79+
chdir: /home/{{ ansible_ssh_user }}/
80+
vars:
81+
ansible_ssh_user: "{{ admin_user }}"
82+
environment:
83+
PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin"
84+
5385
- name: Enable caddy
5486
become: true
5587
systemd_service:

infra/ansible/playbooks/telemetry.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- name: Add reverse proxy configuration to Caddyfile
77
become: true
88
blockinfile:
9-
path: /etc/caddy/Caddyfile.test
9+
path: /etc/caddy/Caddyfile
1010
block: |
1111
{{ caddy_metrics_url }} {
1212
reverse_proxy localhost:{{ caddy_metrics_port }}

0 commit comments

Comments
 (0)