Creating your first machine

Creating a machine in Rackspace Cloud is very simple since it's a single-step operation:

  1. Create the rax.yaml Playbook with the following content:
---
- hosts: localhost
tasks:
- name: Ensure the my_machine exists
rax:
name: my_machine
flavor: 4
image: centos-8
count: 1
group: my_group
wait: True
  1. Now, you can execute it with the following command:
$ ansible-playbook rax.yaml
  1. This should result in something like the following:
PLAY [localhost] **********************************************************************************

TASK [Gathering Facts] ****************************************************************************
ok: [localhost]

TASK [Ensure the my_machine exists] ***************************************************************
changed: [localhost]

PLAY RECAP ****************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

As you can see, creating machines in Rackspace Cloud is very straightforward, and the default Ansible module has some interesting concepts already integrated into it, such as group and count. Those options allow you to create and manage groups of instances in the same way you would do with a single instance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset