Changeset - ed37f9854bfb
[Not reviewed]
0 3 0
Branko Majic (branko) - 9 years ago 2015-09-01 23:13:35
branko@majic.rs
MAR-19: Simplified the WSGI website role by making a number of parameters optional.
3 files changed with 10 insertions and 7 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -1140,7 +1140,7 @@ The role is implemented with the following layout/logic in mind:
 
Parameters
 
~~~~~~~~~~
 

	
 
**admin** (string, mandatory)
 
**admin** (string, optional, ``web-{{ fqdn | replace('.', '_') }}``)
 
  Name of the operating system user in charge of maintaining the website. This
 
  user is capable of making modifications to website configuration anda data
 
  stored within the website directory.
 
@@ -1150,11 +1150,11 @@ Parameters
 
  for calculating the user/group name for dedicated website user, as well as
 
  home directory of the website user (where data/code should be stored at).
 

	
 
**https_tls_certificate** (string, mandatory)
 
**https_tls_certificate** (string, optional, ``{{ tls_certificate_dir }}/{{ fqdn }}_https.pem``)
 
  Path to file on Ansible host that contains the X.509 certificate used for TLS
 
  for HTTPS service. The file will be copied to directory ``/etc/ssl/certs/``.
 

	
 
**https_tls_key** (string, mandatory)
 
**https_tls_key** (string, optional, ``{{ tls_private_key_dir }}/{{ fqdn }}_https.key``)
 
  Path to file on Ansible host that contains the private key used for TLS for
 
  HTTPS service. The file will be copied to directory ``/etc/ssl/private/``.
 

	
 
@@ -1175,7 +1175,7 @@ Parameters
 
  static/media files by Nginx (for example, in case of Django projects for
 
  ``/static/`` and ``/media/``).
 

	
 
**uid** (integer, mandatory)
 
**uid** (integer, optional, ``whatever OS picks``)
 
  UID/GID (they are set-up to be the same) of the dedicated website
 
  user/group.
 

	
roles/wsgi_website/defaults/main.yml
Show inline comments
 
@@ -4,4 +4,7 @@ packages: []
 
rewrites: []
 
static_locations: []
 
use_paste: False
 
virtualenv_packages: []
 
\ No newline at end of file
 
virtualenv_packages: []
 
admin: "web-{{ fqdn | replace('.', '_') }}"
 
https_tls_certificate: "{{ tls_certificate_dir }}/{{ fqdn }}_https.pem"
 
https_tls_key: "{{ tls_private_key_dir }}/{{ fqdn }}_https.key"
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -5,14 +5,14 @@
 
    home: "/var/www/{{ fqdn }}"
 

	
 
- name: Create WSGI website group
 
  group: name="{{ user }}" gid="{{ uid }}" state=present
 
  group: name="{{ user }}" gid="{{ uid | default(omit) }}" state=present
 

	
 
- name: Create home directory for the user (avoid populating with skeleton)
 
  file: path="{{ home }}" state=directory
 
        owner="{{ admin }}" group="{{ user }}" mode=2750
 

	
 
- name: Create WSGI website user
 
  user: name="{{ user }}" uid="{{ uid }}" group="{{ user }}"
 
  user: name="{{ user }}" uid="{{ uid | default(omit) }}" group="{{ user }}"
 
        system=yes createhome=no state=present
 

	
 
- name: Add nginx user to website group
0 comments (0 inline, 0 general)