Package: configbutler
This tool is an extensible framework that provides an ability to manage
server configuration files composed from properties available in the
servers environment.Modern server solutions are comprimised of many components, which we
currently build and manage in a very monolitic way. This tool aims to
inverse the coupling of service configuration in a kind of dependancy
injection workflow.ConfigurationThe tool holds a strong opinion of convention over configuration, but
aims to support extensions a key points to enable integration and
customisation to a wide range of solution requirements.At its heart is the/etc/configbutlerfolder, which contains a
number of service config definitions which drive the framework to
supporton-bootconfiguration of services.These service files are enumerated in alphabetical order to provide a
controlled sequence. The theory of design is that different services can
compose different config sets into a single server, allowing the actual
values and configuration to be resolved at runtime.These service files can contain multiple outputs resolved from a single
set of properties.The output of the configuration files are templated using jinja, with a
map of parameters used for flow control and replacement.The properties are resolved through a number of extensible sources such
as:local host informationAWS instance tagsAWS instance metadataAWS SSM parameter store003-example.configformat: 1.0
properties:

    HOST_NAME: host|hostname
    HOST_MEMORY: host|total_memory
    ENVIRONMENT: aws|tags|aws:cloudformation:stack-name

    appd_enabled: aws|paramstore|${ENVIRONMENT}.appd_enabled

    application_name: string|sample-app
    controller_licence: aws|paramstore|${ENVIRONMENT}/appd/licence
    controller_host: aws|paramstore|${ENVIRONMENT}/appd/controller
    controller_url: string|/
    controller_port: string|1234
    use_ssl: string|true

    jvm_memory: math|multiply|${HOST_MEMORY}|0.8

files:
    -
      mode: jinja2
      src: /tmp/appdynamics.conf.j2
      dest: /opt/appd/config/appdynamics.conf

    - mode: jinja2
      src: /tmp/setenv.sh.j2
      dest: /usr/local/tomcat7/conf/setenv.shAnd config templates/tmp/setenv.sh.j2export JAVA_OPTS="-Xmx {{ jvm_memory }}"

{% if appd_enabled %}
export JAVA_OPTS="${JAVA_OPTS} -javaagent:/opt/appd/appd.jar"
{% endif %}/tmp/appdynamics.conf.j2<controller-info>

    <controller-host>{{ controller_host }}.{{ controller_url }}</controller-host>
    <controller-port>{{ controller_port }}</controller-port>
    <controller-ssl-enabled>{{ use_ssl }}</controller-ssl-enabled>
    <enable-orchestration>false</enable-orchestration>
    <unique-host-id></unique-host-id>
    <account-access-key>{{ controller_licence }} </account-access-key>
    <account-name>{{ controller_host }}</account-name>
    <machine-path></machine-path>
    <application-name>{{ application_name }}</application-name>
    <tier-name>{{ tier_name }}</tier-name>
    <node-name>{{ ansible_ec2_hostname }}</node-name>

</controller-info>Property functionsMath functionsFunctions that can be used to to manipulate figures to perform basic
calculationsadd- adds two parameters together (eg.math|add|1|${CLUSTER_SIZE})subtract- subtracts the second from the first parameter (eg.math|subtract|15|${CLUSTER_SIZE})multiply- multiplys the parameters together (eg.math|multiply|${TOTAL_MEMORY}|0.8)divide- divides the first by the second parameter (eg.math|divide|${TOTAL_MEMORY}|1024)Example usageproperties:
    HOST_MEMORY: host|total_memory
    sub_memory: math|multiply|${HOST_MEMORY}|0.8
    jvm_memory: math|divide|${sub_memory}|1024Map lookupsUn supported (At the moment!)ConditionalsUn supported (At the moment!)Property scopehosthostname- the local hostname (eghost|hostname)fqdn- the local fully qualified domain name (eghost|fqdn)ipaddress- the ipaddress of eth0 (eghost|ipaddress)cpu_count- the number of available CPU cores (eghost|cpu_count)total_memory- the total memory available (eghost|total_memory)Example usageproperties:
    HOSTNAME: host|hostnameawsA set of properties that are resolved from AWS scoped servicesmetadataaccount_idami_idami_launch_indexavailability_zoneiam_infoinstance_actioninstance_idinstance_profile_arninstance_profile_idinstance_typeprivate_hostnameprivate_ipv4public_hostnamepublic_ipv4security_groupsregionExample usageproperties:
    aws_account_id: aws|metadata|account_id
    aws_region: aws|metadata|region
    instance_type: aws|metadata|instance_type
    internal_ip: aws|metadata|private_ipv4tagsTag values are lookups to the current host’s tags.eg. Cloudformation tagsaws:cloudformation:logical-idaws:cloudformation:stack-idaws:cloudformation:stack-nameExample usageproperties:
    stack_name: aws|tags|aws:cloudformation:stack-name
    monitoring_tags: aws|tags|monitoringIn some locations it has been identified that Tags were not resolvable when the servers were initially launched.
If no tags are returned for the current host (but asked for in configuration)configbutlerassumes they have not been set yet and will wait and retry the tag lookup.This lookup will occur 5 times, each one doubling the time waited between requests.ERROR:configbutler:No AWS::tag values found, waiting 1sec to retry.
ERROR:configbutler:No AWS::tag values found, waiting 2sec to retry.
ERROR:configbutler:No AWS::tag values found, waiting 4sec to retry.
ERROR:configbutler:No AWS::tag values found, waiting 8sec to retry.
ERROR:configbutler:No AWS::tag values found, waiting 16sec to retry.
ERROR:configbutler:No AWS::tag values found, continuing with no tags.If eventually no tags are found after 5 attempts,configbutlerwill give up and returnNonefor any additional tag lookup.paramstoreValues looked up from parameter store, where the key may be composed by other resolved variables.Example usageproperties:
    ENVIRONMENT: string|test
    application: string|garden

    splunk_password: aws|paramstore|/Splunk/SplunkPassword
    controller_licence: aws|paramstore|/${application}/${ENVIRONMENT}/AppD/account-access-key
    controller_host: aws|paramstore|/${application}/${ENVIRONMENT}/AppD/controller