1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #265 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-07-04 11:23:39 -04:00 committed by GitHub
commit 3558a7ca8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 24 deletions

View file

@ -6,7 +6,7 @@ This playbook adds `AzuraCast <https://azuracast.com/>`_ to Internet-in-a-Box (I
Please see AzuraCast's `screenshots <https://www.azuracast.com/about/screenshots.html>`_.
As of 2019-06-24, this will only run on Ubuntu 18.04, Debian 9, and tentatively on Debian 10. Support for Raspberry Pi remains a goal for now; please if you can help everyone solve this challenge: `#1772 <https://github.com/iiab/iiab/issues/1772>`_
As of 2019-07-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 <https://github.com/iiab/iiab/issues/1766>`_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 <https://github.com/iiab/iiab/issues/1772>`_, `AzuraCast/AzuraCast#332 <https://github.com/AzuraCast/AzuraCast/issues/332>`_).
Using It
--------

View file

@ -1,9 +1,9 @@
- name: AzuraCast - Make AzuraCast config directory
- name: AzuraCast - Make config directory {{ azuracast_host_dir }}
file:
path: "{{ azuracast_host_dir }}"
state: directory
- name: AzuraCast - Copy over .env template to AzuraCast config directory
- name: AzuraCast - Install {{ azuracast_host_dir }}/.env from template
template:
src: env.j2
dest: "{{ azuracast_host_dir }}/.env"
@ -11,7 +11,7 @@
group: root
mode: 0644
- name: AzuraCast - Copy over docker-compose.override.yml template to AzuraCast config directory
- 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"
@ -19,7 +19,7 @@
group: root
mode: 0644
- name: AzuraCast - Download docker.sh script
- name: AzuraCast - Download {{ docker_sh_url }} to {{ azuracast_host_dir }}
get_url:
url: "{{ docker_sh_url }}"
dest: "{{ azuracast_host_dir }}/"
@ -27,12 +27,13 @@
mode: 0755
when: internet_available | bool
- name: AzuraCast - Download docker-compose.yml
- 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 }}"
mode: 0755
when: internet_available | bool
- name: AzuraCast - Make changes to docker.sh script so it runs headless
lineinfile:
@ -41,18 +42,18 @@
line: "\\1reply='Y'"
backrefs: yes
- name: AzuraCast - Make docker container directory
- name: AzuraCast - Make directory {{ docker_container_dir }}
file:
path: "{{ docker_container_dir }}"
state: directory
- name: AzuraCast - Link docker container directory
- name: AzuraCast - Symlink /var/lib/docker -> {{ docker_container_dir }}
file:
src: "{{ docker_container_dir }}"
dest: "/var/lib/docker"
path: /var/lib/docker
state: link
- name: Change default port number ranges 8xxx:8xxx to Nxxx:Nxxx icecast-stations in docker-compose.yml (N - azuracast_port_range_prefix)
- 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}\\'.*)$"

View file

@ -1,3 +1,3 @@
- name: AzuraCast install
- name: Install AzuraCast if azuracast_install
include_tasks: install.yml
when: azuracast_install
when: azuracast_install | bool

View file

@ -1,2 +1,9 @@
mysql_install: True
mysql_enabled: False
# MySQL MANDATORY - THESE 2 VARS HAVE NO EFFECT - SEE roles/0-init/tasks/main.yml & roles/mysql/tasks/main.yml
# mysql_install: True
# mysql_enabled: True
## mysql_root_password: $6$iiab51$3ICIW0CLWxxMW2a3yrHZ38ukZItD5tcadL4rWcE9D.qIGStxhh8rRsaSxoj3b.MYxI/VRDNjpzSYK/V6zkWFI0
# mysql_root_password: fixmysql
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!

View file

