Created
October 26, 2015 09:17
-
-
Save ostcar/a32a5c127f1ad404ff5c to your computer and use it in GitHub Desktop.
ansible playbook to install an openslides system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This script excepts an up to date archlinux system with installed python2, | |
# openssh and sudo and a user account with sudo permissions you can connect | |
# to. | |
- hosts: openslides | |
tasks: | |
- name: Install required packages and update package cache | |
pacman: | |
name: "{{ item }}" | |
with_items: | |
- python | |
- python-pip | |
- python-pillow | |
- python-reportlab | |
- git # Only needed for development version | |
- npm # Only needed for development version | |
become: yes | |
- name: Create user openslides | |
user: | |
name: openslides | |
become: yes | |
# TODO: Do not install from git, but from pypi when openslides is released | |
- name: Clone openslides master | |
git: | |
dest: ~openslides/openslides | |
repo: https://github.com/OpenSlides/OpenSlides.git | |
become: yes | |
become_user: openslides | |
# Only needed for development version | |
- name: Install required node modules | |
command: npm install | |
args: | |
chdir: ~openslides/openslides | |
creates: ~openslides/openslides/node_modules/.bin/bower | |
become: yes | |
become_user: openslides | |
# Only needed for development version | |
- name: Install required bower modules | |
command: ~openslides/openslides/node_modules/.bin/bower install | |
args: | |
chdir: ~openslides/openslides | |
creates: ~openslides/openslides/bower_components/ | |
become: yes | |
become_user: openslides | |
# Only needed for development version | |
- name: Run gulp | |
command: ~openslides/openslides/node_modules/.bin/gulp | |
args: | |
chdir: ~openslides/openslides | |
creates: ~openslides/openslides/openslides/static/js/openslides-libs.js | |
become: yes | |
become_user: openslides | |
- name: Install OpenSlides with python dependencies | |
pip: | |
name: ~openslides/openslides | |
become: yes | |
- name: Create Settings | |
command: openslides createsettings | |
args: | |
creates: ~openslides/.config/openslides/settings.py | |
become: yes | |
become_user: openslides | |
- name: Migrate Database | |
command: openslides migrate | |
args: | |
creates: ~openslides/.local/share/openslides/database.sqlite | |
become: yes | |
become_user: openslides | |
# The unit should be shipped with openslides | |
- name: Copy systemd-unit for openslides | |
copy: | |
dest: /usr/lib/systemd/system/openslides.service | |
content: | | |
[Unit] | |
Description=Presentation and assembly system | |
Wants=network.target | |
[Service] | |
ExecStart=/usr/bin/openslides runserver 0.0.0.0:8000 | |
User=openslides | |
[Install] | |
WantedBy=multi-user.target | |
become: yes | |
notify: | |
- Reload systemd units | |
- name: Start and enalbe openslides | |
service: | |
name: openslides | |
enabled: yes | |
state: started | |
become: yes | |
handlers: | |
- name: Reload systemd units | |
command: systemctl daemon-reload | |
become: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment