This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install packages and configuration for 2tier-app database role | |
installDbRolePackages: | |
pkg.installed: | |
- pkgs: | |
- python | |
- httpd | |
startApache: | |
service.running: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import cgi | |
import sqlite3 | |
conn=sqlite3.connect('/var/www/db/directory.db') | |
curs=conn.cursor() | |
print "Content-type:text/plain\n\n"; | |
form = cgi.FieldStorage() | |
querystring = form.getvalue("querystring") | |
if querystring != None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install packages and configuration for 2tier-app app server role | |
installAppRolePackages: | |
pkg.installed: | |
- pkgs: | |
- python | |
- httpd | |
- epel-release | |
- python-pip | |
- policycoreutils-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os, sys, cgi | |
import requests | |
print "Content-type:text/html\n\n"; | |
print "<head><title>Company Phone Directory</title></head>\n" | |
print "<body>\n" | |
print "<h1>Directory Lookup</h1>\n" | |
remote = os.getenv("REMOTE_ADDR") | |
form = cgi.FieldStorage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cloudConfig: | | |
#cloud-config | |
preserve-hostname: false | |
hostname: ${self.resourceName}.corp.local | |
runcmd: | |
- curl -L https://bootstrap.saltstack.com -o install_salt.sh | |
- sudo sh install_salt.sh -A ${propgroup.SaltStackConfiguration.masterAddress} | |
- sudo salt-call grains.set serverRole app | |
- sudo salt-call grains.set databaseServer ${resource.database_Server_1.networks.address[0]} | |
- sudo salt-call state.highstate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if querystring != None: | |
url = 'http://{{ grains['databaseServer'] }}/cgi-bin/database.py?querystring=' + querystring | |
else: | |
url = 'http://{{ grains['databaseServer'] }}/cgi-bin/database.py' |