Tok
2018-12-09 1efbe2c0fa60269046f42e8e850467d09bf67095
Adding sample-vars.yml to three-tier-app, ans-tower-lab, and just-some-nodes-example
2 files added
4 files modified
156 ■■■■■ changed files
ansible/configs/ans-tower-lab/README.adoc 50 ●●●● patch | view | raw | blame | history
ansible/configs/ans-tower-lab/sample_vars.yml 11 ●●●●● patch | view | raw | blame | history
ansible/configs/just-some-nodes-example/foo 33 ●●●●● patch | view | raw | blame | history
ansible/configs/just-some-nodes-example/sample_vars.yml 10 ●●●●● patch | view | raw | blame | history
ansible/configs/three-tier-app/README.adoc 44 ●●●● patch | view | raw | blame | history
ansible/configs/three-tier-app/sample_vars.yml 8 ●●●● patch | view | raw | blame | history
ansible/configs/ans-tower-lab/README.adoc
@@ -14,7 +14,7 @@
[source,bash]
----
ENVTYPE=ans-tower-lab
GUID=test01
GUID=test02
BASESUFFIX='.example.opentlc.com'
CLOUDPROVIDER=ec2
REGION=us-east-1
@@ -31,48 +31,48 @@
      -e "HostedZoneId=${HOSTZONEID}" \
      -e "email=name@example.com" \
      -e "output_dir=/tmp/workdir" \
      -e @path_to/aws_credentials.yml
      -e @~/secret.yml
----
== Running Ansible Playbook for Homework Assignment
You can run the playbook with the following arguments to overwrite the default variable values:
[source,bash]
----
REGION=ap-southeast-2
REGION=us-east-1
KEYNAME=testkey
GUID=praktest9
GUID=test02
ENVTYPE=ans-tower-lab
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
BASESUFFIX='.example.opentlc.com'
ansible-playbook \
     ansible/main.yml  \
      -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=name@example.com" \
        -e "output_dir=/opt/workdir" \
         -e@~/secrets.yml -vv \
         -e "deploy_tower_homework=true"
ansible-playbook main.yml                       \
      -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=name@example.com"               \
      -e "output_dir=/opt/workdir"              \
      -e@~/secrets.yml                          \
      -e "deploy_tower_homework=true"
----
=== To Delete an environment
----
REGION=ap-southeast-2
REGION=us-east-1
KEYNAME=ocpkey
GUID=praktest1
ENVTYPE="three-tier-app"
GUID=test02
ENVTYPE=ans-tower-lab
CLOUDPROVIDER=ec2
ansible-playbook /ansible/configs/${ENVTYPE}/destroy_env.yml \
 -e "guid=${GUID}" -e "env_type=${ENVTYPE}"  -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}"  \
 -e "key_name=${KEYNAME}"  -e "subdomain_base_suffix=${BASESUFFIX}"    -e@../secret.yml -vv
ansible-playbook configs/${ENVTYPE}/destroy_env.yml \
        -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \
        -e "cloud_provider=${CLOUDPROVIDER}" \
        -e "aws_region=${REGION}"  -e "key_name=${KEYNAME}"  \
        -e "subdomain_base_suffix=${BASESUFFIX}" \
        -e @~/secret.yml -vv
