diff options
author | heqnx <root@heqnx.com> | 2025-07-06 14:57:39 +0300 |
---|---|---|
committer | heqnx <root@heqnx.com> | 2025-07-06 14:57:39 +0300 |
commit | a064cbda2086b79b6cc04111cb308a6b2d770aa6 (patch) | |
tree | 9b2c6aa08775aaae76420f9ad8d6baaf728bbe24 /tasks | |
parent | 3559ca8a720086f080286e887a29b6fa68810fa9 (diff) | |
download | ansible-icecast2-a064cbda2086b79b6cc04111cb308a6b2d770aa6.tar.gz ansible-icecast2-a064cbda2086b79b6cc04111cb308a6b2d770aa6.zip |
replaced ices2 which only supports vorbis, with liquidsoap + creation of title metadata; reorganized templates
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/icecast2_setup.yaml | 69 | ||||
-rw-r--r-- | tasks/nginx_setup.yaml | 54 |
2 files changed, 95 insertions, 28 deletions
diff --git a/tasks/icecast2_setup.yaml b/tasks/icecast2_setup.yaml index ee8342d..506c537 100644 --- a/tasks/icecast2_setup.yaml +++ b/tasks/icecast2_setup.yaml @@ -6,33 +6,76 @@ group: icecast mode: '0700' +- name: ensure {{ radio_music_dir }}/tracks directory exists + file: + path: "{{ radio_music_dir }}/tracks" + state: directory + owner: icecast2 + group: icecast + mode: '0700' + +- name: ensure {{ radio_music_dir }}/logs directory exists + file: + path: "{{ radio_music_dir }}/logs" + state: directory + owner: icecast2 + group: icecast + mode: '0700' + - name: deploy icecast.xml from template template: - src: icecast2/icecast.xml.j2 + src: etc/icecast2/icecast.xml.j2 dest: /etc/icecast2/icecast.xml owner: root group: root mode: '0644' -- name: deploy ices-playlist.xml.j2 from template +- name: deploy radio.liq from template template: - src: icecast2/ices-playlist.xml.j2 - dest: /etc/icecast2/ices-playlist.xml - owner: root - group: root - mode: '0644' + src: srv/radio/radio.liq.j2 + dest: "{{ radio_music_dir }}/radio.liq" + owner: icecast2 + group: icecast + mode: '0744' -- name: deploy mp3-to-ogg.sh from template +- name: deploy liquidsoap-radio.service from template template: - src: icecast2/mp3-to-ogg.sh.j2 - dest: /etc/icecast2/mp3-to-ogg.sh - owner: root - group: root + src: etc/systemd/system/liquidsoap-radio.service + dest: /etc/systemd/system/liquidsoap-radio.service + owner: icecast2 + group: icecast mode: '0744' -- name: restart icecast2 +- name: reload systemd daemon + systemd: + daemon_reload: yes + +- name: restart and enable icecast2 systemd: name: icecast2 state: restarted enabled: true when: ansible_service_mgr == 'systemd' + +- name: restart and enable liquidsoap-radio + systemd: + name: liquidsoap-radio + state: restarted + enabled: true + when: ansible_service_mgr == 'systemd' + +#- name: deploy ices-playlist.xml.j2 from template +# template: +# src: icecast2/ices-playlist.xml.j2 +# dest: /etc/icecast2/ices-playlist.xml +# owner: root +# group: root +# mode: '0644' + +#- name: deploy mp3-to-ogg.sh from template +# template: +# src: icecast2/mp3-to-ogg.sh.j2 +# dest: /etc/icecast2/mp3-to-ogg.sh +# owner: root +# group: root +# mode: '0744' diff --git a/tasks/nginx_setup.yaml b/tasks/nginx_setup.yaml index 604db6d..1b6688f 100644 --- a/tasks/nginx_setup.yaml +++ b/tasks/nginx_setup.yaml @@ -1,3 +1,9 @@ +- name: remove /var/www/html directory + file: + path: /var/www/html + state: absent + ignore_errors: true + - name: remove /etc/nginx/sites-enabled directory file: path: /etc/nginx/sites-enabled @@ -8,7 +14,7 @@ path: /etc/nginx/sites-available state: absent -- name: ensure /var/www/html directory exists and is empty +- name: ensure /var/www/html directory exists file: path: /var/www/html state: directory @@ -16,28 +22,46 @@ owner: www-data group: www-data -- name: clean /var/www/html contents +- name: ensure /var/www/html/videos directory exists file: - path: /var/www/html - state: absent - become: true - ignore_errors: true + path: /var/www/html/videos + state: directory + mode: '0755' + owner: www-data + group: www-data -- name: recreate /var/www/html directory - file: - path: /var/www/html +- name: copy web templates to /var/www/html + ansible.builtin.template: + src: "{{ item.src }}" + dest: "/var/www/html/{{ item.path }}" + owner: www-data + group: www-data + mode: '0644' + with_community.general.filetree: templates/var/www/html + when: item.state == "file" + +- name: set directory permissions to 755 + ansible.builtin.file: + path: /var/www/html/ + recurse: yes state: directory mode: '0755' owner: www-data group: www-data -- name: deploy nginx.conf from template - template: - src: nginx/nginx.conf.j2 - dest: /etc/nginx/nginx.conf - owner: root - group: root +- name: set file permissions to 644 + ansible.builtin.find: + paths: /var/www/html/ + file_type: file + register: found_files + +- name: apply 644 permission on files + ansible.builtin.file: + path: "{{ item.path }}" mode: '0644' + owner: www-data + group: www-data + loop: "{{ found_files.files }}" - name: restart nginx systemd: |