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
Jeremy Cline 4e3668
    - python-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
Jeremy Cline 4e3668
    - python-alembic
Jeremy Cline 4e3668
    - python-arrow
Jeremy Cline 4e3668
    - python-binaryornot
Jeremy Cline 4e3668
    - python-bleach
Jeremy Cline 4e3668
    - python-blinker
Jeremy Cline 4e3668
    - python-chardet
Jeremy Cline 4e3668
    - python-cryptography
Jeremy Cline 4e3668
    - python-docutils
Jeremy Cline 4e3668
    - python-enum34
Pierre-Yves Chibon c852fa
    - python2-eventlet
Jeremy Cline 4e3668
    - python-fedora-flask
Jeremy Cline 4e3668
    - python-flask
Jeremy Cline 4e3668
    - python-flask-wtf
Jeremy Cline 4e3668
    - python-flask-multistatic
Jeremy Cline 4e3668
    - python2-jinja2
Jeremy Cline 4e3668
    - python-markdown
Jeremy Cline 4e3668
    - python-munch
Jeremy Cline 4e3668
    - python-openid-cla
Jeremy Cline 4e3668
    - python-openid-teams
Jeremy Cline 4e3668
    - python-pip
Jeremy Cline 4e3668
    - python-psutil
Jeremy Cline 4e3668
    - python-pygit2
Jeremy Cline 4e3668
    - python-redis
Jeremy Cline 4e3668
    - python-sqlalchemy
Jeremy Cline 4e3668
    - python-straight-plugin
Jeremy Cline 4e3668
    - python-virtualenvwrapper
Jeremy Cline 4e3668
    - python-wtforms
Jeremy Cline 4e3668
    - python-devel
Jeremy Cline 4e3668
    - python3-devel
Jeremy Cline 4e3668
    - redhat-rpm-config
Chenxiong Qi 7676b7
    - python2-bcrypt
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 }}"
Pierre-Yves Chibon 89f923
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python2-pagure/
Pierre-Yves Chibon 89f923
    virtualenv_python: python2
Pierre-Yves Chibon 89f923
  with_items:
Pierre-Yves Chibon 89f923
    - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*"
Pierre-Yves Chibon 89f923
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 }}
Jeremy Cline 4e3668
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python2-pagure/
Jeremy Cline 4e3668
    virtualenv_python: python2
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
    - "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'
Jeremy Cline 4e3668
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python2-pagure/
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
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Link the pagure repos directory to gitolite
Jeremy Cline 4e3668
  become_user: "{{ ansible_env.SUDO_USER }}"
Jeremy Cline 4e3668
  file:
Jeremy Cline 4e3668
    path: /home/{{ ansible_env.SUDO_USER }}/pagure_data/repos
Jeremy Cline 4e3668
    src: /home/{{ ansible_env.SUDO_USER }}/repositories
Jeremy Cline 4e3668
    state: link
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 }}"
Jeremy Cline 4e3668
  command: .virtualenvs/python2-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 }}"
Jeremy Cline 4e3668
  shell: alembic stamp $(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