Skip to content

Latest commit

 

History

History
95 lines (77 loc) · 2.76 KB

README.adoc

File metadata and controls

95 lines (77 loc) · 2.76 KB

generic-example config

Set up your "Secret" variables

  • You need to provide some credentials for deployments to work

  • Create a file called "env_secret_vars.yml" and put it in the ./ansible/configs/CONFIGNAME/ directory.

    • At this point this file has to be created even if no vars from it are used.

  • You can choose to provide these values as extra vars (-e "var=value") in the command line if you prefer not to keep sensitive information in a file.

Example contents of "Secret" Vars file
# ## Logon credentials for Red Hat Network
# ## Required if using the subscription component
# ## of this playbook.
rhel_subscription_user: ''
rhel_subscription_pass: ''
#
# ## LDAP Bind Password
bindPassword: ''
#
# ## Desired admin name and password if required
admin_user: ""
admin_user_password: ""
#
# ## AWS Credentials. This is required.
aws_access_key_id: ""
aws_secret_access_key: ""
#If using repo_method: satellite, you must set these values as well.
satellite_url: https://satellite.example.com
satellite_org: Sat_org_name
satellite_activationkey: "rhel7basic"

Review the Env_Type variable file

  • This file ./env_vars.yml contains all the variables you need to define to control the deployment of your environment.

Running Ansible Playbook

You can run the playbook with the following arguments to overwrite the default variable values:

REGION=ap-southeast-2
KEYNAME=ocpkey
GUID=ec2test3tapp1
ENVTYPE="three-tier-app"
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
REPO_PATH='https://admin.example.com/repos/ocp/3.5/'

BASESUFFIX='.example.opentlc.com'
DEPLOYER_REPO_PATH=`pwd`

ansible-playbook \
     ${DEPLOYER_REPO_PATH}/main.yml  \
    -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \
      -e "guid=${GUID}" \
      -e "env_type=${ENVTYPE}" \
      -e "key_name=${KEYNAME}" \
      -e "subdomain_base_suffix=${BASESUFFIX}" \
        -e "cloud_provider=${CLOUDPROVIDER}" \
        -e "aws_region=${REGION}" \
        -e "HostedZoneId=${HOSTZONEID}" \
        -e "[email protected]" \
      -e "install_ipa_client=false" \
      -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \
      -e "software_to_deploy=none"

To Delete an environment

REGION=ap-southeast-2
KEYNAME=ocpkey
GUID=devgenericdemo1
ENVTYPE="three-tier-app"
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
BASESUFFIX='.example.opentlc.com'
#To Destroy an Env
ansible-playbook -i inventory/${CLOUDPROVIDER}.py ./configs/${ENVTYPE}/destroy_env.yml \
    -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \
 -e "guid=${GUID}" -e "env_type=${ENVTYPE}"  -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}"  \
 -e "HostedZoneId=${HOSTZONEID}"  -e "key_name=${KEYNAME}"  -e "subdomain_base_suffix=${BASESUFFIX}"