mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 14:50:55 +01:00
add ansible playbook
This commit is contained in:
parent
e9cb34a467
commit
5cc1f38488
@ -1,3 +1,5 @@
|
||||
import AnsibleRepoSetup from './install/_ansible_repo_setup.yaml'
|
||||
import ConcatenateYamlSnippets from '@site/src/components/cat-yaml.jsx'
|
||||
|
||||
## Goal
|
||||
|
||||
@ -19,14 +21,14 @@ When the service starts it will:
|
||||
|
||||
## Installation
|
||||
|
||||
1. Set up `zrok`'s Linux package repository by following [the Linux install guide](/guides/install/linux.mdx#install-zrok-from-the-repository). This will complete the installation in one step if you prefer that convenience.
|
||||
1. Set up `zrok`'s Linux package repository by following [the Linux install guide](/guides/install/linux.mdx#install-zrok-from-the-repository), or run this one-liner to complete the repo setup and install packages.
|
||||
|
||||
```bash
|
||||
curl -sSLf https://get.openziti.io/install.bash \
|
||||
| sudo bash -s zrok-share
|
||||
```
|
||||
|
||||
1. If you set up the repository by following the guide, then also install the `zrok-share` package. This provides the systemd service.
|
||||
1. If you set up the repository by following the guide, then also install the `zrok-share` package. This package provides the systemd service.
|
||||
|
||||
```bash title="Ubuntu, Debian"
|
||||
sudo sudo apt install zrok-share
|
||||
@ -36,6 +38,49 @@ When the service starts it will:
|
||||
sudo dnf install zrok-share
|
||||
```
|
||||
|
||||
<Details>
|
||||
<summary>Ansible Playbook</summary>
|
||||
|
||||
<ConcatenateYamlSnippets
|
||||
title="Set up package repository and install zrok-share"
|
||||
>
|
||||
{AnsibleRepoSetup}
|
||||
{`
|
||||
- name: Install zrok-share package
|
||||
gather_facts: false
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Install zrok-share
|
||||
ansible.builtin.package:
|
||||
name: zrok-share
|
||||
state: present
|
||||
|
||||
- name: Copy env config from Ansible controller to target
|
||||
copy:
|
||||
dest: /opt/openziti/etc/zrok/zrok-share.env
|
||||
src: /opt/openziti/etc/zrok/zrok-share.env
|
||||
|
||||
- name: Enable and restart service
|
||||
systemd:
|
||||
name: zrok-share
|
||||
enabled: yes
|
||||
state: restarted
|
||||
daemon_reload: yes
|
||||
|
||||
- name: Wait for service
|
||||
systemd:
|
||||
name: zrok-share
|
||||
state: started
|
||||
register: service_status
|
||||
until: service_status.status.ActiveState == 'active'
|
||||
retries: 30
|
||||
delay: 1
|
||||
`}
|
||||
</ConcatenateYamlSnippets>
|
||||
|
||||
</Details>
|
||||
|
||||
## Enable
|
||||
|
||||
Save the enable token from the zrok console in the configuration file.
|
||||
@ -59,6 +104,12 @@ ZROK_TARGET="http://127.0.0.1:3000"
|
||||
ZROK_BACKEND_MODE="proxy"
|
||||
```
|
||||
|
||||
If your HTTPS server has an unverifiable TLS server certificate then you must set `--insecure`.
|
||||
|
||||
```bash title="/opt/openziti/etc/zrok/zrok-share.env"
|
||||
ZROK_INSECURE="--insecure"
|
||||
```
|
||||
|
||||
### Serve Static Files
|
||||
|
||||
Run zrok's embedded web server to serve the files in a directory. If there's an `index.html` file in the directory then visitors will see that web page in their browser, otherwise they'll see a generated index of the files. The directory must be readable by 'other', e.g. `chmod -R o+rX /var/www/html`.
|
||||
|
55
docs/guides/install/_ansible_repo_setup.yaml
Normal file
55
docs/guides/install/_ansible_repo_setup.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
- name: Set up zrok Package Repo
|
||||
gather_facts: true
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Set up apt repo
|
||||
when: ansible_os_family == "Debian"
|
||||
block:
|
||||
- name: Install playbook dependencies
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- gnupg
|
||||
state: present
|
||||
|
||||
- name: Fetch armored pubkey
|
||||
ansible.builtin.uri:
|
||||
url: https://get.openziti.io/tun/package-repos.gpg
|
||||
return_content: yes
|
||||
register: armored_pubkey
|
||||
|
||||
- name: Dearmor pubkey
|
||||
ansible.builtin.shell: |
|
||||
gpg --dearmor --output /usr/share/keyrings/openziti.gpg <<< "{{ armored_pubkey.content }}"
|
||||
args:
|
||||
creates: /usr/share/keyrings/openziti.gpg
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Set pubkey filemode
|
||||
ansible.builtin.file:
|
||||
path: /usr/share/keyrings/openziti.gpg
|
||||
mode: 'a+rX'
|
||||
|
||||
- name: Install OpenZiti repo deb source
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/apt/sources.list.d/openziti-release.list
|
||||
content: |
|
||||
deb [signed-by=/usr/share/keyrings/openziti.gpg] https://packages.openziti.org/zitipax-openziti-deb-stable debian main
|
||||
|
||||
- name: Refresh Repo Sources
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Set up yum repo
|
||||
when: ansible_os_family == "RedHat"
|
||||
block:
|
||||
- name: Install OpenZiti repo rpm source
|
||||
ansible.builtin.yum_repository:
|
||||
name: OpenZitiRelease
|
||||
description: OpenZiti Release
|
||||
baseurl: https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch
|
||||
enabled: yes
|
||||
gpgkey: https://packages.openziti.org/zitipax-openziti-rpm-stable/redhat/$basearch/repodata/repomd.xml.key
|
||||
repo_gpgcheck: yes
|
||||
gpgcheck: no
|
@ -6,6 +6,8 @@ sidebar_label: Linux
|
||||
import { AssetsProvider } from '@site/src/components/assets-context';
|
||||
import DownloadCard from '@site/src/components/download-card';
|
||||
import styles from '@site/src/css/download-card.module.css';
|
||||
import AnsibleRepoSetup from './_ansible_repo_setup.yaml'
|
||||
import ConcatenateYamlSnippets from '@site/src/components/cat-yaml.jsx'
|
||||
|
||||
## Linux Binary
|
||||
|
||||
@ -60,7 +62,7 @@ Download the binary distribution for your Linux distribution's architecture or r
|
||||
</Details>
|
||||
|
||||
<Details>
|
||||
<summary>Auto install binary in `/usr/local/bin/zrok`</summary>
|
||||
<summary>Script to install binary in `/usr/local/bin/zrok`</summary>
|
||||
|
||||
This script auto-selects the correct architecture, and may be helpful for Raspberry Pi users.
|
||||
|
||||
@ -149,7 +151,7 @@ zrok version;
|
||||
</Details>
|
||||
|
||||
<Details>
|
||||
<summary>Auto set up DEB or RPM repository</summary>
|
||||
<summary>Script to set up DEB or RPM repository</summary>
|
||||
|
||||
1. Download the zrok install script.
|
||||
|
||||
@ -170,3 +172,24 @@ zrok version;
|
||||
```
|
||||
|
||||
</Details>
|
||||
|
||||
<Details>
|
||||
<summary>Ansible Playbook</summary>
|
||||
|
||||
<ConcatenateYamlSnippets
|
||||
title="Set up package repository and install zrok">
|
||||
{AnsibleRepoSetup}
|
||||
{`
|
||||
- name: Install zrok package
|
||||
gather_facts: false
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Install zrok
|
||||
ansible.builtin.package:
|
||||
name: zrok
|
||||
state: present
|
||||
`}
|
||||
</ConcatenateYamlSnippets>
|
||||
|
||||
</Details>
|
||||
|
@ -44,7 +44,24 @@ const config = {
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
function myPlugin(context, options) {
|
||||
return {
|
||||
name: 'custom-webpack-plugin',
|
||||
configureWebpack(config, isServer, utils) {
|
||||
return {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.yaml$/,
|
||||
use: 'yaml-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
},
|
||||
],
|
||||
|
||||
presets: [
|
||||
|
32
website/package-lock.json
generated
32
website/package-lock.json
generated
@ -20,7 +20,8 @@
|
||||
"remark-math": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.0.0"
|
||||
"@docusaurus/module-type-aliases": "^3.0.0",
|
||||
"yaml-loader": "^0.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.14"
|
||||
@ -7988,6 +7989,12 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/javascript-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jest-util": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
|
||||
@ -15327,6 +15334,29 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml-loader": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/yaml-loader/-/yaml-loader-0.8.0.tgz",
|
||||
"integrity": "sha512-LjeKnTzVBKWiQBeE2L9ssl6WprqaUIxCSNs5tle8PaDydgu3wVFXTbMfsvF2MSErpy9TDVa092n4q6adYwJaWg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"javascript-stringify": "^2.0.1",
|
||||
"loader-utils": "^2.0.0",
|
||||
"yaml": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.13"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml-loader/node_modules/yaml": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||
"integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz",
|
||||
|
@ -26,7 +26,8 @@
|
||||
"remark-math": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.0.0"
|
||||
"@docusaurus/module-type-aliases": "^3.0.0",
|
||||
"yaml-loader": "^0.8.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
31
website/src/components/cat-yaml.jsx
Normal file
31
website/src/components/cat-yaml.jsx
Normal file
@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import yaml from 'js-yaml';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
|
||||
const ConcatenateYamlSnippets = ({ title, children }) => {
|
||||
|
||||
// Convert each YAML object to a string and concatenate
|
||||
const concatenatedYaml = children.map(child => {
|
||||
// Check if the child is a string or an object
|
||||
if (typeof child === 'string') {
|
||||
// If it's a string, use it as is
|
||||
return child.trim();
|
||||
} else {
|
||||
// If it's an object, convert it to a YAML string
|
||||
return yaml.dump(child).trim();
|
||||
}
|
||||
}).join('\n\n');
|
||||
|
||||
return (
|
||||
<div>
|
||||
<CodeBlock
|
||||
language="yaml"
|
||||
title={title}
|
||||
>
|
||||
{concatenatedYaml}
|
||||
</CodeBlock>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConcatenateYamlSnippets;
|
Loading…
Reference in New Issue
Block a user