diff --git a/ansible/main.yml b/ansible/main.yml index cdc8ace..4081073 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -50,6 +50,7 @@ - heimdall - gitea - duplicati + - yourls - hosts: walker roles: diff --git a/ansible/roles/yourls/files/docker-compose.yml b/ansible/roles/yourls/files/docker-compose.yml new file mode 100644 index 0000000..addbf47 --- /dev/null +++ b/ansible/roles/yourls/files/docker-compose.yml @@ -0,0 +1,32 @@ +version: "2.3" + +services: + yourls: + image: yourls:1.7.9-apache + restart: unless-stopped + depends_on: + - mariadb + environment: + - YOURLS_DB_PASS=yourls + - YOURLS_DB_USER=yourls + - YOURLS_DB_HOST=mariadb + - YOURLS_USER=jake + - YOURLS_PASS={{ yourls_password }} + - YOURLS_SITE=https://0rng.one + volumes: + - ./index.html:/var/www/html/index.html + labels: + - traefik.enable=true + - traefik.http.routers.yourls.rule=Host(`0rng.one`) + - traefik.http.routers.yourls.tls.certresolver=le + + mariadb: + image: mariadb:10.5 + environment: + - MYSQL_ROOT_PASSWORD=root + - MYSQL_DATABASE=yourls + - MYSQL_USER=yourls + - MYSQL_PASSWORD=yourls + volumes: + - ./mariadb:/var/lib/mysql + restart: unless-stopped diff --git a/ansible/roles/yourls/files/index.html b/ansible/roles/yourls/files/index.html new file mode 100644 index 0000000..8e8085b --- /dev/null +++ b/ansible/roles/yourls/files/index.html @@ -0,0 +1,8 @@ + + + + + +

Redirecting to website...

+ + diff --git a/ansible/roles/yourls/handlers/main.yml b/ansible/roles/yourls/handlers/main.yml new file mode 100644 index 0000000..37cbdfb --- /dev/null +++ b/ansible/roles/yourls/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart yourls + shell: + chdir: /opt/yourls + cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/yourls/tasks/main.yml b/ansible/roles/yourls/tasks/main.yml new file mode 100644 index 0000000..3c945d3 --- /dev/null +++ b/ansible/roles/yourls/tasks/main.yml @@ -0,0 +1,26 @@ +- name: Create install directory + file: + path: /opt/yourls + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + +- name: Install compose file + template: + src: files/docker-compose.yml + dest: /opt/yourls/docker-compose.yml + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + notify: restart yourls + become: true + +- name: Install redirect file + template: + src: files/index.html + dest: /opt/yourls/index.html + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + notify: restart yourls + become: true diff --git a/ansible/roles/yourls/vars/main.yml b/ansible/roles/yourls/vars/main.yml new file mode 100644 index 0000000..38095d4 --- /dev/null +++ b/ansible/roles/yourls/vars/main.yml @@ -0,0 +1,11 @@ +yourls_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 33643039353165363833306237306638636438623138343263666562356638333539376166363366 + 3861353462663436303638636562313236303238346235390a333438303537313966656337306138 + 36636530613837333631323135356334343639653761656132333531616230326332663366663865 + 3730363965303264620a663566353232363364613264636534343462323239633938343033366133 + 38313162626432393732383635623364343934303234323935353130373566343436323437636334 + 61383663653636373931326437636262306639616335613865366630313537613333393337353639 + 34613464323964633265363534323435353834333539323763623537373064303439353566373266 + 31636336663734326530623434633334663962663634653861383465343861316463386136373936 + 62393662343637313239396462643938393132366536666638623266376566616639 diff --git a/terraform/0rng.one.tf b/terraform/0rng.one.tf index 79d6fd0..58510f7 100644 --- a/terraform/0rng.one.tf +++ b/terraform/0rng.one.tf @@ -33,3 +33,11 @@ resource "cloudflare_record" "orngone_dl" { type = "A" ttl = 1 } + +resource "cloudflare_record" "orngone_yourls" { + zone_id = cloudflare_zone.orngone.id + name = "@" + value = vultr_server.casey.main_ip + type = "A" + ttl = 1 +}