Blame dev/ansible/roles/pagure-dev/tasks/main.yml

Jeremy Cline 4e3668
---
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- include: clamav.yml
Jeremy Cline 4e3668
- include: eventsource.yml
Jeremy Cline 4e3668
- include: gitolite.yml
Jeremy Cline 4e3668
- include: milter.yml
Jeremy Cline 4e3668
- include: postgres.yml
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install helpful development packages
Jeremy Cline 4e3668
  dnf: name={{ item }} state=present
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - git
Jeremy Cline 4e3668
    - ngrep
Jeremy Cline 4e3668
    - nmap-ncat
Akanksha 4d6eb3
    - python3-rpdb
Jeremy Cline 4e3668
    - tmux
Jeremy Cline 4e3668
    - tree
Jeremy Cline 4e3668
    - vim-enhanced
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install Pagure development packages
Jeremy Cline 4e3668
  dnf: name={{ item }} state=present
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - gcc
Jeremy Cline 4e3668
    - libgit2-devel
Jeremy Cline 4e3668
    - libffi-devel
Jeremy Cline 4e3668
    - libjpeg-devel
Jeremy Cline 4e3668
    - make
Akanksha 4d6eb3
    - python3-alembic
Akanksha 4d6eb3
    - python3-arrow
Akanksha 4d6eb3
    - python3-binaryornot
Akanksha 4d6eb3
    - python3-bleach
Akanksha 4d6eb3
    - python3-blinker
Akanksha 4d6eb3
    - python3-chardet
Akanksha 4d6eb3
    - python3-cryptography
Akanksha 4d6eb3
    - python3-docutils
Akanksha 4d6eb3
    - python3-enum34
Akanksha 4d6eb3
    - python3-eventlet
Akanksha 4d6eb3
    - python3-fedora-flask
Akanksha 4d6eb3
    - python3-flask
Akanksha 4d6eb3
    - python3-flask-wtf
Akanksha 4d6eb3
    - python3-jinja2
Akanksha 4d6eb3
    - python3-markdown
Akanksha 4d6eb3
    - python3-munch
Akanksha 4d6eb3
    - python3-openid-cla
Akanksha 4d6eb3
    - python3-openid-teams
Akanksha 4d6eb3
    - python3-pip
Akanksha 4d6eb3
    - python3-psutil
Akanksha 4d6eb3
    - python3-pygit2
Akanksha 4d6eb3
    - python3-redis
Akanksha 4d6eb3
    - python3-sqlalchemy
Akanksha 4d6eb3
    - python3-straight-plugin
Akanksha 4d6eb3
    - python3-virtualenvwrapper
Akanksha 4d6eb3
    - python3-wtforms
Akanksha 4d6eb3
    - python3-devel
Jeremy Cline 4e3668
    - python3-devel
Jeremy Cline 4e3668
    - redhat-rpm-config
Akanksha 4d6eb3
    - python3-bcrypt
Akanksha 4d6eb3
    - python3-virtualenv
Jeremy Cline 4e3668
Pierre-Yves Chibon 89f923
- name: register the libgit2 version installed
Pierre-Yves Chibon 89f923
  shell: rpm -q libgit2|cut -d \- -f 2| cut -d \. -f 1,2
Pierre-Yves Chibon 89f923
  register: libgit2_version
Pierre-Yves Chibon 89f923
Jeremy Cline 4e3668
# Add various helpful configuration files
Jeremy Cline 4e3668
- name: Install a custom bashrc
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  copy: src=bashrc dest=/home/{{ ansible_env.SUDO_USER }}/.bashrc
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install the message of the day
Jeremy Cline 4e3668
  copy: src=motd dest=/etc/motd
Jeremy Cline 4e3668
Karsten Hopp 5a9bf7
- name: populate bash history
Karsten Hopp 5a9bf7
  become_user: "{{ ansible_env.SUDO_USER }}"
Karsten Hopp 5a9bf7
  copy: src=bash_history dest=/home/{{ ansible_env.SUDO_USER }}/.bash_history
Jeremy Cline 4e3668
Jeremy Cline 4e3668
# Install Pagure inside a virtualenv and configure it
Pierre-Yves Chibon 89f923
- name: Install pygit2 in the virtualenv
Pierre-Yves Chibon 89f923
  become_user: "{{ ansible_env.SUDO_USER }}"
Pierre-Yves Chibon 89f923
  pip:
Pierre-Yves Chibon 89f923
    name: "{{ item }}"
Akanksha 4d6eb3
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Akanksha 4d6eb3
    virtualenv_python: python3
Akanksha 4d6eb3
    virtualenv_command: virtualenv-3
Pierre-Yves Chibon 89f923
  with_items:
Pierre-Yves Chibon 89f923
    - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*"
Pierre-Yves Chibon 89f923
Lenka Segura 9ca902
# Install Pagure inside a virtualenv and configure it for python3
Lenka Segura 9ca902
- name: Install pygit2 in the python3 virtualenv
Lenka Segura 9ca902
  become_user: "{{ ansible_env.SUDO_USER }}"
Lenka Segura 9ca902
  pip:
Lenka Segura 9ca902
    name: "{{ item }}"
Lenka Segura 9ca902
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Lenka Segura 9ca902
    virtualenv_python: python3
Lenka Segura 9ca902
  with_items:
Lenka Segura 9ca902
    - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*"
Lenka Segura 9ca902
Jeremy Cline 4e3668
- name: Install Pagure Python dependencies into a virtualenv
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  pip:
Jeremy Cline 4e3668
    requirements: /home/{{ ansible_env.SUDO_USER }}/devel/{{ item }}
