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

Allow adhoc to execute includes and imports #43131

Merged
merged 1 commit into from
Jul 23, 2018

Conversation

sivel
Copy link
Member

@sivel sivel commented Jul 22, 2018

SUMMARY

Allow adhoc to execute includes and imports

I thought I submitted this a while ago, but seem not to have done so.

Addresses ansible/proposals#131

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/cli/adhoc.py

ANSIBLE VERSION
2.7
ADDITIONAL INFORMATION

include_tasks:

$ ansible localhost -m include_tasks -a include_me.yml
localhost | SUCCESS => {
    "changed": false,
    "include": "include_me.yml",
    "include_variables": {}
}
localhost | SUCCESS => {
    "msg": "here"
}

import_tasks:

$ ansible localhost -m import_tasks -a include_me.yml
localhost | SUCCESS => {
    "msg": "here"
}

include_role:

$ ansible localhost -m include_role -a name=bob
localhost | SUCCESS => {
    "changed": false,
    "include_variables": {
        "name": "bob"
    }
}
localhost | SUCCESS => {
    "msg": "bob"
}

import_role:

$ ansible localhost -m import_role -a name=bob
localhost | SUCCESS => {
    "msg": "bob"
}

@sivel sivel requested a review from bcoca July 22, 2018 12:36
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 22, 2018
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jul 23, 2018
@bcoca bcoca merged commit 35b4b19 into ansible:devel Jul 23, 2018
@clayg
Copy link

clayg commented Dec 3, 2018

I came to this through a reference on ansible/proposals#131 - i'm not sure if this is what I'm looking for? Where is the current documentation?

@bcoca
Copy link
Member

bcoca commented Dec 4, 2018

@clayg there is no specific documentation, you can just execute them like you execute any other module with adhoc: ansible -m include_role -a 'name=rolname' myhosts

@ChristianCiach
Copy link

ChristianCiach commented May 27, 2019

This worked with Ansible 2.7, but it broken with 2.8.0 for me:

$ ansible all -i hosts.yml -m include_role -a "name=myrole"

ERROR! 'async_val' is not a valid attribute for a IncludeRole

The error appears to be in 'None': line 0, column 0, but may
be elsewhere in the file depending on the exact syntax problem.

(could not open file to display line)

@sivel
Copy link
Member Author

sivel commented May 29, 2019

This was re-fixed in cd95843

@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.7 This issue/PR affects Ansible v2.7 feature This issue/PR relates to a feature request. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants