Skip to content

Ansible modules for using with OTC (addition to the native OpenStack modules)

License

Notifications You must be signed in to change notification settings

avalor1/ansible-collection-cloud

 
 

Repository files navigation

Ansible Collection opentelekomcloud.cloud

Ansible Collections for using with OTC (addition to the native OpenStack modules)

  • cloud - collection containing additional ansible modules for managing OTC specific resources (or modified OpenStack modules in case of behavioral differencies)

Requirements

  • otcextension
  • openstacksdk (installed via otcextensions)

Installation

Run the following command to install the collection.

$ ansible-galaxy collection install opentelekomcloud.cloud

If you need further information to get started, please see section: Installation on a blank system in a Python virtual environment

Get started on a blank system in a Python virtual environment

Installation was tested on Ubuntu 20.04

Install python3-venv for Python virtual environment:

$ sudo apt-get install python3-venv

Create virtual environment ansiblevenv:

$ python3 -m venv ansiblevenv

Install dependencies for python package otcextensions which are described in its documentation:

$ sudo apt-get install gcc libssl-dev python3-dev

Enable virtual environment ansiblevenv:

$ source ansiblevenv/bin/activate

Install wheel, ansible and otcextensions:

(ansiblevenv) $ pip install wheel ansible otcextensions

Install opentelekomcloud.cloud collection from Ansible-Galaxy:

(ansiblevenv) $ ansible-galaxy collection install opentelekomcloud.cloud

Prepare credential file clouds.yaml and necessary folders to connect to your cloud:

(ansiblevenv) $ mkdir -p ~/.config/openstack/
(ansiblevenv) $ touch ~/.config/openstack/clouds.yaml
(ansiblevenv) $ chmod 700 -R ~/.config/

Paste in the following content with your credentials:

# clouds.yaml

clouds:
otc:
  profile: otc
  auth:
    username: '<USER_NAME>'
    password: '<PASSWORD>'
    project_name: '<eu-de_project>'
    # or project_id: '<123456_PROJECT_ID>'
    user_domain_name: 'OTC00000000001000000xxx'
    # or user_domain_id: '<123456_DOMAIN_ID>'
    auth_url: 'https://iam.eu-de.otc.t-systems.com:443/v3'
  interface: 'public'
  identity_api_version: 3 # !Important
  ak: '<AK_VALUE>' # AK/SK pair for access to OBS
  sk: '<SK_VALUE>'

Verify the installation process by creating a sample playbook which invokes all dependencies:

(ansiblevenv) $ vim opentelekomcloud.yaml
# opentelekomcloud.yaml

- hosts: localhost
  tasks:
    - name: Get NAT gateway info
      opentelekomcloud.cloud.nat_gateway_info:
        cloud: otc
      register: gw
  
    - name: debug configs
      debug:
        var: gw.nat_gateways

Run the playbook to verify the functionality:

(ansiblevenv) $ ansible-playbook opentelekomcloud.yaml

# output without NAT gateways enabled

PLAY [localhost] ***************************************************************

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

TASK [Get NAT gateway info] ****************************************************
ok: [localhost]

TASK [debug configs] ***********************************************************
ok: [localhost] => {
    "gw.nat_gateways": []
}

About

Ansible modules for using with OTC (addition to the native OpenStack modules)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.2%
  • Shell 0.8%