php4dvd: Initial version of role

This commit is contained in:
Timo Makinen 2023-08-20 14:34:11 +00:00
parent 946c7d0772
commit f664e0271b
5 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,17 @@
---
- name: Rebuild php4dvd-container
ansible.builtin.command:
argv:
- podman
- build
- -t
- php4dvd
- /usr/local/src/docker-php4dvd
become: true
become_user: php4dvd
notify: Restart php4dvd-container
- name: Restart php4dvd-container
ansible.builtin.service:
name: php4dvd-container
state: restarted

View file

@ -0,0 +1,5 @@
---
dependencies:
- {role: git}
- {role: nginx}
- {role: podman}

View file

@ -0,0 +1,55 @@
---
- name: Create group
ansible.builtin.group:
name: php4dvd
- name: Create user
ansible.builtin.user:
name: php4dvd
comment: Podman pphp4dvd
group: authcheck
shell: /sbin/nologin
- name: Get container source
ansible.builtin.git:
dest: /usr/local/src/docker-php4dvd
repo: https://github.com/foo-sh/docker-php4dvd.git
update: false
version: master
notify: Rebuild php4dvd-container
- name: Create service file
ansible.builtin.template:
dest: /etc/systemd/system/php4dvd-container.service
src: php4dvd-container.service.j2
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
- name: Create service config
ansible.builtin.template:
dest: /etc/sysconfig/php4dvd-container
src: php4dvd-container.sysconfig.j2
mode: 0600
owner: root
group: "{{ ansible_wheel }}"
notify: Restart php4dvd-container
- name: Enable service
ansible.builtin.service:
name: php4dvd-container
state: started
enabled: true
- name: Copy nginx config
ansible.builtin.copy:
dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/php4dvd-container.conf"
content: |
location /php4dvd {
proxy_pass http://127.0.0.1:8005/;
}
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: Restart nginx

View file

@ -0,0 +1,19 @@
[Unit]
Description=php4dvd Container
Wants=network-online.target
After=network-online.target
[Service]
User=php4dvd
EnvironmentFile=/etc/sysconfig/php4dvd-container
ExecStart=/usr/bin/podman run \
--rm -p 127.0.0.1:8005:80 \
--name php4dvd \
--env PHP4DVD_* \
--volume /export/volumes/php4dvd:/var/www/html/movies:rw,Z \
php4dvd:latest
ExecStop=/usr/bin/podman stop --ignore php4dvd
ExecStopPost=/usr/bin/podman rm -f --ignore php4dvd
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,5 @@
PHP4DVD_DB_HOST=sqldb02.home.foo.sh
PHP4DVD_DB_NAME=php4dvd
PHP4DVD_DB_USER=php4dvd
PHP4DVD_DB_PASS={{ php4dvd_mysql_pass }}
PHP4DVD_USER_GUESTVIEW=true