Giter VIP home page Giter VIP logo

infra-ovh-ansible-module's Introduction

An Ansible collection to talk with OVH API

Requirements

Tested with:

Collection

This module can be installed as a collection

ansible-galaxy collection install git+https://github.com/synthesio/infra-ovh-ansible-module

This collection provides the following modules:

dedicated_server_boot
dedicated_server_boot_wait
dedicated_server_display_name
dedicated_server_info
dedicated_server_install
dedicated_server_install_wait
dedicated_server_monitoring
dedicated_server_networkinterfacecontroller
dedicated_server_terminate
dedicated_server_vrack
domain
installation_template
ip_reverse
public_cloud_flavorid_info
public_cloud_imageid_info
public_cloud_instance_info
public_cloud_instance
public_cloud_instance_delete
public_cloud_monthly_billing
public_cloud_block_storage_instance
public_cloud_block_storage
public_cloud_object_storage
public_cloud_object_storage_policy

You can read the documentation of every modules with ansible-doc synthesio.ovh.$modules

An example for a custom template to install a dedicated server is present in roles/ovhtemplate folder

Configuration

The collection path must be defined in your ansible.cfg :

[defaults]
collections_paths = collections/

In /etc/ovh.conf:

[default]
; general configuration: default endpoint
endpoint=ovh-eu

[ovh-eu]
; configuration specific to 'ovh-eu' endpoint
application_key=<YOUR APPLICATION KEY>
application_secret=<YOUR APPLICATIOM SECRET>
consumer_key=<YOUR CONSUMER KEY>

Alternatively, you can provide credentials as module attributes:

- name: Add server to vrack
  synthesio.ovh.dedicated_server_vrack:
    endpoint: "ovh-eu"
    application_key: "<YOUR APPLICATION KEY>"
    application_secret: "<YOUR APPLICATIOM SECRET>"
    consumer_key: "<YOUR CONSUMER KEY>"
    vrack: "{{ vrackid }}"
    service_name: "{{ ovhname }}"

This allows you to store them in Ansible vault or to use any lookup plugin to retrieve them.

Usage

Here are a few examples of what you can do. Please read the module for everything else, it most probably does it!

As this is a collection now you must declare it in each task.

A few examples:

Add a host into the vrack

- name: Add server to vrack
  synthesio.ovh.dedicated_server_vrack:
    service_name: "{{ ovhname }}"
    vrack: "{{ vrackid }}"

Add a DNS entry for internal.bar.example.com

- name: Add server IP to DNS
  synthesio.ovh.domain:
    domain: "example.com"
    value: "192.0.2.1"
    record_type: "A"
    name: "internal.bar"
    record_ttl: 10
    append: true

Install a new dedicated server

- Install new dedicated server
  synthesio.ovh.dedicated_server_install:
    service_name: "ns12345.ip-1-2-3.eu"
    hostname: "server01.example.net"
    template: "debian10_64"

- name: Wait for the server installation
  synthesio.ovh.dedicated_server_install_wait:
    service_name: "ns12345.ip-1-2-3.eu"
    max_retry: "240"
    sleep: "10"

Install a new dedicated server with only 2 disks

- Install new dedicated server
  synthesio.ovh.dedicated_server_install:
    service_name: "ns12345.ip-1-2-3.eu"
    hostname: "server01.example.net"
    template: "debian10_64"
    soft_raid_devices: "2"

Install a public cloud instance

- name: run a public cloud installation
  synthesio.ovh.public_cloud_instance:
    name: "{{ inventory_hostname }}"
    ssh_key_id: "{{ ssh_key_id }}"
    service_name: "{{ service_name }}"
    networks: "{{ networks }}"
    flavor_id: "{{ flavor_id }}"
    region: "{{ region }}"
    image_id: "{{ image_id }}"

infra-ovh-ansible-module's People

Contributors

skunnyk avatar beorn- avatar xtof-osd avatar boulet- avatar sbocahu avatar adhaussy avatar ajdelgado avatar carrouet avatar guillaume-gambs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.