mirror of
https://github.com/wallabag/docker.git
synced 2025-12-23 20:27:41 +01:00
first commit
This commit is contained in:
92
root/etc/ansible/entrypoint.yml
Normal file
92
root/etc/ansible/entrypoint.yml
Normal file
@ -0,0 +1,92 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
|
||||
vars:
|
||||
|
||||
database_driver: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_DRIVER') }}"
|
||||
database_host: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_HOST') }}"
|
||||
database_name: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_NAME') }}"
|
||||
database_password: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PASSWORD') }}"
|
||||
database_port: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PORT') }}"
|
||||
database_root_password: "{{ lookup('env', 'MYSQL_ROOT_PASSWORD') }}"
|
||||
database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER') }}"
|
||||
|
||||
tasks:
|
||||
|
||||
- name: needed dirs
|
||||
file:
|
||||
path={{ item }}
|
||||
state=directory
|
||||
with_items:
|
||||
- /var/www/wallabag/data/db
|
||||
- /var/www/wallabag/data/assets
|
||||
notify: chown dir
|
||||
|
||||
- stat:
|
||||
path=/var/www/wallabag/data/db/wallabag.sqlite
|
||||
register: wallabag_sqlite_db
|
||||
when: database_driver == 'pdo_sqlite'
|
||||
|
||||
- name: notify install for sqlite
|
||||
debug:
|
||||
msg='notify installation script if sqlite db does not exist'
|
||||
notify: run install
|
||||
when: (database_driver == 'pdo_sqlite') and
|
||||
(wallabag_sqlite_db.stat.exists == False)
|
||||
|
||||
- name: wait for db container
|
||||
wait_for:
|
||||
host="{{ database_host }}"
|
||||
port=3306
|
||||
when: database_driver == 'pdo_mysql'
|
||||
|
||||
- name: mariadb db
|
||||
mysql_db:
|
||||
name="{{ database_name }}"
|
||||
state=present
|
||||
login_host="{{ database_host }}"
|
||||
login_user=root
|
||||
login_password="{{ database_root_password }}"
|
||||
notify: run install
|
||||
when: database_driver == 'pdo_mysql'
|
||||
|
||||
- name: add mariadb user
|
||||
mysql_user:
|
||||
name="{{ database_user }}"
|
||||
host=%
|
||||
password="{{ database_password }}"
|
||||
priv={{ database_name }}.*:ALL
|
||||
login_host="{{ database_host }}"
|
||||
login_port="{{ database_port }}"
|
||||
login_user=root
|
||||
login_password="{{ database_root_password }}"
|
||||
state=present
|
||||
when: (database_driver == 'pdo_mysql') and
|
||||
(database_user != 'root')
|
||||
|
||||
- name: remove cache
|
||||
file:
|
||||
path=/var/www/wallabag/var/cache
|
||||
state=absent
|
||||
|
||||
- name: run composer
|
||||
shell: SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
|
||||
args:
|
||||
chdir: /var/www/wallabag
|
||||
notify: chown dir
|
||||
|
||||
handlers:
|
||||
|
||||
- name: run install
|
||||
shell: php bin/console wallabag:install --env=prod -n
|
||||
args:
|
||||
chdir: /var/www/wallabag
|
||||
notify: chown dir
|
||||
|
||||
- name: chown dir
|
||||
file:
|
||||
path=/var/www/wallabag
|
||||
recurse=yes
|
||||
owner=nobody
|
||||
group=nobody
|
||||
2
root/etc/ansible/hosts
Normal file
2
root/etc/ansible/hosts
Normal file
@ -0,0 +1,2 @@
|
||||
[localhost]
|
||||
localhost
|
||||
Reference in New Issue
Block a user