OpenShift environment with a Service Catalog & Ansible Service Broker in a single EC2 Instance.
These playbooks will:
- Create a public VPC if it does not exist
- Create a security group if it does not exist
- Create a single EC2 instance with a specific Name if does not exist
- Associate an elastic ip to instance
- Configure a hostname with elastic ip through Route53
- Setup Origin through
oc cluster up
- Install Service Catalog on Origin
- Install Ansible Service Broker on Origin
-
Ansible 2.4.0+ installed.
-
Ansible needs to be installed so its source code is available to Python.
- Check to see if Ansible modules are available to Python
$ python -c "import ansible;print(ansible.__version__)" 2.4.1.0
- MacOS requires Ansible to be installed from
pip
and notbrew
$ python -c "import ansible;print(ansible.__version__)" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named ansible brew uninstall ansible pip install ansible $ python -c "import ansible;print(ansible.__version__)" 2.4.1.0
- Check to see if Ansible modules are available to Python
-
Install python dependencies (This is needed for python2. Use pip2 if using python3)
- On Fedora and EL7 it is recommended that you use ansible in a python virtualenv.
- This is due to a couple reasons:
- boto rpms are not sufficiently new enough
- pip is not sudo safe on Fedora and EL7
- To setup and active a virtualenv do the following;
sudo dnf install python-virtualenv #or EL7: sudo yum install python-virtualenv virtualenv /tmp/ansible source /tmp/ansible/bin/activate pip install ansible
- This is due to a couple reasons:
- Continue with the next step:
$ pip install boto boto3 six
- On Fedora and EL7 it is recommended that you use ansible in a python virtualenv.
-
Configure a SSH Key in your AWS EC2 account for the given region
-
Create a hosted zone in Route53
-
Set these environment variables:
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SSH_PRIV_KEY_PATH - Path to your private ssh key to use for the ec2 instances
- Navigate to the config folder
$ cd catasb/config
- Edit the variables file ec2_env_vars
- Note the following and update:
Needs to match a hosted zone entry in your Route53 account, we will create a subdomain under it for the ec2 instance
AWS_SSH_KEY_NAME="splice" TARGET_DNS_ZONE="ec2.dog8code.com"
- Note the following and update:
- Create a
catasb/config/my_vars.yml
Override any variables you see in the$ cp catasb/config/my_vars.yml.example catasb/config/my_vars.yml
my_vars.yml
files as necessary (e.g. dockerhub_org) - Navigate to the
ec2/minimal
folder$ cd catasb/ec2/minimal
- Create our infrastructure in ec2 if it doesn't exist
$ ./run_create_infrastructure.sh
- Run the setup script
$ ./run_setup_environment.sh
- Open a Web Browser
- Visit:
https://apiserver-service-catalog.USERNAME.ec2.dog8code.com
- Accept the SSL certificate for the apiserver-service-catalog endpoint
- Ignore the text that appears and proceed to the main OpenShift URL next
- Note: must accept the new SSL cert, each time you reset your OpenShift environment
- Visit:
https://<USERNAME>.ec2.dog8code.com:8443
- Where
<USERNAME>
is the value ofwhoami
when you launchedrun_setup_environment.sh
- Where
- Visit:
- To terminate the ec2 instance and cleanup the associated EBS volumes run the below
$ ./terminate_instance.sh
- To reset the ec2 instance back to clean origin and deployment of ASB and Service Catalog run the below
$ ./reset_environment.sh
- Use the --rcm flag. For instance:
./run_setup_envrironment.sh --rcm
./reset_environmet.sh --rcm
- ansible 2.4.1.0
- Problems were seen using ansible 2.2 and lower