Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contribute docker-machine inventory #23149

Closed
wants to merge 1 commit into from
Closed

Conversation

briceburg
Copy link
Contributor

@briceburg briceburg commented Mar 30, 2017

SUMMARY

A contributed docker-machine inventory script. Polls available docker machines and creates Ansible inventory, including docker engine connection information.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

contrib/inventory/docker-machine.py

ANSIBLE VERSION
ansible 2.3.0.0
  config file = /dex/home/.ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
ADDITIONAL INFORMATION
Example Output:
{
  "_meta": {
    "hostvars": {
      "node-a": {
        "ansible_host": "172.16.0.8",
        "ansible_port": 22,
        "ansible_private_key_file": "/home/acme/.docker/machine/machines/node-a/id_rsa",
        "ansible_user": "root",
        "docker_engine_host": "tcp://172.16.0.8:2376",
        "docker_engine_tlscacert": "/home/acme/.docker/machine/machines/node-a/ca.pem",
        "docker_engine_tlscert": "/home/acme/.docker/machine/machines/node-a/cert.pem",
        "docker_engine_tlskey": "/home/acme/.docker/machine/machines/node-a/key.pem"
      },
      "node-b": {
        "ansible_host": "172.16.0.9",
        "ansible_port": 22,
        "ansible_private_key_file": "/home/acme/.docker/machine/machines/node-b/id_rsa",
        "ansible_user": "root",
        "docker_engine_host": "tcp://172.16.0.9:2376",
        "docker_engine_tlscacert": "/home/acme/.docker/machine/machines/node-b/ca.pem",
        "docker_engine_tlscert": "/home/acme/.docker/machine/machines/node-b/cert.pem",
        "docker_engine_tlskey": "/home/acme/.docker/machine/machines/node-b/key.pem"
      }
    }
  },
  "node-a": {
    "hosts": [
      "node-a"
    ]
  },
  "node-b": {
    "hosts": [
      "node-b"
    ]
  }
}

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 cloud docker needs_triage Needs a first human triage before being processed. new_plugin This PR includes a new plugin. labels Mar 30, 2017
@ansibot
Copy link
Contributor

ansibot commented Mar 30, 2017

The test ansible-test compile --python 2.6 failed with the following error:

contrib/inventory/docker-machine.py:113:48: SyntaxError: json_data = {m: get_host_and_vars(m) for m in machines}

The test ansible-test sanity --test pep8 failed with the following errors:

contrib/inventory/docker-machine.py:82:1: E302 expected 2 blank lines, found 1
contrib/inventory/docker-machine.py:89:1: E302 expected 2 blank lines, found 1
contrib/inventory/docker-machine.py:90:19: E225 missing whitespace around operator
contrib/inventory/docker-machine.py:105:1: E302 expected 2 blank lines, found 1
contrib/inventory/docker-machine.py:109:39: E231 missing whitespace after ','

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 30, 2017
@sivel
Copy link
Member

sivel commented Mar 30, 2017

This inventory does not implement --host, so it should be including the _meta key in the output.

@briceburg
Copy link
Contributor Author

@sivel great -- thanks for looking. I'll implement and make the pep8 + python 2.6 compat fixes as well.

@briceburg
Copy link
Contributor Author

briceburg commented Mar 30, 2017

@sivel I have updated the script to output the below. Do you recommend any changes? I'm not sure if the engine connection info should be stored under hostvars or group vars. Thanks!

{
  "_meta": {
    "hostvars": {
      "node-a": {
        "ansible_host": "172.16.0.8",
        "ansible_port": 22,
        "ansible_private_key_file": "/home/acme/.docker/machine/machines/node-a/id_rsa",
        "ansible_user": "root",
        "docker_engine_host": "tcp://172.16.0.8:2376",
        "docker_engine_tlscacert": "/home/acme/.docker/machine/machines/node-a/ca.pem",
        "docker_engine_tlscert": "/home/acme/.docker/machine/machines/node-a/cert.pem",
        "docker_engine_tlskey": "/home/acme/.docker/machine/machines/node-a/key.pem"
      },
      "node-b": {
        "ansible_host": "172.16.0.9",
        "ansible_port": 22,
        "ansible_private_key_file": "/home/acme/.docker/machine/machines/node-b/id_rsa",
        "ansible_user": "root",
        "docker_engine_host": "tcp://172.16.0.9:2376",
        "docker_engine_tlscacert": "/home/acme/.docker/machine/machines/node-b/ca.pem",
        "docker_engine_tlscert": "/home/acme/.docker/machine/machines/node-b/cert.pem",
        "docker_engine_tlskey": "/home/acme/.docker/machine/machines/node-b/key.pem"
      }
    }
  },
  "node-a": {
    "hosts": [
      "node-a"
    ]
  },
  "node-b": {
    "hosts": [
      "node-b"
    ]
  }
}

@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Mar 30, 2017
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Mar 30, 2017
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label Mar 31, 2017
@bcoca bcoca added this to TODO in Inventory revamp Apr 6, 2017
@bcoca bcoca moved this from TODO to Done in Inventory revamp Apr 6, 2017
@bcoca bcoca removed this from Done in Inventory revamp Apr 6, 2017
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 11, 2017
@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@alikins alikins added the new_inventory This PR includes a new inventory plugin. label Jul 18, 2017
@ansibot ansibot added the inventory Inventory category label Jul 18, 2017
@ansibot ansibot added support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 9, 2017
@ansibot ansibot added the community_review In order to be merged, this PR must follow the community review workflow. label Oct 25, 2018
@ansibot
Copy link
Contributor

ansibot commented Oct 28, 2018

@gundalow
Copy link
Contributor

gundalow commented Dec 4, 2018

Hi,
This PR seems to have gotten stuck, so we are going to close it. We like to include community contributions, so this is a difficult call for us. Here's why we're closing this one:

  • Given the discussion in Docker Agenda/Task list community#408 (comment)
  • It was created from an old version of the code
  • We want to clear out the backlog so it's easier to find bug fixes
  • There haven't been any comments or other activity in a long time

If you're the PR author, and you want to start the conversation back up, please:

  • reopen the PR and
  • rebase the branch

If you're a community member, and you want to see this change merged, please:

  • Create a new PR and
  • Reference this author in the git commit & PR and
  • Reference this PR in the new PR

If you've like to help with the Docker modules please comment on the Docker Agenda/Task List

How to rebase a branch: https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html
How to communicate with the Ansible community: https://docs.ansible.com/ansible/devel/community/communication.html
How to contribute to Ansible: https://docs.ansible.com/ansible/devel/community/index.html

needs_info

@gundalow gundalow closed this Dec 4, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 c:inventory/contrib_script cloud community_review In order to be merged, this PR must follow the community review workflow. docker inventory Inventory category new_inventory This PR includes a new inventory plugin. new_plugin This PR includes a new plugin. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants