✨: move phpbb to app dir
This commit is contained in:
10
roles/phpbb/tasks/db.yml
Normal file
10
roles/phpbb/tasks/db.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
- name: Create phpbb db user
|
||||
community.mysql.mysql_user:
|
||||
login_unix_socket: "/var/run/mysqld/mysqld.sock"
|
||||
login_user: root
|
||||
login_password: "{{ mariadb_root_pass }}"
|
||||
name: "{{ phpbb_maria_user }}"
|
||||
password: "{{ phpbb_maria_password }}"
|
||||
priv: "{{ phpbb_maria_database }}.*:ALL"
|
27
roles/phpbb/tasks/main.yml
Normal file
27
roles/phpbb/tasks/main.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Init db
|
||||
ansible.builtin.include_tasks: db.yml
|
||||
|
||||
- name: Install phpbb
|
||||
ansible.builtin.include_tasks: phpbb.yml
|
||||
|
||||
- name: Install phpbb’s styles
|
||||
ansible.builtin.include_tasks: phpbb_styles.yml
|
||||
loop: "{{ phpbb_styles }}"
|
||||
|
||||
- name: Install phpbb’s languages
|
||||
ansible.builtin.include_tasks: phpbb_languages.yml
|
||||
loop: "{{ phpbb_languages }}"
|
||||
|
||||
- name: Install phpbb’s extensions
|
||||
ansible.builtin.include_tasks: phpbb_exts.yml
|
||||
loop: "{{ phpbb_exts }}"
|
||||
loop_control:
|
||||
loop_var: ext
|
||||
|
||||
- name: Custom part
|
||||
ansible.builtin.include_tasks: phpbb_customs.yml
|
||||
|
||||
- name: Migrate db
|
||||
ansible.builtin.include_tasks: migrate_db.yml
|
13
roles/phpbb/tasks/migrate_db.yml
Normal file
13
roles/phpbb/tasks/migrate_db.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Migrate db
|
||||
become_user: www-data
|
||||
ansible.builtin.command:
|
||||
cmd: "/usr/bin/php bin/phpbbcli.php db:migrate"
|
||||
chdir: "{{ phpbb_app_home }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Remove install directory
|
||||
ansible.builtin.file:
|
||||
dest: "{{ phpbb_app_home }}/install"
|
||||
state: absent
|
77
roles/phpbb/tasks/phpbb.yml
Normal file
77
roles/phpbb/tasks/phpbb.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
|
||||
- name: Remove phpbb previous version
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
dest: "{{ phpbb_app_home }}"
|
||||
|
||||
## Handle app data
|
||||
- name: Create app home
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ phpbb_app_home }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Install phpbb application
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ phpbb_url }}"
|
||||
dest: "{{ phpbb_app_home }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
exclude: "{{ phpbb_userdata_app_dirs | map('regex_replace', '^^', 'phpBB' ~ phpbb_major_version ~ '/') }}"
|
||||
|
||||
- name: Check writable dirs
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ phpbb_app_home }}/{{ item }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
recurse: true
|
||||
loop: "{{ phpbb_writable_app_dirs }}"
|
||||
|
||||
## Handle user data
|
||||
- name: Create data home
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: "{{ phpbb_data_home }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
|
||||
- name: Get data dir
|
||||
ansible.builtin.stat:
|
||||
path: "{{ phpbb_data_home }}/{{ phpbb_userdata_app_dirs[0] }}"
|
||||
register: _phpbb_userdata_dir_stat
|
||||
|
||||
- name: Install phpbb data dir
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ phpbb_url }}"
|
||||
dest: "{{ phpbb_data_home }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
include: "{{ phpbb_userdata_app_dirs | map('regex_replace', '^^', 'phpBB' ~ phpbb_major_version ~ '/') }}"
|
||||
when: not _phpbb_userdata_dir_stat.stat.exists
|
||||
|
||||
- name: Link phpbb userdata dirs
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ phpbb_data_home }}/{{ item }}"
|
||||
dest: "{{ phpbb_app_home }}/{{ item }}"
|
||||
loop: "{{ phpbb_userdata_app_dirs }}"
|
||||
|
||||
- name: Put phpbb config file
|
||||
ansible.builtin.template:
|
||||
src: config.php.j2
|
||||
dest: "{{ phpbb_app_home }}/config.php"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o640"
|
27
roles/phpbb/tasks/phpbb_customs.yml
Normal file
27
roles/phpbb/tasks/phpbb_customs.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Put logo file
|
||||
ansible.builtin.copy:
|
||||
src: files/ndfr_casual.png
|
||||
dest: "{{ phpbb_app_home }}/styles/prosilver/theme/images/ndfr_casual.png"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o640"
|
||||
|
||||
- name: Replace logo
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ phpbb_app_home }}/styles/prosilver/theme/colours.css"
|
||||
search_string: "background-image: url(\"./images/site_logo.svg\");"
|
||||
line: " background-image: url(\"./images/ndfr_casual.png\");"
|
||||
|
||||
- name: Stretch logo (width)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ phpbb_app_home }}/styles/prosilver/theme/common.css"
|
||||
search_string: "width: 149px;"
|
||||
line: " width: 200px;"
|
||||
|
||||
- name: Stretch logo (height)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ phpbb_app_home }}/styles/prosilver/theme/common.css"
|
||||
search_string: "height: 52px;"
|
||||
line: " height: 80px;"
|
29
roles/phpbb/tasks/phpbb_exts.yml
Normal file
29
roles/phpbb/tasks/phpbb_exts.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
|
||||
- name: Create phpbb ext path
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ phpbb_app_home }}/ext/{{ ext.path }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Extract phpbb ext
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ ext.url | replace('%VERSION%', ext.version) }}"
|
||||
dest: "{{ phpbb_app_home }}/ext/{{ ext.path }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
|
||||
- name: Put extra files
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ phpbb_app_home }}/ext/{{ ext.path }}/{{ item.dest }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o640"
|
||||
loop: "{{ ext.extra_files }}"
|
||||
when: ext.extra_files is defined
|
11
roles/phpbb/tasks/phpbb_languages.yml
Normal file
11
roles/phpbb/tasks/phpbb_languages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
|
||||
- name: Extract phpbb language
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ item.url | replace('%VERSION%', item.version) }}"
|
||||
dest: "{{ phpbb_app_home }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
11
roles/phpbb/tasks/phpbb_styles.yml
Normal file
11
roles/phpbb/tasks/phpbb_styles.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
|
||||
- name: Extract style
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ item.url | replace('%VERSION%', item.version) }}"
|
||||
dest: "{{ phpbb_app_home }}/styles/"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
Reference in New Issue
Block a user