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
Karsten Hopp f81cdc
  dnf:
Karsten Hopp f81cdc
    name:
Karsten Hopp f81cdc
      - git
Karsten Hopp f81cdc
      - ngrep
Karsten Hopp f81cdc
      - nmap-ncat
Karsten Hopp f81cdc
      - python3-rpdb
Karsten Hopp f81cdc
      - tmux
Karsten Hopp f81cdc
      - tree
Karsten Hopp f81cdc
      - vim-enhanced
Karsten Hopp f81cdc
    state: present
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install Pagure development packages
Karsten Hopp f81cdc
  dnf:
Karsten Hopp f81cdc
    name:
Karsten Hopp f81cdc
      - gcc
Karsten Hopp f81cdc
      - libgit2-devel
Karsten Hopp f81cdc
      - libffi-devel
Karsten Hopp f81cdc
      - libjpeg-devel
Karsten Hopp f81cdc
      - make
Karsten Hopp f81cdc
      - python3-alembic
Karsten Hopp f81cdc
      - python3-arrow
Karsten Hopp f81cdc
      - python3-binaryornot
Karsten Hopp f81cdc
      - python3-bleach
Karsten Hopp f81cdc
      - python3-blinker
Karsten Hopp f81cdc
      - python3-chardet
Karsten Hopp f81cdc
      - python3-cryptography
Karsten Hopp f81cdc
      - python3-docutils
Karsten Hopp f81cdc
      - python3-enum34
Karsten Hopp f81cdc
      - python3-eventlet
Karsten Hopp f81cdc
      - python3-fedora-flask
Karsten Hopp f81cdc
      - python3-flask
Karsten Hopp f81cdc
      - python3-flask-wtf
Karsten Hopp f81cdc
      - python3-jinja2
Karsten Hopp f81cdc
      - python3-markdown
Karsten Hopp f81cdc
      - python3-munch
Karsten Hopp f81cdc
      - python3-openid-cla
Karsten Hopp f81cdc
      - python3-openid-teams
Karsten Hopp f81cdc
      - python3-pip
Karsten Hopp f81cdc
      - python3-psutil
Karsten Hopp f81cdc
      - python3-pygit2
Karsten Hopp f81cdc
      - python3-redis
Karsten Hopp f81cdc
      - python3-sqlalchemy
Karsten Hopp f81cdc
      - python3-straight-plugin
Karsten Hopp f81cdc
      - python3-virtualenvwrapper
Karsten Hopp f81cdc
      - python3-wtforms
Karsten Hopp f81cdc
      - python3-devel
Karsten Hopp f81cdc
      - python3-devel
Karsten Hopp f81cdc
      - redhat-rpm-config
Karsten Hopp f81cdc
      - python3-bcrypt
Karsten Hopp f81cdc
      - python3-virtualenv
Karsten Hopp f81cdc
    state: present
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
Karsten Hopp f81cdc
  args:
Karsten Hopp f81cdc
    warn: false
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
Lenka Segura a104f8
- name: Remove the motd duplicate
Lenka Segura a104f8
  pamd:
Lenka Segura a104f8
    name: sshd
Lenka Segura a104f8
    type: session
Lenka Segura a104f8
    control: optional
Lenka Segura a104f8
    module_path: pam_motd.so
Lenka Segura a104f8
    state: absent
Lenka Segura a104f8
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:
Karsten Hopp f81cdc
    name:
Karsten Hopp f81cdc
      - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*"
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
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:
Karsten Hopp f81cdc
    name:
Karsten Hopp f81cdc
      - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*"
Lenka Segura 9ca902
    virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/
Lenka Segura 9ca902
    virtualenv_python: python3
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"
Romain DEP 78b01c
    - "requirements-testing.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"
Romain DEP 78b01c
    - "requirements-testing.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
Karsten Hopp b92b8a
    name: "{{ item }}"
Clement Verna 215632
    enabled: True
Karsten Hopp b92b8a
    scope: user
Karsten Hopp b92b8a
  with_items:
Karsten Hopp b92b8a
    - pagure
Karsten Hopp b92b8a
    - pagure-docs
Karsten Hopp b92b8a
    - pagure_ci
Karsten Hopp b92b8a
    - pagure_ev
Karsten Hopp b92b8a
    - pagure_webhook
Karsten Hopp b92b8a
    - pagure_worker