Skip to content

Commit

Permalink
feat(pterodactyl_wings): use new config layout (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhoesel authored Dec 5, 2021
1 parent 80f3d9d commit 71b8e5a
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 63 deletions.
79 changes: 58 additions & 21 deletions roles/pterodactyl_wings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This role follows the official installation instructions on the pterodactyl [doc
- Directory in which the config file is stored
- Default: `/etc/pterodactyl`

### Docker

##### `pterodactyl_wings_docker_install`
- Whether to handle the docker installation.
- Set to `false` if you already have a docker install running and don't want this role to touch anything
Expand All @@ -40,35 +42,70 @@ This role follows the official installation instructions on the pterodactyl [doc

### Wings Configuration

Prefix for all variables: `pterodactyl_wings_`

| Name | Description | Required | Default |
|------|-------------|:--------:|---------|
| `remote` | Full URL of the panel instance (including http(s):// and port) | | `"https://127.0.0.1:443"` |
| `uuid` | UUID assigned to the node by the panel | X | not set |
| `token_id` | ID of the token assigned to the node by the panel | X | not set |
| `token` | Token assigned to the node by the panel | X | not set |
| `port` | Port on which the daemon will listen for requests | | 8080 |
| `ssl_cert` | SSL certificate file for the daemon. Must already be present | | `"/etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem"` |
| `ssl_key` | SSL key file for the daemon. Must already be present | | `"/etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem"` |
| `data_dir` | Directory under which the servers will be stored | | `/var/lib/pterodactyl/volumes`
| `upload_limit` | Maximum file upload size in MB | | 100 |
| `sftp_port` | Port on which the SFTP server will listen on | | 2022 |
| `allowed_mounts` | Allowed mounts on this node as configured in the panel | | `[]` |
The `pterodactyl_wings_config` is a dictionary representing the configuration file of the wings daemon. This configuration
will be merged with any existing configuration already present on the node.

## Example Playbooks
To get started, you can adjust the configuration below. To get a more complete configuration file, use the panel to generate one
or read it from an existing wings daemon.

**NOTE**: You must provide your own uuid, token_id and token values. These can be viewed in the node settings in the panel.

**NOTE**: The TLS certificate for the wings daemon must be present at the supplied path (defaults to Let's Encrypt).

Default configuration:

```yaml
pterodactyl_wings_config:
debug: false
# Secrets generated by the panel for the wings client
uuid: #your-uuid-here
token_id: #your-token-id-here
token: #your-token-here
api:
host: 0.0.0.0 # Address to bind the wings daemon to
port: 8080 # Port to bind the wings daemon to
# SSL Settings, including certificate path and key. Defaults to the path used by certbot/Let's Encrypt
ssl:
enabled: true
cert: "/etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem"
key: "/etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem"
upload_limit: 100 # File browser upload limit in MB
remote: https://127.0.0.1:443 # The address of the Panel
system:
data: /var/lib/pterodactyl/volumes # Path under which to save server data
sftp:
bind_port: 2022 # Port on which sftp should listen on
allowed_mounts: []
# add additional configuration options here, if required
```

## Example Playbooks

```yaml
# Performs a basic wings installation
# such as ansible-vault or via vars-prompt
- hosts: all
roles:
- role: maxhoesel.pterodactyl.pterodactyl_wings
become: yes
vars:
pterodactyl_wings_remote: https://mypanel.example.com:443
# Get these values from your panel
pterodactyl_wings_uuid: 12544f88-cfbf-40b6-9432-a2bc14312112
pterodactyl_wings_token_id: m9TVwtaw6FQQZt8H
pterodactyl_wings_token: dPigfaWa4I4xcY3o5sM3Hi3ST3duxHqCqu30fc3eO44lPj7msGY6R14YKCR6QZJ2
pterodactyl_wings_config:
debug: false
uuid: 12544f88-cfbf-40b6-9432-a2bc14312112
token_id: m9TVwtaw6FQQZt8H
token: dPigfaWa4I4xcY3o5sM3Hi3ST3duxHqCqu30fc3eO44lPj7msGY6R14YKCR6QZJ2
api:
host: 0.0.0.0
port: 8080
ssl:
enabled: true
cert: "/etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem"
key: "/etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem"
upload_limit: 100
remote: https://mypanel.example.com:443
system:
data: /var/lib/pterodactyl/volumes
sftp:
bind_port: 2022
allowed_mounts: []
```
35 changes: 21 additions & 14 deletions roles/pterodactyl_wings/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@ pterodactyl_wings_version: latest

pterodactyl_wings_config_dir: /etc/pterodactyl

pterodactyl_wings_remote: "https://127.0.0.1:443"
#pterodactyl_wings_uuid:
#pterodactyl_wings_token_id:
#pterodactyl_wings_token:

pterodactyl_wings_port: 8080
pterodactyl_wings_ssl_cert: "/etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem"
pterodactyl_wings_ssl_key: "/etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem"

pterodactyl_wings_data_dir: /var/lib/pterodactyl/volumes
pterodactyl_wings_upload_limit: 100

pterodactyl_wings_sftp_port: 2022
pterodactyl_wings_allowed_mounts: []
pterodactyl_wings_config:
debug: false
# Secrets generated by the panel for the wings client
uuid: #your-uuid-here
token_id: #your-token-id-here
token: #your-token-here
api:
host: 0.0.0.0 # Address to bind the wings daemon to
port: 8080 # Port to bind the wings daemon to
# SSL Settings, including certificate path and key. Defaults to the path used by certbot/Let's Encrypt
ssl:
enabled: true
cert: "/etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem"
key: "/etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem"
upload_limit: 100 # File browser upload limit in MB
remote: https://127.0.0.1:443 # The address of the Panel
system:
data: /var/lib/pterodactyl/volumes # Path under which to save server data
sftp:
bind_port: 2022 # Port on which sftp should listen on
allowed_mounts: []

pterodactyl_wings_docker_install: true
pterodactyl_wings_docker_source: stable
25 changes: 19 additions & 6 deletions roles/pterodactyl_wings/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@
name: "pterodactyl_wings"
vars:
pterodactyl_wings_docker_source: stable
pterodactyl_wings_cert: /etc/ssl/private/pterodactyl.crt
pterodactyl_wings_key: /etc/ssl/private/pterodactyl.key
# Placeholder values
pterodactyl_wings_token: dPigfaWa4I4xcY3o5sM3Hi3ST3duxHqCqu30fc3eO44lPj7msGY6R14YKCR6QZJ2
pterodactyl_wings_token_id: m9TVwtaw6FQQZt8H
pterodactyl_wings_uuid: 12544f88-cfbf-40b6-9432-a2bc14312112
pterodactyl_wings_config:
debug: false
uuid: 12544f88-cfbf-40b6-9432-a2bc14312112
token_id: m9TVwtaw6FQQZt8H
token: dPigfaWa4I4xcY3o5sM3Hi3ST3duxHqCqu30fc3eO44lPj7msGY6R14YKCR6QZJ2
api:
host: 0.0.0.0
port: 8080
ssl:
enabled: true
cert: "/etc/ssl/private/pterodactyl.crt"
key: "/etc/ssl/private/pterodactyl.key"
upload_limit: 100
remote: https://mypanel.example.com:443
system:
data: /var/lib/pterodactyl/volumes
sftp:
bind_port: 2022
allowed_mounts: []
23 changes: 1 addition & 22 deletions roles/pterodactyl_wings/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,6 @@
mode: "755"
notify: restart wings

- name: Generate wings configuration
set_fact:
pterodactyl_wings_config:
debug: false
uuid: "{{ pterodactyl_wings_uuid }}"
token_id: "{{ pterodactyl_wings_token_id }}"
token: "{{ pterodactyl_wings_token }}"
api:
host: 0.0.0.0
port: "{{ pterodactyl_wings_port }}"
ssl:
enabled: true
cert: "{{ pterodactyl_wings_ssl_cert }}"
key: "{{ pterodactyl_wings_ssl_key }}"
upload_limit: "{{ pterodactyl_wings_upload_limit }}"
system:
data: "{{ pterodactyl_wings_data_dir }}"
sftp:
bind_port: "{{ pterodactyl_wings_sftp_port }}"
allowed_mounts: "{{ pterodactyl_wings_allowed_mounts }}"
remote: "{{ pterodactyl_wings_remote }}"
- name: Look for existing config file
stat:
path: "{{ pterodactyl_wings_config_dir }}/config.yml"
Expand All @@ -64,7 +43,7 @@
check_mode: no
- name: Merge existing configuration new config
set_fact:
pterodactyl_wings_config: "{{ _pterodactyl_wings_config_current.stdout|from_yaml | combine(pterodactyl_wings_config, recursive=True, list_merge='keep') }}"
pterodactyl_wings_config: "{{ _pterodactyl_wings_config_current.stdout|from_yaml | combine(pterodactyl_wings_config, recursive=True) }}"
when: _pterodactyl_wings_config_file.stat.exists

- name: Wings config file is installed
Expand Down

0 comments on commit 71b8e5a

Please sign in to comment.