Changeset - 9fa438ee34c0
[Not reviewed]
0 4 2
Branko Majic (branko) - 9 years ago 2015-05-29 18:08:54
branko@majic.rs
MAR-5: Added another example to role reference for running PHP websites. Allow duplicates of roles php_website and wsgi_website. Use parameter in handler for restarting WSGI website (to have them website-specific). Updated test site to force handler execution in order to avoid being in undefined state.
6 files changed with 21 insertions and 7 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -994,13 +994,11 @@ Parameters
 
Examples
 
~~~~~~~~
 

	
 
Here is an example configuration for setting-up a (base) PHP website (for running
 
``ownCloud`` application):
 
Here is an example configuration for setting-up two (base) PHP websites (for
 
running *ownCloud* and *The Bug Genie* applications):
 

	
 
.. code-block:: yaml
 

	
 
    ---
 

	
 
    - role: php_website
 
      fqdn: cloud.example.com
 
      uid: 2001
 
@@ -1022,6 +1020,15 @@ Here is an example configuration for setting-up a (base) PHP website (for runnin
 
        - php5-json
 
        - php5-mysql
 
        - php5-curl
 
    - role: php_website
 
      admin: admin
 
      deny_files_regex:
 
        - ^\..*
 
      php_rewrite_urls:
 
        - ^(.*) /index.php?url=$1
 
      fqdn: tbg.example.com
 
      uid: 2007
 

	
 

	
 

	
 
WSGI Website
roles/php_website/meta/main.yml
Show inline comments
 
new file 100644
 
---
 

	
 
allow_duplicates: yes
 
\ No newline at end of file
roles/wsgi_website/handlers/main.yml
Show inline comments
 
---
 

	
 
- name: Restart website
 
- name: "Restart website {{ fqdn }}"
 
  service: name="{{ fqdn }}" state=restarted
roles/wsgi_website/meta/main.yml
Show inline comments
 
new file 100644
 
---
 

	
 
allow_duplicates: yes
 
\ No newline at end of file
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -65,14 +65,14 @@
 
            owner=root group=root mode=644
 
  notify:
 
    - Reload systemd
 
    - Restart website
 
    - "Restart website {{ fqdn }}"
 

	
 
- name: Deploy systemd service configuration for website
 
  template: src="systemd_wsgi_website.service.j2" dest="/etc/systemd/system/{{ fqdn }}.service"
 
            owner=root group=root mode=644
 
  notify:
 
    - Reload systemd
 
    - Restart website
 
    - "Restart website {{ fqdn }}"
 

	
 
- name: Enable the website service
 
  service: name="{{ fqdn }}" enabled=yes state=started
testsite/ansible.cfg
Show inline comments
 
[defaults]
 

	
 
roles_path=../roles
 
force_handlers = True
 
\ No newline at end of file
0 comments (0 inline, 0 general)