-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudflare): create a dedicated Cloudflare Ansible playbook
- Loading branch information
Showing
3 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
# This playbook install the Cloudflare Agent (cloudflared) | ||
- hosts: server | ||
become: true | ||
|
||
tasks: | ||
- name: Download Cloudflare Agent (deb) | ||
get_url: | ||
url: "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64.deb" | ||
dest: "/tmp/cloudflared-linux-arm64.deb" | ||
|
||
- name: Install Cloudflare Agent | ||
apt: | ||
deb: "/tmp/cloudflared-linux-arm64.deb" | ||
|
||
- name: Create the Cloudflare Agent config folder | ||
ansible.builtin.file: | ||
path: "/etc/cloudflared" | ||
state: directory | ||
|
||
- name: Create the Cloudflare Agent cert file | ||
ansible.builtin.copy: | ||
dest: "/etc/cloudflared/cert.json" | ||
content: | | ||
{ | ||
"AccountTag" : "{{cf_account_id}}", | ||
"TunnelID" : "{{cf_tunnel_id}}", | ||
"TunnelName" : "{{cf_tunnel_name}}", | ||
"TunnelSecret" : "{{cf_tunnel_secret}}" | ||
} | ||
- name: Create the Cloudflare Agent config file | ||
ansible.builtin.copy: | ||
dest: "/etc/cloudflared/config.yml" | ||
content: | | ||
tunnel: {{cf_tunnel_id}} | ||
credentials-file: /etc/cloudflared/cert.json | ||
logfile: /var/log/cloudflared.log | ||
loglevel: info | ||
ingress: | ||
- hostname: {{cf_zone}} | ||
service: http://localhost:8080 | ||
- hostname: "*" | ||
service: hello-world | ||
- name: Increase the UDP Receive Buffer Size needed for the QUIC protocol | ||
shell: sysctl -w net.core.rmem_max=2500000 | ||
|
||
- name: Install the Cloudflare Access tunnel | ||
shell: "cloudflared service install" | ||
|
||
- name: Enable the Cloudflare Agent service | ||
ansible.builtin.systemd: | ||
name: "cloudflared" | ||
state: started | ||
enabled: yes | ||
masked: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
BASEDIR=$(dirname $0) | ||
|
||
# Install Cloudflare Agent & configure Cloudflare Access Tunnel | ||
ansible-playbook -i $BASEDIR/../../hosts.yml $BASEDIR/playbook.yml |
This file was deleted.
Oops, something went wrong.