aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mediagoblin
diff options
context:
space:
mode:
Diffstat (limited to 'roles/mediagoblin')
-rw-r--r--roles/mediagoblin/defaults/main.yml5
-rw-r--r--roles/mediagoblin/tasks/main.yml88
-rw-r--r--roles/mediagoblin/tasks/mediagoblin.yml98
-rw-r--r--roles/mediagoblin/templates/mediagoblin_local.ini.j261
-rw-r--r--roles/mediagoblin/templates/paste_local.ini.j286
5 files changed, 249 insertions, 89 deletions
diff --git a/roles/mediagoblin/defaults/main.yml b/roles/mediagoblin/defaults/main.yml
index 9983bfb..381e5af 100644
--- a/roles/mediagoblin/defaults/main.yml
+++ b/roles/mediagoblin/defaults/main.yml
@@ -1,6 +1,7 @@
-mediagoblin_hotname: {{ ansible_nodename }}
+mediagoblin_hostname: "{{ ansible_nodename }}"
mediagoblin_basedir: /srv/mediagoblin
mediagoblin_user: mediagoblin
mediagoblin_git_uri: git://git.savannah.gnu.org/mediagoblin.git
-mediagoblin_git_tag: v0.9.0
+mediagoblin_git_ref: v0.9.0
+mediagoblin_email_sender: "mediagoblin@{{ mediagoblin_hostname }}"
diff --git a/roles/mediagoblin/tasks/main.yml b/roles/mediagoblin/tasks/main.yml
index a5ce476..69ae650 100644
--- a/roles/mediagoblin/tasks/main.yml
+++ b/roles/mediagoblin/tasks/main.yml
@@ -1,87 +1 @@
- name: Install mediagoblin dependencies
- apt: name={{item}} state=installed
- with_items:
- - python3-dev
- - python3-lxml
- - python3-imaging
- - python3-virtualenv
- - automake
- tags:
- - dependencies
-
-- name: Create mediagoblin user
- user: name={{ mediagoblin_user }}
- createhome=yes
- groups=www-data
- system=yes
- home=/var/lib/mediagoblin
- state=present
-
-- name: Create deploy directory
- file: name={{ mediagoblin_basedir }}
- state=directory
- owner={{ mediagoblin_user }}
-
-- name: Create user data directory
- file: name={{ mediagoblin_basedir }}/data
- state=directory
- chmod=0750
- owner={{ mediagoblin_user }}
-
-- name: Checkout git
- git: repo={{ mediagoblin_git_uri }}
- dest={{ mediagoblin_basedir }}/src
- tag={{ mediagoblin_git_tag }}
- accept_hostkey=yes
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-- name: git submodules
- shell:
- git submodule update --init --recursive
- chdir="{{mediagoblin_basedir}}/src"
- creates="{{mediagoblin_basedir}}/src/.gitmodules"
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-
-- name: Create virtualenv
- shell:
- virtualenv --python=python3 --system-site-packages .
- chdir="{{mediagoblin_basedir}}/src"
- creates="{{mediagoblin_basedir}}/src/bin/python"
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-- name: Build mediagoblin
- shell:
- ./bootstrap.sh && ./configure –with-python3 && make
- chdir="{{mediagoblin_basedir }}/src"
- creates="{{mediagoblin_basedir}}/src/mediagoblin.egg-info"
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-- name: Install flup
- easy_install:
- name=flup
- virtualenv="{{ mediagoblin_basedir }}"
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-- name: Update DB
- shell:
- ./bin/gmg dbupdate
- chdir="{{ mediagoblin_basedir }}/src"
- sudo: yes
- sudo_user: "{{ mediagoblin_user }}"
-
-- name: Copy generic mediagoblin nginx site configuration
- template: src=etc_nginx_sites-available_mediagoblin.j2
- dest=/etc/nginx/sites-available/mediagoblin
-
-- name: Create nginx symlink for default
- file: state=link
- src=/etc/nginx/sites-available/mediagoblin
- dest=/etc/nginx/sites-enabled/mediagoblin
- notify: nginx restart # reload not sufficient?
-
+- include: mediagoblin.yml tags=mediagoblin
diff --git a/roles/mediagoblin/tasks/mediagoblin.yml b/roles/mediagoblin/tasks/mediagoblin.yml
new file mode 100644
index 0000000..b7df031
--- /dev/null
+++ b/roles/mediagoblin/tasks/mediagoblin.yml
@@ -0,0 +1,98 @@
+- name: Install mediagoblin dependencies
+ apt: name={{item}} state=installed
+ with_items:
+ - python3-dev
+ - python3-lxml
+ - python3-pil
+ - python3-virtualenv
+ - python3-babel
+ - virtualenv
+ - automake
+ - npm # XXX: really? UGH
+ - nodejs-legacy
+ tags:
+ - dependencies
+
+- name: Create mediagoblin user
+ user: name={{ mediagoblin_user }}
+ createhome=yes
+ groups=www-data
+ system=yes
+ home=/var/lib/mediagoblin
+ state=present
+
+- name: Create mediagoblin base directory
+ file: name={{ mediagoblin_basedir }}
+ state=directory
+ owner={{ mediagoblin_user }}
+
+- name: Create user data directory
+ file: name={{ mediagoblin_basedir }}/data
+ state=directory
+ mode=0750
+ owner={{ mediagoblin_user }}
+
+- name: Checkout git
+ git: repo={{ mediagoblin_git_uri }}
+ dest={{ mediagoblin_basedir }}/src
+ version={{ mediagoblin_git_ref }}
+ recursive=yes
+ accept_hostkey=yes
+ sudo: yes
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Create mediagoblin user_dev directory
+ file: name={{ mediagoblin_basedir }}/src/user_dev
+ state=directory
+ owner={{ mediagoblin_user }}
+
+- name: Create virtualenv
+ shell:
+ virtualenv --python=python3 --system-site-packages .
+ chdir="{{mediagoblin_basedir}}/src"
+ creates="{{mediagoblin_basedir}}/src/bin/python"
+ sudo: yes
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Build mediagoblin
+ shell:
+ ./bootstrap.sh && ./configure -with-python3 && make
+ chdir="{{mediagoblin_basedir }}/src"
+ creates="{{mediagoblin_basedir}}/src/mediagoblin.egg-info"
+ sudo: yes
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Install flup in virtualenv
+ easy_install:
+ name=flup
+ virtualenv="{{ mediagoblin_basedir }}"/src
+ sudo: yes
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Update DB
+ shell:
+ ./bin/gmg dbupdate
+ chdir="{{ mediagoblin_basedir }}/src"
+ sudo: yes
+ sudo_user: "{{ mediagoblin_user }}"
+
+- name: Copy mediagoblin config
+ template: src=mediagoblin_local.ini.j2
+ dest=/srv/mediagoblin/src/mediagoblin_local.ini
+
+- name: Copy mediagoblin paste config
+ template: src=paste_local.ini.j2
+ dest=/srv/mediagoblin/src/paste_local.ini
+
+- name: Copy generic mediagoblin nginx site configuration
+ template: src=etc_nginx_sites-available_mediagoblin.j2
+ dest=/etc/nginx/sites-available/mediagoblin
+
+# XXX: TODO: how to create a systemd unit?
+
+- name: Create nginx symlink for default
+ file: state=link
+ src=/etc/nginx/sites-available/mediagoblin
+ dest=/etc/nginx/sites-enabled/mediagoblin
+ notify: nginx restart # reload not sufficient?
+
diff --git a/roles/mediagoblin/templates/mediagoblin_local.ini.j2 b/roles/mediagoblin/templates/mediagoblin_local.ini.j2
new file mode 100644
index 0000000..0b047f7
--- /dev/null
+++ b/roles/mediagoblin/templates/mediagoblin_local.ini.j2
@@ -0,0 +1,61 @@
+# If you want to make changes to this file, first copy it to
+# mediagoblin_local.ini, then make the changes there.
+#
+# If you don't see what you need here, have a look at mediagoblin/config_spec.ini
+# It defines types and defaults so it's a good place to look for documentation
+# or to find hidden options that we didn't tell you about. :)
+
+# To change the directory you should make sure you change the
+# directory in paste.ini and/or your webserver configuration.
+#
+# [DEFAULT]
+# data_basedir = "/var/lib/mediagoblin"
+
+[mediagoblin]
+direct_remote_path = /mgoblin_static/
+email_sender_address = "{{ mediagoblin_email_sender }}"
+
+## Uncomment and change to your DB's appropiate setting.
+## Default is a local sqlite db "mediagoblin.db".
+## Don't forget to run `./bin/gmg dbupdate` after having changed it.
+# sql_engine = postgresql:///mediagoblin
+
+# Set to false to enable sending notices
+email_debug_mode = true
+
+# Set to false to disable registrations
+allow_registration = false
+
+# Set to false to disable the ability for users to report offensive content
+allow_reporting = true
+
+## Uncomment this to put some user-overriding templates here
+# local_templates = %(data_basedir)s/templates/
+
+## You can set your theme by specifying this (not specifying it will
+## use the default theme). Run `gmg assetlink` to apply the change.
+## The airy and sandyseventiesspeedboat theme comes with GMG; please
+## see the theming docs on how to install other themes.
+# theme = airy
+
+## If you want the terms of service displayed, you can uncomment this
+# show_tos = true
+
+user_privilege_scheme = "uploader,commenter,reporter"
+[storage:queuestore]
+base_dir = %(data_basedir)s/media/queue
+
+[storage:publicstore]
+base_dir = %(data_basedir)s/media/public
+base_url = /mgoblin_media/
+
+[celery]
+# Put celery stuff here
+
+# Place plugins here, each in their own subsection of [plugins].
+# See http://docs.mediagoblin.org/siteadmin/plugins.html for details.
+[plugins]
+[[mediagoblin.plugins.geolocation]]
+[[mediagoblin.plugins.basic_auth]]
+[[mediagoblin.plugins.processing_info]]
+[[mediagoblin.media_types.image]]
diff --git a/roles/mediagoblin/templates/paste_local.ini.j2 b/roles/mediagoblin/templates/paste_local.ini.j2
new file mode 100644
index 0000000..08af880
--- /dev/null
+++ b/roles/mediagoblin/templates/paste_local.ini.j2
@@ -0,0 +1,86 @@
+# If you want to make changes to this file, first copy it to
+# paste_local.ini, then make the changes there.
+
+[DEFAULT]
+# Set to true to enable web-based debugging messages and etc.
+debug = false
+
+[pipeline:main]
+# pipeline = errors mediagoblin
+pipeline = mediagoblin
+
+[app:mediagoblin]
+use = egg:mediagoblin#app
+config = %(here)s/mediagoblin_local.ini %(here)s/mediagoblin.ini
+# static paths
+/mgoblin_media = {{ mediagoblin_basedir }}/data/media/public
+/mgoblin_static = %(here)s/mediagoblin/static
+/theme_static = %(here)s/user_dev/theme_static
+/plugin_static = %(here)s/user_dev/plugin_static
+
+[loggers]
+keys = root
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-7.7s [%(name)s] %(message)s
+
+[filter:errors]
+use = egg:mediagoblin#errors
+debug = false
+
+
+##############################
+# Server configuration options
+##############################
+
+# The server that is run by default.
+# By default, should only be accessable locally
+[server:main]
+use = egg:waitress#main
+host = 127.0.0.1
+port = 6543
+# # Gunicorn settings. See http://docs.gunicorn.org/en/19.0/settings.html
+# # for more information about configuring Gunicorn
+# proc_name = gmg
+# reload = true
+# accesslog = -
+
+#######################
+# Helper server configs
+# ---------------------
+# If you are configuring the paste config manually, you can remove
+# these.
+
+# Use this if you want to run on port 6543 and have MediaGoblin be
+# viewable externally
+[server:broadcast]
+use = egg:waitress#main
+host = 0.0.0.0
+port = 6543
+
+# Use this if you want to connect via fastcgi
+[server:fcgi]
+use = egg:flup#fcgi_fork
+host = %(fcgi_host)s
+port = %(fcgi_port)s
+
+[server:http]
+use = egg:waitress#main
+host = %(http_host)s
+port = %(http_port)s