One of many uses for Ansible is server management, and one of the great things we've done at CloudShare is to integrate with Ansible so that you can use Ansible to manage your CloudShare VMs in yo...
Download cloudshare-inv.py. This is the CloudShare dynamic inventory script. Install the CloudShare Python SDK: pip install cloudshare. Define your CloudShare API keys as environment variables: C...
To retrieve all VMs in all CloudShare environments and their login credentials: ansible -i cloudshare-inv.py all -m ping To limit the output to a specific environment: ansible -i cloudshare-inv.py...
Run the inventory script on its own to generate a list of environments, VMs and VM login credentials: ansible -i cloudshare-inv.py all -m ping The output is a JSON document that looks like this: {...
Let’s say you have a playbook called web-app.yml that you wish to run on one your VMs. Using the dynamic inventory, you can do this: ansible-playbook -i cloudshare-inventory.py all web-app.yml Th...
Something you probably find yourself doing from time to time is to apply patches to your servers. In this example we have an environment called chat-demo containing a few Ubuntu Linux VMs, and we ...