Akanksha 4d6eb3
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Akanksha 4d6eb3
    virtualenv_command: virtualenv-3
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - "requirements.txt"
Lenka Segura 9ca902
    - "requirements-ev.txt"
Lenka Segura 9ca902
    - "tests_requirements.txt"
Lenka Segura 9ca902
Lenka Segura 9ca902
- name: Install Pagure Python dependencies into a python3 virtualenv
Lenka Segura 9ca902
  become_user: "{{ ansible_env.SUDO_USER }}"
Lenka Segura 9ca902
  pip:
Lenka Segura 9ca902
    requirements: /home/{{ ansible_env.SUDO_USER }}/devel/{{ item }}
Lenka Segura 9ca902
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Lenka Segura 9ca902
    virtualenv_python: python3
Lenka Segura 9ca902
  with_items:
Lenka Segura 9ca902
    - "requirements.txt"
Ryan Lerch 8a0299
    - "requirements-ev.txt"
Jeremy Cline 4e3668
    - "tests_requirements.txt"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install Pagure package into a virtualenv
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  pip:
Jeremy Cline 4e3668
    name: /home/{{ ansible_env.SUDO_USER }}/devel/
Jeremy Cline 4e3668
    extra_args: '-e'
Akanksha 4d6eb3
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Akanksha 4d6eb3
    virtualenv_command: virtualenv-3
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install Pagure package into /usr/lib
Jeremy Cline 4e3668
  pip:
Jeremy Cline 4e3668
    name: /home/{{ ansible_env.SUDO_USER }}/devel/
Jeremy Cline 4e3668
    extra_args: '-e'
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install the pagure configuration
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  copy: src=pagure.cfg dest=/home/{{ ansible_env.SUDO_USER }}/pagure.cfg
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Creates pagure data directories
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  file: path=/home/{{ ansible_env.SUDO_USER }}/pagure_data/{{ item }} state=directory
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - forks
Jeremy Cline 4e3668
    - docs
Jeremy Cline 4e3668
    - tickets
Jeremy Cline 4e3668
    - requests
Jeremy Cline 4e3668
    - remotes
Ryan Lerch 43dcfd
    - repos
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Add a working copy of alembic.ini
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  copy:
Jeremy Cline 4e3668
    src: /home/{{ ansible_env.SUDO_USER }}/devel/files/alembic.ini
Jeremy Cline 4e3668
    dest: /home/{{ ansible_env.SUDO_USER }}/alembic.ini
Jeremy Cline 4e3668
    remote_src: True
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Configure alembic to use our development database
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  replace:
Jeremy Cline 4e3668
    dest: /home/{{ ansible_env.SUDO_USER }}/alembic.ini
Jeremy Cline 4e3668
    regexp: "sqlalchemy.url = sqlite:////var/tmp/pagure_dev.sqlite"
Jeremy Cline 4e3668
    replace: "sqlalchemy.url = sqlite:////home/{{ ansible_env.SUDO_USER }}/pagure_data/pagure_dev.sqlite"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Configure alembic to point to the pagure migration folder
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  replace:
Jeremy Cline 4e3668
    dest: /home/{{ ansible_env.SUDO_USER }}/alembic.ini
Jeremy Cline 4e3668
    regexp: "script_location = /usr/share/pagure/alembic"
Jeremy Cline 4e3668
    replace: "script_location = /home/vagrant/devel/alembic/"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Create the Pagure database
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Akanksha 4d6eb3
  command: .virtualenvs/python3-pagure/bin/python devel/createdb.py
Jeremy Cline 4e3668
  args:
Jeremy Cline 4e3668
    creates: /home/{{ ansible_env.SUDO_USER }}/pagure_data/pagure_dev.sqlite
Jeremy Cline 4e3668
    chdir: "/home/{{ ansible_env.SUDO_USER }}/"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Stamp the database with its current migration
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Akanksha 4d6eb3
  shell: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/bin/alembic stamp $(/home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/bin/alembic heads | awk '{ print $1 }')
Jeremy Cline 4e3668
  args:
Jeremy Cline 4e3668
    chdir: "/home/{{ ansible_env.SUDO_USER }}/"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Create systemd user unit directory
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  file:
Jeremy Cline 4e3668
    path: /home/{{ ansible_env.SUDO_USER }}/.config/systemd/user/
Jeremy Cline 4e3668
    state: directory
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install the Pagure service files for systemd
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  copy:
Jeremy Cline 4e3668
    src: "{{ item }}"
Jeremy Cline 4e3668
    dest: /home/{{ ansible_env.SUDO_USER }}/.config/systemd/user/{{ item }}
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - pagure.service
Jeremy Cline 4e3668
    - pagure-docs.service
Jeremy Cline c82c27
    - pagure_ci.service
Jeremy Cline c82c27
    - pagure_ev.service
Jeremy Cline c82c27
    - pagure_webhook.service
Clement Verna 215632
    - pagure_worker.service
Clement Verna 215632
Clement Verna 215632
- name: Enable the Pagure systemd services
Clement Verna 215632
  become: False
Clement Verna 215632
  systemd:
Ryan Lerch 8a0299
    daemon_reload: yes
Clement Verna 215632
    name: "{{ item }}"
Clement Verna 215632
    enabled: True
Clement Verna 215632
    user: yes
Clement Verna 215632
  with_items:
Clement Verna 215632
    - pagure
Clement Verna 215632
    - pagure-docs
Clement Verna 215632
    - pagure_ci
Clement Verna 215632
    - pagure_ev
Clement Verna 215632
    - pagure_webhook
Clement Verna 215632
    - pagure_worker