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

debugging module invocations in playbooks #11680

Closed
amenonsen opened this issue Jul 21, 2015 · 2 comments
Closed

debugging module invocations in playbooks #11680

amenonsen opened this issue Jul 21, 2015 · 2 comments
Labels
feature This issue/PR relates to a feature request.

Comments

@amenonsen
Copy link
Contributor

Issue type: Feature idea
Ansible version: NA
Ansible configuration: NA
Environment: NA
Summary:

I find myself often building up complex module invocations, e.g. for the ec2 module:

# Create EC2 instances using the VPC subnets and security groups and
# access key we configured above.

- name: Set up EC2 instances
  ec2:
    exact_count: 1
    count_tag: "{{ cluster_tags }}"
    image: "{{ item.0.image }}"
    region: "{{ item.0.region }}"
    group_id: "{{ item.2.group_id }}"
    instance_type: "{{ item.0.type }}"
    vpc_subnet_id: "{{ item.1.subnets[0].id }}"
    instance_tags: "{{ cluster_tags | merge(item.0.tags) }}"
    key_name: "{{ ec2_key_name }}"
    assign_public_ip: yes
    volumes: "{{ item.0.volumes }}"
    wait: yes
  with_together:
    - instances
    - vpcs.results
    - security_groups.results
  register: ec2_instances

…and then, when something goes wrong, adding a bunch of debug: tasks above this to see what's actually getting passed in. It would be enormously and outrageously useful to be able to just add debug: to the beginning of this task and have it dump the arguments. If it's hard to deal with debug: ec2: … for some reason, I would be equally happy with debug: [no ec2:, but original args]. (Related to this is that debug ignores arguments it doesn't understand and just prints "here we are".)

Steps to reproduce: NA
Expected results: NA
Actual results: NA

@sheldonh
Copy link
Contributor

I would prefer

- name: Set up EC2 instances
  debug_args: true
  ec2:
    exact_count: 1
    ...

@amenonsen
Copy link
Contributor Author

Note: just returning dict(failed=True, msg=str(self._task.args)) from plugins/action/debug.py does most of what I wanted, and adding debug to the list of RAW_PARAM_MODULES in parsing/mod_args.py makes it possible to debug tasks like command, which take raw args.

@jimi-c jimi-c closed this as completed in d6d523b Sep 1, 2015
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_idea labels Mar 2, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue/PR relates to a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants