2022-09-29 05:55:46 +00:00
# 2022-09-29: './runrole --reinstall azuracast' is NOT supported!
#
# 1. But if you must, first completely uninstall Docker + WIPE AzuraCast data:
#
# apt purge docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin
# rm -rf /library/docker /var/lib/docker /var/lib/containerd
#
# Per https://docs.docker.com/engine/install/ubuntu/#uninstall-docker-engine
#
# 2. REBOOT to avoid later problems with 'systemctl status docker' -- if you
# don't reboot, Ansible will fail below when 'docker.sh install' fails to
# start docker.service -- likewise if you run './docker.sh install-docker'
# manually in /opt/azuracast. Either way, 'systemctl restart docker' won't
# work for ~2 minutes. (Rebooting avoids all these hassles!)
#
# 3. Just FYI the Docker install process will rebuild its 11 core directories
# in /var/lib/docker -> /library/docker: (as 'docker.sh install' begins)
#
# buildkit containers image network overlay2 plugins runtimes swarm tmp trust volumes
#
# 4. Just FYI both MySQL passwords (MYSQL_PASSWORD & MYSQL_ROOT_PASSWORD) will
# be WIPED from /opt/azuracast/azuracast.env (and new passwords
# auto-generated below, for use inside AzuraCast's Docker container).
#
# 5. Run './runrole --reinstall azuracast' in /opt/iiab/iiab
2023-06-10 13:10:47 +00:00
- name : Record (initial) disk space used
shell : df -B1 --output=used / | tail -1
2023-05-27 07:26:04 +00:00
register : df1
2019-07-04 03:17:05 +00:00
- name : AzuraCast - Make config directory {{ azuracast_host_dir }}
2022-08-29 19:28:02 +00:00
file :
2019-06-13 12:26:26 +00:00
path : "{{ azuracast_host_dir }}"
state : directory
2019-07-04 03:17:05 +00:00
- name : AzuraCast - Install {{ azuracast_host_dir }}/.env from template
2019-06-13 12:26:26 +00:00
template :
2022-08-30 09:54:21 +00:00
src : prod.env.j2
2019-06-13 12:26:26 +00:00
dest : "{{ azuracast_host_dir }}/.env"
2022-09-29 02:33:05 +00:00
- name : AzuraCast - Install {{ azuracast_host_dir }}/azuracast.env for altered ports
template :
src : azuracast.env.j2
dest : "{{ azuracast_host_dir }}/azuracast.env"
2019-06-18 06:51:45 +00:00
2019-07-04 03:17:05 +00:00
- name : AzuraCast - Download {{ docker_sh_url }} to {{ azuracast_host_dir }}
2019-06-13 12:26:26 +00:00
get_url :
url : "{{ docker_sh_url }}"
dest : "{{ azuracast_host_dir }}/"
mode : 0755
2021-12-26 15:24:31 +00:00
timeout : "{{ download_timeout }}"
2019-06-13 12:26:26 +00:00
2022-09-29 04:31:17 +00:00
#- name: AzuraCast - Make changes to docker.sh script so it runs headless
# lineinfile:
# path: "{{ azuracast_host_dir }}/docker.sh"
# regexp: "^(.*)read reply.*"
# line: "\\1reply='Y'"
# backrefs: yes
2022-09-29 02:33:05 +00:00
2022-09-29 02:01:25 +00:00
# 2022-09-28: https://docs.azuracast.com/en/getting-started/installation/docker
2022-09-29 02:33:05 +00:00
# (& testing) confirm this is done automatically by 'docker.sh install' below.
2022-09-29 02:01:25 +00:00
#
# - name: AzuraCast - Download AzuraCast's docker-compose.yml sample from GitHub to {{ azuracast_host_dir }}
# get_url:
# url: "{{ docker_compose_url }}"
# dest: "{{ azuracast_host_dir }}/docker-compose.yml"
# timeout: "{{ download_timeout }}"
2019-06-18 12:16:21 +00:00
2022-09-29 04:31:17 +00:00
#- name: AzuraCast - Install {{ azuracast_host_dir }}/docker-compose.override.yml from template
# template:
# src: docker-compose.override.yml.j2
# dest: "{{ azuracast_host_dir }}/docker-compose.override.yml"
2019-06-13 12:26:26 +00:00
2021-08-17 03:11:44 +00:00
#- name: Change default port number range 8xxx:8xxx to {{ azuracast_port_range_prefix }}xxx:{{ azuracast_port_range_prefix }}xxx icecast-stations in docker-compose.yml
# replace:
# path: "{{ azuracast_host_dir }}/docker-compose.yml"
# regexp: "^( *- \\')8([0-9]{3})\\:8([0-9]{3}\\'.*)$"
# replace: "\\g<1>{{ azuracast_port_range_prefix }}\\g<2>:{{ azuracast_port_range_prefix }}\\g<3>"
2019-07-04 03:17:05 +00:00
- name : AzuraCast - Make directory {{ docker_container_dir }}
2022-08-29 19:28:02 +00:00
file :
2019-06-13 12:26:26 +00:00
path : "{{ docker_container_dir }}"
state : directory
2022-08-29 19:28:02 +00:00
2019-07-04 03:17:05 +00:00
- name : AzuraCast - Symlink /var/lib/docker -> {{ docker_container_dir }}
2019-06-13 12:26:26 +00:00
file :
src : "{{ docker_container_dir }}"
2019-07-04 03:23:47 +00:00
path : /var/lib/docker
2022-08-29 19:28:02 +00:00
state : link
2019-06-13 12:26:26 +00:00
2022-09-28 23:40:25 +00:00
# 2022-09-28: "yes 'Y'" toggled whatever it found in /opt/azuracast/.env (e.g.
# AZURACAST_VERSION=stable from templates/prod.env.j2) to the opposite (e.g.
# AZURACAST_VERSION=latest). Let's not modify /opt/azuracast/.env unless nec!
#
# - name: AzuraCast - Setup for stable channel install
# shell: "yes 'Y' | /bin/bash docker.sh setup-release"
# args:
# chdir: "{{ azuracast_host_dir }}"
2021-07-19 07:36:09 +00:00
2019-06-23 10:20:49 +00:00
- name : AzuraCast - Run the installer
2021-07-19 07:36:09 +00:00
shell : "yes '' | /bin/bash docker.sh install"
2019-06-13 12:26:26 +00:00
args :
chdir : "{{ azuracast_host_dir }}"
2019-09-14 21:50:19 +00:00
2020-01-30 09:00:00 +00:00
# RECORD AzuraCast AS INSTALLED
2023-06-10 13:10:47 +00:00
- name : Record (final) disk space used
shell : df -B1 --output=used / | tail -1
2023-05-27 07:26:04 +00:00
register : df2
2023-06-10 13:10:47 +00:00
- name : Add 'azuracast_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
2023-05-27 07:26:04 +00:00
ini_file :
path : "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section : azuracast
option : azuracast_disk_usage
2023-06-10 13:10:47 +00:00
value : "{{ df2.stdout|int - df1.stdout|int }}"
2023-05-27 07:26:04 +00:00
2020-01-30 09:00:00 +00:00
- name : "Set 'azuracast_installed: True'"
set_fact :
azuracast_installed : True
2020-01-12 23:15:33 +00:00
- name : "Add 'azuracast_installed: True' to {{ iiab_state_file }}"
2019-09-14 21:50:19 +00:00
lineinfile :
2020-02-04 00:54:04 +00:00
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
2019-09-14 21:50:19 +00:00
regexp : '^azuracast_installed'
2019-10-07 17:11:21 +00:00
line: 'azuracast_installed : True '