Commit 4ad8c69a authored by nanahira's avatar nanahira

pter

parent 96c78515
---
- hosts: pter
remote_user: root
vars:
pter_release: v0.6.12
roles:
- name: nodejs
vars:
nodejs_version: 10
tasks:
- name: apt
apt:
update_cache: true
state: latest
name: curl,wget,build-essential,tar,unzip,python,rsync
when: ansible_os_family == 'Debian'
- name: yum
yum:
state: latest
update_cache: true
name: curl,wget,gcc,gcc-c++,make,tar,unzip,python,rsync
when: ansible_os_family == 'RedHat'
- name: directories
file:
path: '/srv/{{item}}'
state: directory
with_items:
- daemon
- daemon-data
- name: download daemon
unarchive:
src: 'https://github.com/pterodactyl/daemon/releases/download/{{pter_release}}/daemon.tar.gz'
dest: /srv/daemon
creates: /srv/daemon/src
remote_src: true
extra_opts:
- --strip-components=1
notify: launch
- name: npm install
npm:
path: /srv/daemon
ci: true
production: true
- name: core.json
template:
src: files/pter/pter.json.j2
dest: /srv/daemon/config/core.json
notify: launch
- name: certs
synchronize:
src: '{{ cert_path }}/'
dest: /srv/certs
delete: yes
copy_links: yes
verify_host: no
recursive: yes
checksum: yes
archive: no
notify: launch
handlers:
- name: launch
shell: 'pm2 start src/index.js --name daemon && pm2 save && pm2 startup'
args:
chdir: /srv/daemon
ignore_errors: true
--- ---
- hosts: pter - hosts: pter
remote_user: root remote_user: root
vars:
pter_release: v0.6.12
roles:
- name: nodejs
vars:
nodejs_version: 10
tasks: tasks:
- name: apt - name: set template
apt: set_fact:
update_cache: true config_content:
state: latest debug: false
name: curl,wget,build-essential,tar,unzip,python,rsync uuid: '{{uuid}}'
when: ansible_os_family == 'Debian' token_id: '{{token_id}}'
- name: yum token: '{{token}}'
yum: api:
state: latest host: 0.0.0.0
update_cache: true port: '{{https_port}}'
name: curl,wget,gcc,gcc-c++,make,tar,unzip,python,rsync ssl:
when: ansible_os_family == 'RedHat' enabled: true
- name: directories cert: '/certs/fullchain.pem'
key: '/certs/privkey.pem'
upload_limit: 100
system:
data: '{{data_path}}'
sftp:
bind_port: '{{sftp_port}}'
allowed_mounts: []
remote: '{{remote}}'
docker_compose_content:
version: '2.4'
services:
pterodactyl:
restart: always
image: ccarney16/pterodactyl-daemon:v1.6.1
network_mode: host
environment:
TZ: Asia/Shanghai
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./certs:/certs:ro
- ./config.yml:/etc/pterodactyl/config.yml
- '{{data_path}}:{{data_path}}'
- name: directory
file: file:
path: '/srv/{{item}}' path: '{{ansible_user_dir}}/pterodactyl/certs'
state: directory state: directory
recurse: true
- name: config file
copy:
content: '{{config_content | to_yaml}}'
dest: '{{ansible_user_dir}}/pterodactyl/config.yml'
notify: restart_pterodactyl
- name: docker-compose.yml
copy:
content: '{{docker_compose_content | to_yaml}}'
dest: '{{ansible_user_dir}}/pterodactyl/docker-compose.yml'
- name: cert file
copy:
src: '../certs/{{cert_domain}}/{{item}}.pem'
dest: '{{ansible_user_dir}}/pterodactyl/certs/{{item}}.pem'
mode: '0644'
with_items: with_items:
- daemon - fullchain
- daemon-data - privkey
- name: download daemon notify: restart_pterodactyl
unarchive: - name: docker-compose up -d
src: 'https://github.com/pterodactyl/daemon/releases/download/{{pter_release}}/daemon.tar.gz' docker_compose:
dest: /srv/daemon project_src: '{{ansible_user_dir}}/pterodactyl'
creates: /srv/daemon/src remove_orphans: true
remote_src: true pull: true
extra_opts:
- --strip-components=1
notify: launch
- name: npm install
npm:
path: /srv/daemon
ci: true
production: true
- name: core.json
template:
src: files/pter/pter.json.j2
dest: /srv/daemon/config/core.json
notify: launch
- name: certs
synchronize:
src: '{{ cert_path }}/'
dest: /srv/certs
delete: yes
copy_links: yes
verify_host: no
recursive: yes
checksum: yes
archive: no
notify: launch
handlers: handlers:
- name: launch - name: restart_pterodactyl
shell: 'pm2 start src/index.js --name daemon && pm2 save && pm2 startup' include_tasks: 'handlers/docker.yaml'
args: vars:
chdir: /srv/daemon handler:
ignore_errors: true type: docker
path: '{{ansible_user_dir}}/pterodactyl'
services:
- pterodactyl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment