Skip to content

Latest commit

 

History

History
164 lines (106 loc) · 4.77 KB

README.adoc

File metadata and controls

164 lines (106 loc) · 4.77 KB

OpenStack Ansible Playbooks

Before you start

Choose an image

ℹ️
The list of images is identified on the OpenStack README file.

Different OS images are available on Openstack. To select a specific image use the openstack.vm.image variable override.

Choose a flavor

ℹ️
The list of flavors is identified on the OpenStack README file.

Playbooks

Create a VM with Passwordstore

Create an OpenStack instance (aka a VM) using passwordstore as tools to manage the credentials, information.

ℹ️

The playbook also uses the variables defined in the openstack/vm role of the Snowdrop Cloud Infra Ansible Collection that can also be overridden.

Table 1. OpenStack VM Create Passwordstore parameters
Field name Description

default_generic_key_name

string

Generic key name

openstack.vm

map

required

Map with required attributes for RHOS.

Check the openstack.vm parameter map table below for more details.

rhos_auth_type

string

RHOSP Authentication type

Check the openstack CLI man page (man openstack) for available types, or our Red Hat Open Stack document.

  • v3password ⇐ Default

  • …​

vm_name

string

required

Name of the VM being created.

This name will be used both as hostname as well as Ansible Inventory name.

Table 2. openstack.vm map parameter
Field name Description

flavor

string

required

RHOS Flavor specifying the CPU, RAM and DISK sizes.

image

string

required

OS Image to be used (e.g. Fedora-Cloud-Base-37).

network

string

required

Network provider in RHOS

To create the RHOSP launch the openstack_vm_create_passwordstore.yml Ansible Playbook using the following command.

ansible-playbook ansible/playbook/openstack/openstack_vm_create_passwordstore.yml -e '{"openstack": {"vm": {"network": "provider_net_shared","image": "Fedora-Cloud-Base-37", "flavor": "m1.medium"}}}' -e vm_name=snowdrop_sample_vm
ℹ️

Some error messages might show on the installation process and be ignored by the installation process. Nevertheless the playbook should finish with no failed tasks.

This is a sample result of the playbook execution.

PLAY RECAP *******************************************************************************************************
localhost                  : ok=68   changed=20   unreachable=0    failed=0    skipped=13   rescued=0    ignored=1
vm20210221-t01             : ok=32   changed=20   unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

After creating the VM this playbook also executes the VM secure host playbook. This is an independent playbook that can be executed against any host. More information here.

Besides creating the VM the playbook also performs the following operations:

  • Store the host SSH keys on the controller device.

  • Add entries to the ~/.ssh/known_hosts file for this host.

  • Add several entries to the passwordstore database in order to build the Ansible Inventory

Delete a VM with Passwordstore

To delete a VM, simply execute the openstack_vm_remove_aggregate playbook. Besides removing the VM from the RHOSP it will also remove the entries from the passwordstore database as well as any VM local ssh keys and entries from known hosts.

ansible-playbook ansible/playbook/openstack/openstack_vm_remove_passwordstore.yml -e vm_name=snowdrop_sample_vm

Although some failures might occur some might be ignored which shouldn’t affect thhe process. This playbook should finish with no failed tasks.

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