Compare commits
2 Commits
a1bc985eb7
...
dd89ef99f6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dd89ef99f6 | ||
![]() |
ce3646dcf9 |
1
.ansible-lint-ignore
Normal file
1
.ansible-lint-ignore
Normal file
@@ -0,0 +1 @@
|
||||
roles/nsd/tasks/zones.yml no-tabs
|
@@ -6,6 +6,7 @@ web_hostname:
|
||||
- host: www.nintendojo.fr
|
||||
- host: wwwdev.nintendojo.fr
|
||||
- host: forum.nintendojo.fr
|
||||
type: phpbb
|
||||
- host: nintendojofr.com
|
||||
- host: www.nintendojofr.com
|
||||
type: retrodojo
|
||||
@@ -19,6 +20,16 @@ mariadb_root_pass: !vault |
|
||||
3437653064323138310a663363373736623931336432376466316666616234356133383263373136
|
||||
31343534663063663134306464306234366430323762656165653930333134326231
|
||||
|
||||
phpbb_maria_database: "dojo_forum"
|
||||
phpbb_maria_user: "adm_forum"
|
||||
phpbb_maria_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
65306237643235363962653566336537303632386466646462656234333836396630306438336632
|
||||
3334663566303963646135313265643235623538633463650a663637386436306538616266626232
|
||||
36373332396338326437663832383237623836643137323432323435333231633363386432303830
|
||||
3465306161666563630a356462363561653431303438653935346564343861303962363030323633
|
||||
3632
|
||||
|
||||
wordpress_maria_database: "dojo_wp"
|
||||
wordpress_maria_user: "adm_wp"
|
||||
wordpress_maria_password: !vault |
|
||||
|
@@ -23,5 +23,9 @@
|
||||
hosts: web2
|
||||
diff: true
|
||||
roles:
|
||||
- wordpress
|
||||
- retrodojo
|
||||
- role: wordpress
|
||||
tags: [never, wordpress]
|
||||
- role: phpbb
|
||||
tags: [never, phpbb]
|
||||
- role: retrodojo
|
||||
tags: [never, retrodojo]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
server {
|
||||
{% include './templates/header.conf.j2' %}
|
||||
root /srv/http/forum.nintendojo.fr/;
|
||||
root /var/www/forum.nintendojo.fr/;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
client_max_body_size 10M;
|
||||
|
7
roles/phpbb/files/dojopeertube.yml
Normal file
7
roles/phpbb/files/dojopeertube.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
name: DojoPeertube
|
||||
host: p.nintendojo.fr
|
||||
example: https://p.nintendojo.fr/videos/embed/19bc46e8-7640-4417-86a1-03aa2b439508
|
||||
extract: "!//p.nintendojo.fr/videos/embed/(?'id'[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})!"
|
||||
iframe:
|
||||
src: "https://p.nintendojo.fr/videos/embed/{@id}"
|
18
roles/phpbb/files/mastodon.yml
Normal file
18
roles/phpbb/files/mastodon.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: "Mastodon"
|
||||
host: m.nintendojo.fr
|
||||
example: https://mastodon.social/@HackerNewsBot/100181134752056592
|
||||
extract: "!//(?'host'[-.\\w]+)/@(?'name'\\w+)/(?'id'\\d+)!"
|
||||
oembed:
|
||||
endpoint: https://m.nintendojo.fr/api/oembed
|
||||
scheme: https://m.nintendojo.fr/@{@name}/{@id}
|
||||
scrape:
|
||||
- extract: "!\"url\":\"https://(?'host'[-.\\w]+)/@(?'name'\\w+)/(?'id'\\d+)\"!"
|
||||
- match: "!^(?'origin'https://[^/]+)/@\\w+@[-.\\w]+/(?'id'\\d+)!"
|
||||
- url: "{@origin}/api/v1/statuses/{@id}"
|
||||
iframe:
|
||||
data-s9e-livepreview-ignore-attrs: "style"
|
||||
onload: "let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+'px';this.contentWindow.postMessage('s9e:init','*',[c.port2])"
|
||||
width: "550"
|
||||
height: "300"
|
||||
src: https://s9e.github.io/iframe/2/mastodon.min.html#<xsl:value-of select="@name"/><xsl:if test="@host and@host!='mastodon.social'">@<xsl:value-of select="@host"/></xsl:if>/<xsl:value-of select="@id"/>
|
BIN
roles/phpbb/files/ndfr_casual.png
Normal file
BIN
roles/phpbb/files/ndfr_casual.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
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
|
14
roles/phpbb/tasks/migrate_db.yml
Normal file
14
roles/phpbb/tasks/migrate_db.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- name: Migrate db
|
||||
become: true
|
||||
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']
|
19
roles/phpbb/templates/config.php.j2
Normal file
19
roles/phpbb/templates/config.php.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// phpBB 3.0.x auto-generated configuration file
|
||||
// Do not change anything in this file!
|
||||
$dbms = 'mysqli';
|
||||
$dbhost = 'localhost';
|
||||
$dbport = '';
|
||||
$dbname = '{{ phpbb_maria_database }}';
|
||||
$dbuser = '{{ phpbb_maria_user }}';
|
||||
$dbpasswd = '{{ phpbb_maria_password }}';
|
||||
$table_prefix = 'phpbb_';
|
||||
$acm_type = 'file';
|
||||
$load_extensions = '';
|
||||
|
||||
libxml_disable_entity_loader(false);
|
||||
|
||||
@define('PHPBB_INSTALLED', true);
|
||||
// @define('DEBUG', true);
|
||||
// @define('DEBUG_EXTRA', true);
|
||||
?>
|
45
roles/phpbb/vars/main.yml
Normal file
45
roles/phpbb/vars/main.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
phpbb_version: "3.3.15"
|
||||
phpbb_minor_version: "{{ phpbb_version | regex_replace('^([0-9])\\.([0-9]*).*', '\\1.\\2') }}"
|
||||
phpbb_major_version: "{{ phpbb_version | regex_replace('^([0-9])\\..*', '\\1') }}"
|
||||
|
||||
phpbb_url: "https://download.phpbb.com/pub/release/{{ phpbb_minor_version }}/{{ phpbb_version }}/phpBB-{{ phpbb_version }}.tar.bz2"
|
||||
phpbb_access_url: "{{ web_hostname | selectattr('type', 'defined') | selectattr('type', '==', 'phpbb') | map(attribute='host') | first }}"
|
||||
|
||||
# Access path
|
||||
phpbb_app_home: "/var/www/{{ phpbb_access_url }}"
|
||||
phpbb_data_home: "/srv/www-data/{{ phpbb_access_url }}"
|
||||
|
||||
phpbb_writable_app_dirs:
|
||||
- cache
|
||||
- store
|
||||
phpbb_userdata_app_dirs:
|
||||
- files
|
||||
- images
|
||||
|
||||
phpbb_styles:
|
||||
- name: black
|
||||
version: 3.3.12
|
||||
url: "https://github.com/cabot/black/archive/refs/tags/v%VERSION%.tar.gz"
|
||||
|
||||
|
||||
phpbb_languages:
|
||||
- name: fr
|
||||
version: 4.15.0
|
||||
url: "https://github.com/qiaeru/phpbb-language-fr/archive/refs/tags/v%VERSION%.tar.gz"
|
||||
|
||||
phpbb_exts:
|
||||
- name: externallink
|
||||
path: martin/externallinkinnewwindow
|
||||
version: 1.2.0
|
||||
url: "https://github.com/Mar-tin-G/ExternalLinkInNewWindow/archive/refs/tags/%VERSION%.tar.gz"
|
||||
- name: mediaembed
|
||||
path: phpbb/mediaembed
|
||||
version: 2.0.2
|
||||
url: "https://github.com/phpbb-extensions/mediaembed/archive/refs/tags/%VERSION%.tar.gz"
|
||||
extra_files:
|
||||
- src: files/mastodon.yml
|
||||
dest: collection/sites/mastodon.yml
|
||||
- src: files/dojopeertube.yml
|
||||
dest: collection/sites/dojopeertube.yml
|
Reference in New Issue
Block a user