Skip to content

Instantly share code, notes, and snippets.

@Mudpuppy12
Created August 3, 2016 17:23
Show Gist options
  • Save Mudpuppy12/6295b72d268d8dc26bd81eec8af6031b to your computer and use it in GitHub Desktop.
Save Mudpuppy12/6295b72d268d8dc26bd81eec8af6031b to your computer and use it in GitHub Desktop.
denn8098@MN80JQG3QN:/tmp$ diff -u f5-config.py ~/PycharmProjects/rpc_lem/lem-aide/user-tools/f5_config.py
--- f5-config.py 2016-08-03 12:18:47.000000000 -0500
+++ /Users/denn8098/PycharmProjects/rpc_lem/lem-aide/user-tools/f5_config.py 2016-03-31 15:07:50.000000000 -0500
@@ -16,17 +16,32 @@
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
import argparse
import json
-import os
+import os,sys
import netaddr
+if os.environ.has_key('LAB_DATA_DIR'):
+ # If we have LAD_DATA_DIR set, we are operating inside a lab environment
+ LAB_DATA_DIR = os.environ['LAB_DATA_DIR']
+else:
+ print "Incorrect LEM install missing LAB_DATA_DIR"
+ sys.exit(1)
+
+
+if os.environ.has_key('LAB_NAME'):
+ LAB_NAME = os.environ['LAB_NAME'].lower()
+else:
+ print "Incorrect LEM install missing LAB_NAME"
+ sys.exit(1)
+
+PART = LAB_NAME.upper()
+PREFIX_NAME = LAB_NAME.upper()
-PART = 'RPC'
-PREFIX_NAME = 'RPC'
SNAT_POOL = (
'### CREATE SNATPOOL ###\n'
'create ltm snatpool /' + PART + '/' + PREFIX_NAME + '_SNATPOOL { members replace-all-with {'
+
' %(snat_pool_addresses)s } }'
)
@@ -39,6 +54,9 @@
r' app-service none cookie-name RPC-COOKIE defaults-from /Common/cookie }''\n'
]
+
+## TODO: Configure monitoring user
+
MONITORS = [
r'create ltm monitor mysql /' + PART + '/' + PREFIX_NAME + '_MON_GALERA { count 1 database'
r' information_schema debug no defaults-from mysql destination *:*'
@@ -51,13 +69,13 @@
r' defaults-from http destination *:8775 recv "200 OK" send "HEAD /'
r' HTTP/1.1\r\nHost: rpc\r\n\r\n" }',
r'create ltm monitor http /' + PART + '/' + PREFIX_NAME + '_MON_HTTP_HORIZON { defaults-from http'
- r' destination *:80 recv "302 Found" send "HEAD / HTTP/1.1\r\nHost:'
+ r' destination *:80 recv "200 OK" send "HEAD / HTTP/1.1\r\nHost:'
r' rpc\r\n\r\n" }',
r'create ltm monitor http /' + PART + '/' + PREFIX_NAME + '_MON_HTTP_NOVA_SPICE_CONSOLE {'
r' defaults-from http destination *:6082 recv "200 OK" send "HEAD /'
r' HTTP/1.1\r\nHost: rpc\r\n\r\n" }',
r'create ltm monitor https /' + PART + '/' + PREFIX_NAME + '_MON_HTTPS_HORIZON_SSL { defaults-from'
- r' https destination *:443 recv "302 FOUND" send "HEAD / HTTP/1.1\r\nHost:'
+ r' https destination *:443 recv "200 OK" send "HEAD / HTTP/1.1\r\nHost:'
r' rpc\r\n\r\n" }',
r'create ltm monitor https /' + PART + '/' + PREFIX_NAME + '_MON_HTTPS_NOVA_SPICE_CONSOLE {'
r' defaults-from https destination *:6082 recv "200 OK" send "HEAD /'
@@ -252,7 +270,7 @@
'make_public': True,
'hosts': []
},
- 'nova_console': {
+ 'nova_spice_console': {
'port': 6082,
'backend_port': 6082,
'mon_type': '/' + PART + '/' + PREFIX_NAME + '_MON_HTTP_NOVA_SPICE_CONSOLE',
@@ -451,7 +469,7 @@
'--ssl-domain-name',
help='Name of the domain that will have an ssl cert.',
required=False,
- default=None
+ default=LAB_NAME.lower() + ".rpc.rackspace.com"
)
parser.add_argument(
@@ -541,9 +559,9 @@
commands.extend([
'### CREATE SECURITY iRULE ###',
- 'run util bash',
- 'tmsh create ltm rule /' + PART + '/' + PREFIX_NAME + '_DISCARD_ALL when CLIENT_ACCEPTED { discard }',
- 'exit',
+ 'create ltm rule /' + PART + '/' + PREFIX_NAME + '_DISCARD_ALL',
+ ' --> Copy and Paste the following between pre-included curly brackets <--',
+ 'when CLIENT_ACCEPTED { discard }\n',
'### CREATE EXTERNAL MONITOR ###',
' --> Upload External monitor file to disk <--',
' run util bash',
@@ -597,6 +615,10 @@
pool_parts = build_pool_parts(inventory=inventory_json)
lb_vip_address = inventory_json['all']['vars']['internal_lb_vip_address']
+ if user_args['ssl_public_ip'] is None:
+ user_args['ssl_public_ip'] = inventory_json['all']['vars']['external_lb_vip_address']
+
+
for key, value in pool_parts.iteritems():
value['group_name'] = key.upper()
value['vs_name'] = '%s_VS_%s' % (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment