Giter Club home page Giter Club logo

ansible-manageiq-vmdb's Introduction

manageiq-vmdb

The manageiq-vmdb role allows for users of ManageIQ to modify and/or change VMDB objects via an Ansible Playbook. The role includes a module manageiq_vmdb which does all the heavy lifting needed to modify or change objects in the database.

Requirements

ManageIQ has to be Gaprindashvili (G Release) or higher.

The example playbook makes use of the manageiq_vmdb module which is also included as part of this role.

If you have a requirement to include this Role in Ansible Tower or Embedded Ansible, simply add an empty roles directory at the root of your playbook and include a requirements.yml file with the following contents inside that directory:

---
- src: syncrou.manageiq-vmdb

Role Variables

Validate Certs: manageiq_validate_certs defaults to True. If set to False in the manageiq_connection dictionary then the lookup will allow self signed certificates to be used when using SSL REST API connection urls.

ManageIQ: manageiq_connection is a dictionary with connection default keys. Use of this connection information is ONLY needed if the role is used outside of a ManageIQ appliance. A ManageIQ appliance passes in manageiq_connection via extra_vars so connection information is included automatically. Remember to use Ansible Vault for passwords.

    manageiq_connection:
        url: 'http://localhost:3000'
        username: 'admin'
        password: 'password'
        manageiq_validate_certs: false

Dependencies

None

Example Playbook

An example which provisions a VM to EC2. The playbook links that vm to a service in the ManageIQ VMDB using the manageiq_vmdb module. The example shows two ways to pass the VMDB object to the module, either via an href slug or via a variable.

- name: Service Linking VM's to an existing service
  hosts: localhost
  connection: local
  gather_facts: False

  vars:
  - key: db
  - name: db-test-provision-1
  - instance_type: t2.nano
  - security_group: sg-sdf234
  - image: ami-234234lkj
  - region: us-east-1
  - subnet: subnet-adsf098
  # Only needed if this playbook is NOT run on a ManageIQ Appliance
  - manageiq_connection:
      url: 'https://localhost.ssl:3000'
      username: 'admin'
      password: 'smartvm'
      manageiq_validate_certs: false

  roles:
  - syncrou.manageiq-vmdb

  tasks:
  - name: Get a vmdb object
    manageiq_vmdb:
      href: "services/80"
    register: vmdb_object

  - name: Create Ec2 Instance
    ec2:
      key_name: "{{ key }}"
      instance_tags: {Name: "{{ name }}"}
      group_id: "{{ security_group }}"
      instance_type: "{{ instance_type }}"
      region: "{{ region }}"
      image: "{{ image }}"
      wait: yes
      count: 1
      vpc_subnet_id: "{{ subnet }}"
      assign_public_ip: yes
    register: ec2

  - name: Service Linking via an href slug
    manageiq_vmdb:
      href: "href_slug::services/80"
      action: add_provider_vms
      data:
        uid_ems:
          - "{{ ec2.instances[0].id }}"
        provider:
          id: 24

  - name: Service Linking via an object
    manageiq_vmdb:
      vmdb: "{{ vmdb_object }}"
      action: add_provider_vms
      data:
        uid_ems:
          - "asdf234"
        provider:
          id: 24

License

Apache

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.