diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml new file mode 100644 index 0000000..ec7373e --- /dev/null +++ b/roles/common/handlers/main.yml @@ -0,0 +1,2 @@ +- name: restart rsyslog + service: name=rsyslog state=restarted diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..818865f --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,64 @@ +--- +# This role installs packages that every Mastodon server needs and does common +# node setup +- name: This role installs packages that every Mastodon server needs and does common node setup + hosts: all + remote_user: root +- name: Install python-apt, aptitude, and debconf-utils + shell: apt-get update && apt-get -y install python-apt aptitude debconf-utils +- name: Do any package upgrades + apt: upgrade=dist +- name: Set default locale to en_US.UTF-8 + debconf: name=locales question='locales/default_environment_locale' value=en_US.UTF-8 vtype='select' +- name: Generate locales + debconf: name=locales question='locales/locales_to_be_generated' value='en_US.UTF-8 UTF-8' vtype='multiselect' +- name: Set timezone area + debconf: name=tzdata question='tzdata/Areas' value='Etc' vtype='select' +- name: Set timezone + debconf: name=tzdata question='tzdata/Zones/Etc' value='UTC' vtype='select' + notify: + - restart rsyslog +- name: Add Nodesource apt key + apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key state=present +- name: Add Nodesource apt repositories + apt_repository: repo={{item}} state=present + with_items: + - deb https://deb.nodesource.com/node_6.x xenial main + - deb-src https://deb.nodesource.com/node_6.x xenial main +- name: Add Yarnpkg apt key + apt_key: url=https://dl.yarnpkg.com/debian/pubkey.gpg state=present +- name: Add Yarnpkg apt repository + apt-repository: repo=deb https://dl.yarnpkg.com/debian/ stable main state=present +# Note that we don't install nginx, letsencrypt, postgresql and redis here, that will be in different roles +- name: Update apt cache and install various dependencies + apt: name={{item}} state=latest update_cache=yes + with_items: + - imagemagick + - ffmpeg + - libpq-dev + - libxml2-dev + - libxslt1-dev + - file + - git-core + - g++ + - libprotobuf-dev + - protobuf-compiler + - pkg-config + - nodejs + - gcc + - autoconf + - bison + - build-essential + - libssl-dev + - libyaml-dev + - libreadline6-dev + - zlib1g-dev + - libncurses5-dev + - libffi-dev + - libgdbm3 + - libgdbm-dev + - yarn + - libidn11-dev + - libicu-dev +- name: Add mastodon system user + user: name=mastodon state=present diff --git a/site.yml b/site.yml new file mode 100644 index 0000000..417a78d --- /dev/null +++ b/site.yml @@ -0,0 +1,5 @@ +--- +- name: Installs Mastodon on a Ubuntu 16.04 server + + roles: + - common