php4dvd: Initial version of role
This commit is contained in:
parent
946c7d0772
commit
f664e0271b
5 changed files with 101 additions and 0 deletions
17
roles/php4dvd/handlers/main.yml
Normal file
17
roles/php4dvd/handlers/main.yml
Normal 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
|
5
roles/php4dvd/meta/main.yml
Normal file
5
roles/php4dvd/meta/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
dependencies:
|
||||
- {role: git}
|
||||
- {role: nginx}
|
||||
- {role: podman}
|
55
roles/php4dvd/tasks/main.yml
Normal file
55
roles/php4dvd/tasks/main.yml
Normal 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
|
||||
|
19
roles/php4dvd/templates/php4dvd-container.service.j2
Normal file
19
roles/php4dvd/templates/php4dvd-container.service.j2
Normal 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
|
5
roles/php4dvd/templates/php4dvd-container.sysconfig.j2
Normal file
5
roles/php4dvd/templates/php4dvd-container.sysconfig.j2
Normal 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
|
Loading…
Add table
Reference in a new issue