@ -18,11 +18,11 @@
tags:
- download
- name: Install php{{ php_version }}-xml (ubuntu or debian-9)
- name: Install php{{ php_version }}-xml (ubuntu or debian 9+)
package:
name: "php{{ php_version }}-xml"
state: present
when: is_ubuntu or is_debian_9
when: is_ubuntu or (is_debian and not is_debian_8)
- name: Install php-xml-parser (debian-8)
package:
@ -59,16 +59,69 @@
tags:
- download
# Name of MySQL service varies by OS so softcoded in 1-prep
- name: 'Start MySQL systemd service: {{ mysql_service }}'
systemd:
name: "{{ mysql_service }}"
state: started
when: mysql_enabled | bool
- name: Enable MySQL systemd service (upon subsequent boots) if mysql_enabled
# 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's
# default boot timeout (90s to 180s) for slow CPUs like this Ubuntu 18.04.2 VM:
# https://github.com/iiab/iiab/issues/1802
# https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/#systemd
- name: Check if /lib/systemd/system/mariadb.service exists
stat:
path: /lib/systemd/system/mariadb.service
register: mariadb_unit_file
- name: Copy pkg's /lib/systemd/system/mariadb.service to /etc/systemd/system/ to be customized (CREATES TIMETAMPED BACKUPS OF /etc/systemd/system/mariadb.service e.g. IF OPERATOR CUSTOMIZED IT, EVEN DESPITE WARNING BELOW!)
copy:
force: yes
backup: yes
src: /lib/systemd/system/mariadb.service
dest: /etc/systemd/system/
when: mariadb_unit_file.stat.exists
- name: Symlink /etc/systemd/system/mysql.service -> /etc/systemd/system/mariadb.service
file:
state: link
force: yes
src: /etc/systemd/system/mariadb.service
path: /etc/systemd/system/mysql.service
when: mariadb_unit_file.stat.exists
- name: Symlink /etc/systemd/system/mysqld.service -> /etc/systemd/system/mariadb.service
file:
state: link
force: yes
src: /etc/systemd/system/mariadb.service
path: /etc/systemd/system/mysqld.service
when: mariadb_unit_file.stat.exists
- name: "WARN OPERATOR: Changes made to /etc/systemd/system/mariadb.service WILL BE LOST whenever 'mysql' playbook is run"
lineinfile:
path: /etc/systemd/system/mariadb.service
insertbefore: BOF # Beginning of file
line: "# WARNING: CHANGES TO THIS FILE WILL BE REGULARLY *OVERWRITTEN* BY:\n# /opt/iiab/iiab/roles/mysql/tasks/main.yml\n"
when: mariadb_unit_file.stat.exists
- name: Set systemd boot timeout to 180 seconds for slow machines, in /etc/systemd/system/mariadb.service
lineinfile:
path: /etc/systemd/system/mariadb.service
insertafter: '^\[Service\]$'
regexp: "^TimeoutStartSec="
line: "\n# 2019-07-03: @jvonau @holta doubled MariaDB's default boot timeout, from\n# 90 seconds to 180 seconds, for slow machines like this Ubuntu 18.04.2 VM:\n# https://github.com/iiab/iiab/issues/1802\n# https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/#systemd\nTimeoutStartSec=180\n"
# If the line above were to be run repeatedly (never happens here!) Ansible
# would pollute MariaDB's systemd unit file. As multi-line regexp's are
# not allowed (both regexp's should match, for idempotency). If nec, use
# the 1-liner below, or Ansible's 'blockinfile' which pollutes config files
# in its own way...surrounding blocks with marker lines.
# line: "TimeoutStartSec=180"
when: mariadb_unit_file.stat.exists
# Name of MySQL service varies by OS, so hardcoded in /opt/iiab/iiab/vars/<OS>.yml (formerly in roles/0-init/tasks/main.yml)
- name: Enable & Start MySQL systemd service ({{ mysql_service }}) if mysql_enabled
systemd:
name: "{{ mysql_service }}"
daemon_reload: yes
state: restarted
enabled: yes
when: mysql_enabled | bool

View file

@ -218,7 +218,7 @@ apache_allow_sudo: True
apache_high_php_limits: False
# SEE ALSO VARIABLES NEAR TOP OF THIS FILE: default_language, language_priority
# MySQL MANDATORY - THESE SETTINGS HAVE NO EFFECT - SEE roles/1-prep/tasks/computed_vars.yml, roles/mysql/tasks/main.yml
# MySQL MANDATORY - THESE 2 VARS HAVE NO EFFECT - SEE roles/0-init/tasks/main.yml & roles/mysql/tasks/main.yml
mysql_install: True
mysql_enabled: True
# mysql_root_password: $6$iiab51$3ICIW0CLWxxMW2a3yrHZ38ukZItD5tcadL4rWcE9D.qIGStxhh8rRsaSxoj3b.MYxI/VRDNjpzSYK/V6zkWFI0