aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/mw-backend/tasks/main.yml21
-rw-r--r--ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2154
-rw-r--r--ansible/roles/mw-frontend/tasks/main.yml8
3 files changed, 183 insertions, 0 deletions
diff --git a/ansible/roles/mw-backend/tasks/main.yml b/ansible/roles/mw-backend/tasks/main.yml
index a60f08d..e3a0264 100644
--- a/ansible/roles/mw-backend/tasks/main.yml
+++ b/ansible/roles/mw-backend/tasks/main.yml
@@ -64,3 +64,24 @@
copy:
src: etc/apache2/sites-enabled/000-default.conf
dest: /etc/apache2/sites-enabled/000-default.conf
+ - name: mediawiki config
+ template:
+ src: etc/mediawiki/LocalSettings.php.j2
+ dest: /etc/mediawiki/LocalSettings.php
+# - name: directories
+# file:
+# state: directory
+# path: "{{ item }}"
+# owner: root
+# group: root
+# with_items:
+# - /opt/mediawiki
+# - /opt/mediawiki/images
+# - name: www-data owned directories
+# file:
+# state: directory
+# path: "{{ item }}"
+# owner: www-data
+# group: www-data
+# with_items:
+# - /opt/mediawiki/images/deleted
diff --git a/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2 b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
new file mode 100644
index 0000000..10e3796
--- /dev/null
+++ b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
@@ -0,0 +1,154 @@
+<?php
+# This file was automatically generated by the MediaWiki 1.27.4
+# installer. If you make manual changes, please keep track in case you
+# need to recreate them later.
+#
+# See includes/DefaultSettings.php for all configurable settings
+# and their default values, but don't forget to make changes in _this_
+# file, not there.
+#
+# Further documentation for configuration settings may be found at:
+# https://www.mediawiki.org/wiki/Manual:Configuration_settings
+
+# Protect against web entry
+if ( !defined( 'MEDIAWIKI' ) ) {
+ exit;
+}
+
+## Uncomment this to disable output compression
+# $wgDisableOutputCompression = true;
+
+$wgSitename = "Trygvis's notes to self";
+$wgMetaNamespace = "Project";
+
+## The URL base path to the directory containing the wiki;
+## defaults for all runtime URL paths are based off of this.
+## For more information on customizing the URLs
+## (like /w/index.php/Page_title to /wiki/Page_title) please see:
+## https://www.mediawiki.org/wiki/Manual:Short_URL
+$wgScriptPath = "";
+
+## The protocol and server name to use in fully-qualified URLs
+$wgServer = "http://mw.trygvis.io";
+
+## The URL path to static resources (images, scripts, etc.)
+$wgResourceBasePath = $wgScriptPath;
+
+## The URL path to the logo. Make sure you change this from the default,
+## or else you'll overwrite your logo when you upgrade!
+$wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
+
+## UPO means: this is also a user preference option
+
+$wgEnableEmail = true;
+$wgEnableUserEmail = true; # UPO
+
+$wgEmergencyContact = "postmaster@trygvis.io";
+$wgPasswordSender = "postmaster@trygvis.io";
+
+$wgEnotifUserTalk = true; # UPO
+$wgEnotifWatchlist = true; # UPO
+$wgEmailAuthentication = true;
+
+## Database settings
+$wgDBtype = "postgres";
+$wgDBserver = "10.0.3.1";
+$wgDBname = "mediawiki";
+$wgDBuser = "mediawiki";
+$wgDBpassword = "{{ mediawiki_secrets.mediawiki_password }}";
+
+# Postgres specific settings
+$wgDBport = "5432";
+$wgDBmwschema = "public";
+
+## Shared memory settings
+$wgMainCacheType = CACHE_ACCEL;
+$wgMemCachedServers = [];
+
+## To enable image uploads, make sure the 'images' directory
+## is writable, then set this to true:
+$wgEnableUploads = true;
+#$wgUseImageMagick = true;
+#$wgImageMagickConvertCommand = "/usr/bin/convert";
+
+# InstantCommons allows wiki to use images from https://commons.wikimedia.org
+$wgUseInstantCommons = true;
+
+## If you use ImageMagick (or any other shell command) on a
+## Linux server, this will need to be set to the name of an
+## available UTF-8 locale
+$wgShellLocale = "en_US.utf8";
+
+## Set $wgCacheDirectory to a writable directory on the web server
+## to make your wiki go slightly faster. The directory should not
+## be publically accessible from the web.
+#$wgCacheDirectory = "$IP/cache";
+
+# Site language code, should be one of the list in ./languages/data/Names.php
+$wgLanguageCode = "en";
+
+$wgSecretKey = "275b35aba77711c862ef77f85fd4f5e6c98133edead6af6e5374fee7cba8f0df";
+
+# Changing this will log out all existing sessions.
+$wgAuthenticationTokenVersion = "1";
+
+# Site upgrade key. Must be set to a string (default provided) to turn on the
+# web installer while LocalSettings.php is in place
+$wgUpgradeKey = "4eb6000bab511b23";
+
+## For attaching licensing metadata to pages, and displaying an
+## appropriate copyright notice / icon. GNU Free Documentation
+## License and Creative Commons licenses are supported so far.
+$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
+$wgRightsUrl = "https://creativecommons.org/publicdomain/zero/1.0/";
+$wgRightsText = "Creative Commons Zero (Public Domain)";
+$wgRightsIcon = "$wgResourceBasePath/resources/assets/licenses/cc-0.png";
+
+# Path to the GNU diff3 utility. Used for conflict resolution.
+$wgDiff3 = "/usr/bin/diff3";
+
+# The following permissions were set based on your choice in the installer
+$wgGroupPermissions['*']['createaccount'] = false;
+$wgGroupPermissions['*']['edit'] = false;
+
+## Default skin: you can change the default skin. Use the internal symbolic
+## names, ie 'vector', 'monobook':
+$wgDefaultSkin = "vector";
+
+# Enabled skins.
+# The following skins were automatically enabled:
+wfLoadSkin( 'CologneBlue' );
+wfLoadSkin( 'Modern' );
+wfLoadSkin( 'MonoBook' );
+wfLoadSkin( 'Vector' );
+
+
+# Enabled extensions. Most of the extensions are enabled by adding
+# wfLoadExtensions('ExtensionName');
+# to LocalSettings.php. Check specific extension documentation for more details.
+# The following extensions were automatically enabled:
+wfLoadExtension( 'Cite' );
+
+
+# End of automatically generated settings.
+# Add more configuration options below.
+
+# Debian specific generated settings
+# Use system mimetypes
+$wgMimeTypeFile = '/etc/mime.types';
+# Load legacy extensions
+if ( is_file( "/etc/mediawiki-extensions/extensions.php" ) ) {
+ include "/etc/mediawiki-extensions/extensions.php";
+}
+# Add a "powered by Debian" footer icon
+$wgFooterIcons['poweredby']['debian'] = [
+ "src" => "/resources/assets/debian/poweredby_debian_1x.png",
+ "url" => "https://www.debian.org/",
+ "alt" => "Powered by Debian",
+ "srcset" =>
+ "/resources/assets/debian/poweredby_debian_1_5x.png 1.5x, " .
+ "/resources/assets/debian/poweredby_debian_2x.png 2x",
+];
+# End Debian specific generated settings
+# Add more configuration options below.
+
diff --git a/ansible/roles/mw-frontend/tasks/main.yml b/ansible/roles/mw-frontend/tasks/main.yml
index ee54719..c9ca1c0 100644
--- a/ansible/roles/mw-frontend/tasks/main.yml
+++ b/ansible/roles/mw-frontend/tasks/main.yml
@@ -29,3 +29,11 @@
postgresql_db:
name: "mediawiki"
encoding: "utf-8"
+ - postgresql_privs:
+ database: mediawiki
+ state: present
+ privs: USAGE
+ type: schema
+ objs: public
+ roles: mediawiki
+