----
ansible/configs/ans-tower-lab/sample_vars.yml
New file
@@ -0,0 +1,11 @@
---
guid: test01
env_type: ans-tower-lab
key_name: ocpkey
subdomain_base_suffix: .example.opentlc.com'
cloud_provider: ec2
aws_region: us-east-1
HostedZoneId: Z3IHLWJZOU9SRT
email: name@example.com
output_dir: /tmp/workdir"
ansible/configs/just-some-nodes-example/foo
New file
@@ -0,0 +1,33 @@
---
# sample configuration file
#
# Usage: ansible-playbook main.yml -e @configs/just-some-nodes-example/sample.yml
#
# Ideally keep your copy OUTSIDE your repo, especially if using Cloud Credentials
env_type: three-tier-app                # Name of config to deploy
output_dir: /tmp/workdir                # Writable working scratch directory
email: name@example.com                 # User info for notifications
guid: guid01                            # Your Global UNIQUE Identifier
subdomain_base_suffix: .example.opentlc.com   # Your domain used in FQDN
# Path to yum repos
own_repo_path: http://admin.na.shared.opentlc.com/repos/ocp/3.6/
# Cloud specfic settings - example given here for AWS
cloud_provider: ec2                     # Which AgnosticD Cloud Provider to use
aws_region: us-east-1                   # AWS Region to deploy in
HostedZoneId: Z3IHLWJZOU9SRT            # You will need to change this
key_name: ocpkey                        # Keyname must exist in AWS
# AWS Credentials. These are required (don't sync them to your fork)
#
# Alternatively consider keeping these in an external file and including:
# $ ansible-playbook main.yml -e @configs/three-tier-app/sample.yml -e @~/secret.yml
#
# aws_access_key_id:
# aws_secret_access_key:
...
ansible/configs/just-some-nodes-example/sample_vars.yml
@@ -5,14 +5,16 @@
#
# Ideally keep your copy OUTSIDE your repo, especially if using Cloud Credentials
#env_type: just-some-nodes-example       # Name of config to deploy
env_type: three-tier-app                # Name of config to deploy
env_type: just-some-nodes-example       # Name of config to deploy
output_dir: /tmp/workdir                # Writable working scratch directory
node_instance_count: 2                  # Number of nodes to deploy
email: name@example.com                 # User info for notifications
guid: jsn00                             # Unique string used in FQDN
subdomain_base_suffix: example.com      # Your domain used in FQDN
guid: guid02                             # Unique string used in FQDN
subdomain_base_suffix: .example.opentlc.com      # Your domain used in FQDN
# Path to yum repos
own_repo_path: http://admin.na.shared.opentlc.com/repos/ocp/3.6/
# Cloud specfic settings - example given here for AWS
ansible/configs/three-tier-app/README.adoc
@@ -27,44 +27,22 @@
For further information on customizing images consult the link:../../../docs/Creating_a_config.adoc[Creating a Config Guide] 
== Running Ansible Playbook
== Deploying the Three Tier App Config
You can run the playbook with the following arguments, from the `ansible` directory, to overwrite the default variable values:
[source,bash]
----
REGION=us-east-1
KEYNAME=ocpkey
GUID=guidtest1
ENVTYPE="three-tier-app"
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
BASESUFFIX='.example.opentlc.com'
You can deploy this config by running the following command from the `ansible`
directory. You will have to provide credentials and adjust settings to your own
environment.
ansible-playbook main.yml                       \
      -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=name@example.com"               \
      -e "output_dir=/tmp/workdir"              \
      -e @~/.aws/credentials.yml
----
`ansible-playbook -e @configs/three-tier-app/sample_vars.yml main.yml`
=== To Delete an environment
----
REGION=ap-southeast-2
KEYNAME=ocpkey
GUID=praktest1
ENVTYPE="three-tier-app"
CLOUDPROVIDER=ec2
ansible-playbook ./ansible/configs/${ENVTYPE}/destroy_env.yml \
 -e "guid=${GUID}" -e "env_type=${ENVTYPE}"  -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}"  \
 -e "key_name=${KEYNAME}"  -e "subdomain_base_suffix=${BASESUFFIX}"    -e@../secret.yml -vv
ansible-playbook -e @configs/three-tier-app/sample_vars.yml \
  configs/three-tier-app/destroy_env.yml
----
ansible/configs/three-tier-app/sample_vars.yml
@@ -9,8 +9,12 @@
output_dir: /tmp/workdir                # Writable working scratch directory
email: name@example.com                 # User info for notifications
guid: jsn01                             # Unique string used in FQDN
subdomain_base_suffix: example.opentlc.com   # Your domain used in FQDN
guid: guid01                            # Your Global UNIQUE Identifier
subdomain_base_suffix: .example.opentlc.com   # Your domain used in FQDN
# Path to yum repos
own_repo_path: http://admin.na.shared.opentlc.com/repos/ocp/3.6/
# Cloud specfic settings - example given here for AWS