Changeset - 0ec59430e00c
[Not reviewed]
0 2 0
Branko Majic (branko) - 7 years ago 2016-11-27 13:36:00
branko@majic.rs
MAR-70: Updated testsite to include environment indicator. Updated the sample WSGI app role to output minimalistic HTML page (instead of text as it used to do until now).
2 files changed with 21 insertions and 3 deletions:
0 comments (0 inline, 0 general)
testsite/group_vars/web.yml
Show inline comments
 
@@ -15,4 +15,9 @@ web_default_message: "You are attempting to access the web server using a wrong
 

	
 
db_root_password: "root"
 

	
 
website_mail_recipients: "john.doe@example.com"
 
\ No newline at end of file
 
website_mail_recipients: "john.doe@example.com"
 

	
 
environment_indicator:
 
  background_colour: "purple"
 
  text_colour: "white"
 
  text: "Majic Ansible Roles Test Site"
 
\ No newline at end of file
testsite/playbooks/roles/wsgihello/files/hello.wsgi
Show inline comments
 
@@ -4,9 +4,22 @@ import os
 

	
 
def application(environ, start_response):
 
    status = '200 OK'
 
    output = 'Hello, world one! I am website %s' % os.environ.get("WEBSITE_NAME", "that nobody set a name for :(")
 

	
 
    response_headers = [('Content-type', 'text/plain'),
 
    template = """<!DOCTYPE html>
 
<html lang="en">
 
  <head>
 
    <meta charset="utf-8">
 
    <title>{title}</title>
 
  </head>
 
  <body>
 
    <h1>Hello, world!</h1>
 
    <p>I am website {title}</p>
 
  </body>
 
</html>
 
"""
 
    output = template.format(title=os.environ.get("WEBSITE_NAME", "that nobody set a name for :("))
 

	
 
    response_headers = [('Content-type', 'text/html'),
 
                        ('Content-Length', str(len(output)))]
 
    start_response(status, response_headers)
 

	
0 comments (0 inline, 0 general)