$ cd $INTRO_ANSIBLE_DIR/cloud-provisioning
$ tree
.
├── ansible
.
.
├── templates
│ └── index.html
└── wsgi.py
In this lesson we'll set up a an application in Catalyst Cloud
- App server
- Runs a basic Flask (Python) app
- DB server
- Dedicated postgresql database
- Web server
- Nginx proxy requests to app server
- Need to set up a few things so we can interact with Catalyst Cloud easily
- clouds.yaml file for authenticating with the cloud
- inventory file with hosts
- Verify that you have files in:
~/.ansible/inventory/cloud-hosts
~/.config/openstack/clouds.yaml
- If not, run the setup playbook
ansible-playbook ansible/local-setup.yml
- Have a look at
ansible/provision-hosts.yml
- This playbook does the following:
- Creates networks/subnets in Catalyst Cloud
- Create security groups to control access
- Sets up routers
- Creates servers
- Run the playbook
$ ansible-playbook -K ansible/provision-hosts.yml
Note: might need to have participants install ansible==2.5.5 and shade==1.28.0 due to problems with openstack modules
- Use a tool that you have learned about to verify that hosts can be reached
by SSH
$ ansible mycluster -m ping
ansible/deploy-app.yml
sets up- The database server
- Installs postgresql
- Sets up database
- The application servers
- Installs Python
- Sets up framework middleware (gunicorn)
- The web server
- Installs nginx
- Proxy requests to app server
- The database server
- Run the deploy playbook
ansible-playbook ansible/deploy-app.yml
- Once deploy is finished visit the new website website
- When you are done playing with cats, please clean up your cluster
ansible-playbook -K ansible/remove-hosts.yml