Skip to content

Examples#

For complete code samples see https://github.com/bitovi/bitops/tree/master/docs/examples.

Note that each directory in the examples is intended to be an Operations Repository. For example, the files within docs/examples/bitops+eks would exist in the root of a dedicated repository.

Docker Run Examples#

Selecting Environment#

An environment must always be selected

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

AWS Config#

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-e AWS_ACCESS_KEY_ID=<AWS_SECRET_ACCESS_KEY> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION="us-east-1" \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

Passing in kubeconfig#

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-e AWS_ACCESS_KEY_ID=<AWS_SECRET_ACCESS_KEY> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION="us-east-1" \
-e KUBECONFIG_BASE64=$(cat /tmp/my-kubeconfig | base64) \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

Fetch kubeconfig from EKS#

If you have a cluster arn of arn:aws:eks:us-east-1:111122223333:cluster/my-cluster, you would use the following configuration:

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-e AWS_ACCESS_KEY_ID=<AWS_SECRET_ACCESS_KEY> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION="us-east-1" \
-e CLUSTER_NAME="my-cluster" \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

Force skip over ansible#

If there is a ./dev/ansible/ directory, ansible execution can be skipped with ANSIBLE_SKIP_DEPLOY=true:

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-e AWS_ACCESS_KEY_ID=<AWS_SECRET_ACCESS_KEY> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION="us-east-1" \
-e ANSIBLE_SKIP_DEPLOY=true \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

Force call terraform destroy#

docker run \
-e BITOPS_ENVIRONMENT="dev" \
-e AWS_ACCESS_KEY_ID=<AWS_SECRET_ACCESS_KEY> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION="us-east-1" \
-e TERRAFORM_DESTROY=true \
-v $(pwd):/opt/bitops_deployment \
bitovi/bitops:latest

Use your local BitOps code#

If you'd like to override the BitOps code with your own version, see how to do that with the $BITOPS_HOME example:

docker run 
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION           \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID             \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY     \
-e BITOPS_ENVIRONMENT="test"                        \
-v $(pwd):/opt/bitops_deployment                    \
-v $BITOPS_HOME:/opt/bitops                         \
bitovi/bitops:latest

Using Declarative Infrastructure to Deploy an EKS Cluster and Helm Chart#

BitOps and Terraform#

Combine Terraform and Ansible to provision and configure a webserver#

StackStorm Series#

  1. DevOps Automation using StackStorm - Getting Started Guide
  2. DevOps Automation using StackStorm - Deploying with Ansible
  3. DevOps Automation using StackStorm - Cloud Deployment via BitOps
  4. DevOps Automation using StackStorm: BitOps Secrets Management