- name: Workaround ansible switch between users file: path: "/tmp/ansible/" mode: 0777 state: directory - name: Install dependencies package: name: - redis - ejabberd #- gunicorn #- uwsgi-plugin-python - python-pip - python-virtualenv - ffmpeg #important v4 #- python-gevent-websocket - base-devel - yay - name: Create AUR User for build user: name: aur_builder - name: Add sudo permission to aur user lineinfile: path: /etc/sudoers.d/11-install-aur_builder line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman' create: yes validate: 'visudo -cf %s' - name: Install nginx with rtmp become: yes become_user: aur_builder aur: name: nginx-rtmp-sergey-git - name: Configure redis notify: restart redis lineinfile: path: /etc/redis.conf regexp: '^appendfsync' line: "appendfsync no" - name: Start redis systemd: name: redis state: started enabled: yes - name: Configure ejabberd notify: restart ejabberd template: src: ejabberd.yml dest: /etc/ejabberd/ejabberd.yml - name: Start ejabberd systemd: name: ejabberd state: started enabled: yes - name: Check if ejabberd account exists become: yes become_user: jabber command: ejabberdctl check_account admin localhost register: jabber_admin changed_when: False failed_when: 'jabber_admin.rc >= 2' - name: Register ejabberd Adminuser become: yes become_user: jabber when: jabber_admin.rc == 1 command: ejabberdctl register admin localhost "{{ osp_ejabberd_password }}" - name: Set password of ejabber admin become: yes become_user: jabber when: jabber_admin.rc == 0 command: ejabberdctl change_password admin localhost "{{ osp_ejabberd_password }}" - name: Configure NGINX notify: reload nginx template: src: "{{ item }}" dest: "/etc/nginx/{{ item }}" loop: - nginx.conf - osp-rtmp.conf - osp-socketio.conf - osp-redirects.conf - name: Create www directory file: path: "{{osp_http_path }}/{{item}}" owner: http group: http state: directory loop: - . - live - videos - live-rec - images - live-adapt - stream-thumb - name: Nginx systemd: name: nginx state: started enabled: yes - name: Clone OSP repository git: repo: "{{ osp_git_root }}" dest: "/var/lib/osp/" version: "{{ osp_git_commit }}" - name: Install python requirements pip: requirements: /var/lib/osp/setup/requirements.txt virtualenv: /opt/osp-venv - name: Create cache directory file: path: /var/cache/osp owner: http group: http state: directory - name: Create logging directory file: path: /var/log/osp owner: http group: http state: directory - name: Configure osp notify: restart osp template: src: "config.py.dist" dest: "/etc/osp.conf" - name: Configure supply notify: restart osp file: src: "/etc/osp.conf" dest: "/var/lib/osp/conf/config.py" state: link - name: Permissions for database file: path: "/var/lib/osp/{{ item }}" owner: http group: http recurse: yes loop: - db - migrations - name: Init Database become: yes become_user: http command: python3 manage.py db init args: chdir: /var/lib/osp/ creates: /var/lib/osp/db/database.db - name: Install services files and workers notify: restart osp template: src: "{{item}}" dest: "/etc/systemd/system/{{item}}" loop: - osp-worker@.service - osp.target - name: Start OSP systemd: name: osp.target state: started enabled: yes