ahelal / kitchen-ansiblepush

test-kitchen plugin to use ansible in push mode
41 stars 22 forks source link

How to add single instance to inventory? #47

Closed johnjelinek closed 5 years ago

johnjelinek commented 6 years ago

In my hosts inventory, I have a standalone server like this:

example ansible_host=somehost.example.com

it's not in a group -- how would I define this in .kitchen.yml?

ahelal commented 6 years ago

not sure what you mean. Since the default way to run kitchen-ansiblepush it will generate an inventory file.

johnjelinek commented 6 years ago

Yes, but how do you add arbitrary extra vars to a single inventory item or to a host that isn't managed by Test kitchen (for integration tests)?

On Feb 16, 2018 11:48 AM, "Adham" notifications@github.com wrote:

not sure what you mean. Since the default way to run kitchen-ansiblepush it will generate an inventory file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ahelal/kitchen-ansiblepush/issues/47#issuecomment-366308068, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1UitegM8DKlzelme6oaY05fxyM1t1mks5tVb9egaJpZM4SHYDZ .

ahelal commented 6 years ago

Sorry again i am not following the use-case. If it is not managed by test-kitchen then what is the connection?. If you can provide a repo ? or a more detailed use-case.

johnjelinek commented 6 years ago

I have a role and the role connects to an external server to download binaries based on activity that happens from remote process execution. I don't want to mock out that server to test my role, so that server needs to be in the inventory that gets generated. Also, I need to set vars like ansible_ssh_user to connect to it.

On Feb 19, 2018 1:24 PM, "Adham" notifications@github.com wrote:

Sorry again i am not following the use-case. If it is not managed by test-kitchen then what is the connection?. If you can provide a repo ? or a more detailed use-case.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ahelal/kitchen-ansiblepush/issues/47#issuecomment-366783247, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1UijMAD1ZbMaDCm_dZ2rUMp2zQWVXdks5tWcpwgaJpZM4SHYDZ .

ahelal commented 6 years ago

Well i don't have a good answer, since I never had the need for such use case. My best guess is one of either

  1. Use the raw_arguments and add -i external.ini with your file and i think with the latest ansible you can kind of merge inventory

  2. Maintain your inventory and not use the ansiblepush-kitchen dynamic inventory.

Good luck

jmcmaster05 commented 6 years ago

Raw Arguments Solution

provisioner:
  name: ansible_push
  ...
  raw_arguments: "-i tests/inventory"

[mygroup] server.domain.com

Groups Solution (thanks @johnjelinek )

provisioner:
  name: ansible_push
  ...
  groups:
    mygroup:
      - server.domain.com