run:
  - file:
     path: /etc/runit/1.d/remove-old-socket
     chmod: "+x"
     contents: |
        #!/bin/bash
        rm -f /shared/nginx.http*.sock
  - file:
     path: /etc/runit/3.d/remove-old-socket
     chmod: "+x"
     contents: |
        #!/bin/bash
        rm -rf /shared/nginx.http*.sock
  - replace:
     filename: "/etc/nginx/conf.d/outlets/server/10-http.conf"
     from: /listen 80;(\nlisten \[::\]:80;)?/
     to: |
       listen unix:/shared/nginx.http.sock;
       set_real_ip_from unix:;
  - replace:
     filename: "/etc/nginx/conf.d/outlets/server/20-https.conf"
     from: /listen 443 ssl;(\nlisten \[::\]:443 ssl;)?/
     to: |
       listen unix:/shared/nginx.https.sock ssl;
       set_real_ip_from unix:;
  - replace:
     filename: "/etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf"
     from: /listen 80;(\nlisten \[::\]:80;)?/
     to: |
       listen unix:/shared/nginx.http.sock;
       set_real_ip_from unix:;
