Browse Source

[icecast] Fix permissions and log files

Colin Powell 3 năm trước cách đây
mục cha
commit
27acb9474d

+ 28 - 1
ansible/roles/icecast/tasks/main.yml

@@ -1,9 +1,36 @@
 ---
 - name: Dependencies installed
   community.general.pkgng:
-    name: icecast
+    name: icecast,mime-support
     state: latest
 
+- name: Icecast user created
+  ansible.builtin.user:
+    name: icecast
+
+- name: MIME types linked
+  file:
+    src: /usr/local/etc/mime.types
+    dest: /etc/mime.types
+    owner: root
+    state: link
+
+- name: Icecast access logs created
+  copy:
+    content: ""
+    dest: /var/log/icecast.access.log
+    force: no
+    owner: icecast
+    mode: 0644
+
+- name: Icecast access log created
+  copy:
+    content: ""
+    dest: /var/log/icecast.error.log
+    force: no
+    owner: icecast
+    mode: 0644
+
 - name: Icecast silence.mp3 installed
   copy:
     src: silence.mp3

+ 5 - 7
ansible/roles/icecast/templates/icecast.xml.j2

@@ -200,7 +200,7 @@
 
         <!-- Note that if <chroot> is turned on below, these paths must both
              be relative to the new root, not the original root -->
-        <logdir>/var/log/icecast2</logdir>
+        <logdir>/var/log</logdir>
         <webroot>/usr/share/icecast2/web</webroot>
         <adminroot>/usr/share/icecast2/admin</adminroot>
         <!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> -->
@@ -224,8 +224,8 @@
     </paths>
 
     <logging>
-        <accesslog>access.log</accesslog>
-        <errorlog>error.log</errorlog>
+        <accesslog>icecast.access.log</accesslog>
+        <errorlog>icecast.error.log</errorlog>
         <!-- <playlistlog>playlist.log</playlistlog> -->
         <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
         <logsize>10000</logsize> <!-- Max size of a logfile -->
@@ -239,11 +239,9 @@
 
     <security>
         <chroot>0</chroot>
-        <!--
         <changeowner>
-            <user>nobody</user>
-            <group>nogroup</group>
+            <user>icecast</user>
+            <group>icecast</group>
         </changeowner>
-        -->
     </security>
 </icecast>