Changeset - 0079746d9a8b
[Not reviewed]
0 4 1
Branko Majic (branko) - 9 years ago 2015-05-06 21:54:56
branko@majic.rs
MAR-5: Updated the web server role to include deployment of some base packages for PHP and Python web apps.
5 files changed with 39 insertions and 0 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -855,6 +855,9 @@ The role implements the following:
 
  index page.
 
* Deploys the HTTPS TLS private key and certificate (for default vhost).
 
* Configures firewall to allow incoming connections to the web server.
 
* Installs and configures supervisor, virtualenv, and virtualenvwrapper as a
 
  common base for Python apps.
 
* Installs and configures PHP FPM as a common base for PHP apps.
 

	
 

	
 
Parameters
roles/web_server/handlers/main.yml
Show inline comments
 
@@ -2,3 +2,6 @@
 

	
 
- name: Restart nginx
 
  service: name=nginx state=restarted
 

	
 
- name: Restart php5-fpm
 
  service: name=php5-fpm state=restarted
 
\ No newline at end of file
roles/web_server/tasks/main.yml
Show inline comments
 
@@ -47,3 +47,34 @@
 

	
 
- name: Enable nginx service
 
  service: name=nginx enabled=yes state=started
 

	
 
- name: Install base packages for Python web applications
 
  apt: name="{{ item }}" state=installed
 
  with_items:
 
    - supervisor
 
    - virtualenv
 
    - virtualenvwrapper
 

	
 
- name: Install base packages for PHP web applications
 
  apt: name="{{ item }}" state=installed
 
  with_items:
 
    - php5-fpm
 

	
 
- name: Enable services used for running web applications
 
  service: name="{{ item }}" enabled=yes state=started
 
  with_items:
 
    - php5-fpm
 
    - supervisor
 

	
 
- name: Read timezone on server
 
  slurp: src=/etc/timezone
 
  register: server_timezone
 

	
 
- name: Configure timezone for PHP
 
  template: src="php_timezone.ini.j2" dest="{{ item }}/30-timezone.ini"
 
            owner=root group=root mode=644
 
  with_items:
 
    - /etc/php5/cli/conf.d/
 
    - /etc/php5/fpm/conf.d/
 
  notify:
 
    - Restart php5-fpm
 
\ No newline at end of file
roles/web_server/templates/php_timezone.ini.j2
Show inline comments
 
new file 100644
 
date.timezone = '{{ server_timezone.content | b64decode | trim }}'
testsite/group_vars/all.yml
Show inline comments
 
@@ -26,6 +26,7 @@ common_packages:
 
  - emacs24-nox
 
  - screen
 
  - debconf-utils
 
  - colordiff
 

	
 
ca_certificates:
 
  - "{{ inventory_dir }}/tls/example_ca_chain.pem"
0 comments (0 inline, 0 general)