Ansible Integration Inventory

Hello All,

I wanted to understand the below 2 situation.

Statement"
say I have created a ansible integration for a repo which have the code to provision the instance for me and that is bind to tasks + workflow + service catalog. in this case when the catalog gets executed it will provision the VM and details about the same would be present in the ansible integration inventory.

Problem Statement:

  1. how can i have all the pre-existing vms/workflow (say 15 vms for the moment) information added to a newly create integration which is basically create for new repo.

  2. lets say i have playbook for which a task + workflow and catalog is create and the job of this playbook is to create a user on some user selected vms and this code is available on a new dedicated repo and integration is also created for this repo is created (related point - 1 here, by default this new integration inventory would be empty)

For more reference say catalog have inputs like

  1. list of server from a tenant that user need to select
  2. text for username
  3. text for the password

Then what changes I would need to make to accommodate the select host when inventory is empty to execute the playbook

---
  - name: Add a user
    hosts: xxx ### **what changes to do here?**
    gather_facts: false
    tasks:
      - name: Add User
        user:
          name: "{{ morpheus['customOptions']['username'] }}"
          password: "{{ morpheus['customOptions']['password] }}"
          state: present

There’s two ways to deal with limiting hosts, use --limit in the command options, or use an inventory that only contains what you need.

In this case, do you want to select one vm to run the task against, or select multiples based on some criteria? Right now, Morpheus doesn’t allow you to select an arbitrary number of VMs and create an ansible inventory group out of them.

The easiest way to do this currently is to run your ansible task against each instance individually.