Changeset - b78c1bbbcbba
[Not reviewed]
1 2 0
Branko Majic (branko) - 4 years ago 2020-10-02 22:23:54
branko@majic.rs
MAR-159: Drop the use futures_version and gunicorn_version parameters from the wsgi_website role:

- Remove related tasks, Gunicorn/Futures should instead be installed
via the requirements file instead.
- Restructure tasks, moving them from the requirements.yml into
main.yml.
- Small typo fix for one of the variables.
3 files changed with 29 insertions and 68 deletions:
0 comments (0 inline, 0 general)
roles/wsgi_website/defaults/main.yml
Show inline comments
 
@@ -8,8 +8,6 @@ static_locations: []
 
use_paste: false
 
virtualenv_packages: []
 
environment_variables: {}
 
gunicorn_version: "19.9.0"
 
futures_version: "3.2.0"
 
website_mail_recipients: "root"
 
environment_indicator: null
 
proxy_headers: {}
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -165,41 +165,44 @@
 
    group: "{{ user }}"
 
    mode: 0750
 

	
 
- name: Install WSGI server
 
  become: true
 
  become_user: "{{ admin }}"
 
  pip:
 
    name: "{{ item.package }}"
 
    version: "{{ item.version }}"
 
    state: present
 
    virtualenv: "{{ home }}/virtualenv"
 
- name: Set-up directory for storing requirements file for upgrade checks
 
  file:
 
    path: "/etc/pip_check_requirements_upgrades/{{ fqdn }}"
 
    state: directory
 
    owner: root
 
    group: pipreqcheck
 
    mode: 0750
 

	
 
- name: Deploy WSGI requirements files for upgrade checks
 
  template:
 
    src: "{{ item }}.j2"
 
    dest: "/etc/pip_check_requirements_upgrades/{{ fqdn }}/{{ item }}"
 
    owner: root
 
    group: pipreqcheck
 
    mode: 0640
 
  with_items:
 
    - package: gunicorn
 
      version: "{{ gunicorn_version }}"
 
  when: wsgi_requirements | length == 0
 
  register: install_wsgi_server
 
  notify:
 
    - Restart WSGI services
 
    - wsgi_requirements.in
 
    - wsgi_requirements.txt
 

	
 
- name: Install futures Python 2 backport (for WSGI server)
 
- name: Deploy Gunicorn requirements file for installation purposes
 
  template:
 
    src: "wsgi_requirements.txt.j2"
 
    dest: "{{ home }}/.wsgi_requirements.txt"
 
    owner: "{{ admin }}"
 
    group: "{{ user }}"
 
    mode: 0640
 

	
 
- name: Install Gunicorn via requirements file
 
  become: true
 
  become_user: "{{ admin }}"
 
  pip:
 
    name: "{{ item.package }}"
 
    version: "{{ item.version }}"
 
    requirements: "{{ home }}/.wsgi_requirements.txt"
 
    state: present
 
    virtualenv: "{{ home }}/virtualenv"
 
  with_items:
 
    - package: futures
 
      version: "{{ futures_version }}"
 
  when: wsgi_requirements | length == 0
 
  register: install_wsgi_server
 
  register: install_gunicorn_via_requirements
 
  notify:
 
    - Restart WSGI services
 

	
 
- include: requirements.yml
 
  when: wsgi_requirements | length > 0
 

	
 
- name: Install additional packages in Python virtual environment
 
  become: true
 
  become_user: "{{ admin }}"
 
@@ -310,11 +313,10 @@
 
  when: |
 
    fqdn not in wsgi_services_to_restart and
 
    ((install_extra_packages is defined and install_extra_packages.changed) or
 
    (install_wsgi_server is defined and install_wsgi_server.changed) or
 
    (install_additional_packages_in_virtualenv is defined and install_additional_packages_in_virtualenv.changed) or
 
    (deploy_systemd_socket_configuration is defined and deploy_systemd_socket_configuration.changed) or
 
    (deploy_systemd_service_configuration is defined and deploy_systemd_service_configuration.changed) or
 
    (install_gunciron_via_requirements is defined and install_gunciron_via_requirements.changed) or
 
    (install_gunicorn_via_requirements is defined and install_gunicorn_via_requirements.changed) or
 
    (run_handlers | default(False) | bool()))
 
  tags:
 
    - handlers
roles/wsgi_website/tasks/requirements.yml
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)