openstack_instance

OSP Instance

Create an instance on OpenStack.

Requirements

  • python >= 2.7
  • openstacksdk

Role Variables

Variable Required Default Description
os_auth :heavy_check_mark: omit Dictionary containing auth information as needed by the cloud's auth plugin strategy. For the default password plugin, this would contain auth_url, username, password, project_name and any information about domains if the cloud supports them. For other plugins, this param will need to contain whatever parameters that auth plugin requires.

This parameter is not needed if a named cloud is provided or OpenStack OS_* environment variables are present.
os_instance_name :heavy_check_mark: Name that has to be given to the instance.
os_instance_image :heavy_check_mark: The name or id of the base image to boot.
os_instance_flavor :heavy_check_mark: The name or id of the flavor in which the new instance has to be created.
os_instance_key_name :heavy_check_mark: The key pair name to be used when creating a instance.
os_instance_auto_ip :x: yes Ensure instance has public ip however the cloud wants to do that.
os_instance_timeout :x: 300 The amount of time the module should wait for the instance to get into active state.
os_instance_volumes :x: [] A list of volumes to create and attach to the instance. Each volume in the list would contain name and size.
os_instance_security_groups :x: [] The security groups to create and to which the instance should be added. Each security group in the list would contain name, rules, and optionally description.

The rules parameter would contain options defined here.

Dependencies

None

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: localhost
  vars:
    os_auth:
      auth_url: http://openstack.example.com:5000
      username: admin
      password: p@ssw0rd
      project_name: demo
      project_domain_name: default
      user_domain_name: default
    project_name: myproject
    os_instance_name: myinstance
    os_instance_image: rhel75
    os_instance_flavor: m4.xlarge
    os_instance_key_name: user1-key
    os_instance_network: private
    os_instance_auto_ip: yes
    os_instance_timeout: 300
    os_instance_volumes:
    - name: scratch
      size: 10
    - name: db
      size: 50
    os_instance_security_groups:
    - name: ssh
      description: Allow SSH
      rules:
        - protocol: tcp
          port_range_min: 22
          port_range_max: 22
          remote_ip_prefix: 0.0.0.0/0
    - name: web
      rules:
        - protocol: tcp
          port_range_min: 80
          port_range_max: 80
          remote_ip_prefix: 0.0.0.0/0
        - protocol: tcp
          port_range_min: 443
          port_range_max: 443
          remote_ip_prefix: 0.0.0.0/0
  tasks:
    - name: Create OpenStack Instance
      include_role:
        name: RedHatGov.openstack_instance

License

GPLv3

Author Information

Red Hat North American Public Sector Solution Architects

About

Create an instance on a OpenStack Cloud

Install
ansible-galaxy install RedHatGov/ansible-openstack-instance
GitHub repository
License
gpl-3.0
Downloads
106
Owner
Code contributions from Red Hat's Public Sector practice