-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zufar Dhiyaullhaq <[email protected]>
- Loading branch information
1 parent
ff910a6
commit 49620e2
Showing
11 changed files
with
128 additions
and
1 deletion.
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
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,38 @@ | ||
# RFP Server Ansible | ||
|
||
This simple ansible to setup FRP server on the server that has public IP address and prerequisite of frp-operator on Kubernetes. | ||
|
||
### Setup Guide | ||
|
||
1. SSH to the VM and get admin access | ||
```shell | ||
sudo su | ||
``` | ||
2. clone the repository | ||
```shell | ||
git clone https://github.com/zufardhiyaulhaq/frp-operator | ||
cd frp-operator/ansible/server | ||
``` | ||
3. Adjust variables | ||
```shell | ||
vi group_vars/all.yaml | ||
``` | ||
4. Install ansible | ||
```shell | ||
sudo apt-add-repository ppa:ansible/ansible -y | ||
sudo apt update | ||
sudo apt install ansible -y | ||
``` | ||
5. disable ansible hostkey checking | ||
```shell | ||
vi ~/.ansible.cfg | ||
|
||
[defaults] | ||
host_key_checking = False | ||
``` | ||
6. Run ansible | ||
``` | ||
ansible-playbook main.yml -i hosts/hosts | ||
``` | ||
|
||
|
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,9 @@ | ||
version: 0.58.1 | ||
|
||
server_address: | ||
server_port: | ||
server_token: | ||
|
||
webserver_port: | ||
webserver_user: | ||
webserver_password: |
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,2 @@ | ||
[frps] | ||
127.0.0.1 |
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,5 @@ | ||
- name: setup FRP Server | ||
become: yes | ||
hosts: frps | ||
roles: | ||
- frps |
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,3 @@ | ||
--- | ||
- name: Reload systemd | ||
ansible.builtin.command: systemctl daemon-reload |
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,48 @@ | ||
--- | ||
- name: Download FRP tarball | ||
ansible.builtin.get_url: | ||
url: https://github.com/fatedier/frp/releases/download/v{{ version }}/frp_{{ version }}_linux_amd64.tar.gz | ||
dest: /tmp/frp_{{ version }}_linux_amd64.tar.gz | ||
mode: '0644' | ||
|
||
- name: Extract FRP tarball | ||
ansible.builtin.unarchive: | ||
src: /tmp/frp_{{ version }}_linux_amd64.tar.gz | ||
dest: /opt/ | ||
remote_src: yes | ||
creates: /opt/frp_{{ version }}_linux_amd64 | ||
|
||
- name: Copy frps to /usr/local/bin | ||
ansible.builtin.copy: | ||
src: /opt/frp_{{ version }}_linux_amd64/frps | ||
dest: /usr/local/bin/frps | ||
mode: '0755' | ||
remote_src: yes | ||
|
||
- name: Ensure frp server directory exists | ||
ansible.builtin.file: | ||
path: /etc/frp | ||
state: directory | ||
|
||
- name: Setup FRP server config for frps | ||
ansible.builtin.template: | ||
src: frps.toml.j2 | ||
dest: /etc/frp/frps.toml | ||
notify: Reload systemd | ||
|
||
- name: Ensure systemd service directory exists | ||
ansible.builtin.file: | ||
path: /etc/systemd/system | ||
state: directory | ||
|
||
- name: Setup FRP systemd service for frps | ||
ansible.builtin.template: | ||
src: frps.service.j2 | ||
dest: /etc/systemd/system/frps.service | ||
notify: Reload systemd | ||
|
||
- name: Enable and start FRP service | ||
ansible.builtin.systemd: | ||
name: frps | ||
enabled: yes | ||
state: started |
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,10 @@ | ||
[Unit] | ||
Description=FRP Server | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/local/bin/frps -c /etc/frp/frps.toml | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,8 @@ | ||
serverAddr = "{{ server_address }}" | ||
serverPort = {{ server_port }} | ||
auth.method = "{{ server_token }}" | ||
|
||
webServer.addr = "{{ server_address }}" | ||
webServer.port = {{ webserver_port }} | ||
webServer.user = "{{ webserver_user }}" | ||
webServer.password = "{{ webserver_password }}" |
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
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