Commits

Dhananjay Nene committed 29318b6

Added apache configuration

Comments (0)

Files changed (4)

roles/webtier/tasks/main.yml

+- name: Install apache packages                                               
+  apt: package=$item state=present                                            
+  with_items:                                                                 
+    - apache2                                                                 
+    - python                                                                  
+    - libapache2-mod-wsgi                                                     
+    - libmysqlclient18                                                        
+    - libmysqlclient-dev                                                      
+    - mysql-client                                                            
+                                                                              
+                                                                              
+- name: Disable unused apache modules                                         
+  command: a2dismod autoindex cgi env                                         
+                                                                              
+- name: copy apache vhost file                                                
+  template: src=os/etc/apache2/sites-available/support                        
+            dest=/etc/apache2/sites-available/support                         
+            owner=root                                                        
+            group=root                                                        
+            mode=0644                                                         
+                                                                              
+- name: make support directory                                                
+  file: dest=/var/www/support owner=www-data group=www-data state=directory   
+                                                                              
+- name: copy support website                                                  
+  template: src=os/var/www/support/index.html                                 
+            dest=/var/www/support/index.html                                  
+            owner=www-data                                                    
+            group=www-data                                                    
+                                                                              
+- name: enable apache2 site                                                   
+  command: /usr/sbin/a2ensite support                                         
+  notify:                                                                     
+    - restart apache                     

roles/webtier/templates/os/etc/apache2/sites-available/support

+<VirtualHost support:80>                              
+    ServerAdmin webmaster@localhost                       
+    ServerName support                            
+                                          
+    DocumentRoot /var/www/support                     
+    <Directory />                             
+        Options FollowSymLinks                    
+        AllowOverride None                        
+    </Directory>                              
+                                          
+    <Directory /var/www/support/>                     
+        Options Indexes FollowSymLinks MultiViews             
+        AllowOverride None                        
+        Order allow,deny                          
+        allow from all                        
+    </Directory>                              
+                                          
+    ErrorLog ${APACHE_LOG_DIR}/support_error.log              
+                                          
+    # Possible values include: debug, info, notice, warn, error, crit,    
+    # alert, emerg.                               
+    LogLevel warn                             
+                                          
+    CustomLog ${APACHE_LOG_DIR}/support_access.log combined           
+</VirtualHost>                                  

roles/webtier/templates/os/var/www/support/index.html

+<html>                                                                        
+    <head>                                                                    
+        <title>Support site</title>                                           
+    </head>                                                                   
+    <body>                                                                    
+        <h1>Support site</h1>                                                 
+        This is the support site                                              
+    </body>                                                                   
+</html>                   
   sudo: yes
   roles:
   - common
+  - webtier
   handlers:
   - name: restart ssh
     service: name=ssh state=restarted
+  - name: restart apache
+    service: name=apache2 state=restarted