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

start-at-task does not work with tasks inside an include within a role #15735

Closed
jordiclariana opened this issue May 5, 2016 · 6 comments · Fixed by #16192
Closed

start-at-task does not work with tasks inside an include within a role #15735

jordiclariana opened this issue May 5, 2016 · 6 comments · Fixed by #16192
Assignees
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release

Comments

@jordiclariana
Copy link

jordiclariana commented May 5, 2016

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.0.2.0
  config file = /tmp/ansible-test/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

[defaults]
roles_path = roles

OS / ENVIRONMENT

Ubuntu 15.10 and/or 14.04

SUMMARY

The switch --start-at-task for ansible-playbook does not work when specifying a task name that is inside a task file included in a role.

STEPS TO REPRODUCE

Executing this:
ansible-playbook -i localhost, -c local playbook.yml --start-at-task="debug extra 2"

It fails regadless the connection is local or not.

Here are the example playbook and role.:

playbook.yml


---

- name: Test playbook
  hosts: all

  roles:
    - { role: myrole }

roles/myrole/tasks/main.yml


---

- name: debug 1
  debug: msg=1

- name: debug 2
  debug: msg=3

- name: debug 3
  debug: msg=3

- include: extra.yml

roles/myrole/tasks/extra.yml


---

- name: debug extra 1
  debug: msg="extra 1"

- name: debug extra 2
  debug: msg="extra 2"

- name: debug extra 3
  debug: msg="extra 4"
EXPECTED RESULTS

Ansible should start running tasks from the task specified

PLAY [Test playbook] ***********************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [myrole : include] ********************************************************
included: /tmp/ansible-test/roles/myrole/tasks/extra.yml for localhost

TASK [myrole : debug extra 2] **************************************************
ok: [localhost] => {
    "msg": "extra 2"
}

TASK [myrole : debug extra 3] **************************************************
ok: [localhost] => {
    "msg": "extra 4"
}

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0   
ACTUAL RESULTS

No task is run at all.

$ ansible-playbook -i localhost, -c local playbook.yml --start-at-task="debug extra 2" -vvvv
Using /tmp/ansible-test/ansible.cfg as config file
Loaded callback default of type stdout, v2.0

PLAYBOOK: playbook.yml *********************************************************
1 plays in playbook.yml

PLAY [Test playbook] ***********************************************************

PLAY RECAP *********************************************************************
@nitzmahone nitzmahone added bug_report P2 Priority 2 - Issue Blocks Release labels May 5, 2016
@gamename
Copy link
Contributor

gamename commented May 8, 2016

+1

@sbwoodside
Copy link

Why is this closed? Bug still exists in 2.2.1.0.

@jimi-c
Copy link
Member

jimi-c commented Feb 24, 2017

@sbwoodside because it is a known limitation of using dynamic includes. We have this documented, if you need to start-at-task in includes, they must be static includes.

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@thatsk
Copy link

thatsk commented Jul 11, 2018

what if there are mutiple common task defined as generic and they are taking as paramter and want to start at task ?

@thatsk
Copy link

thatsk commented Jul 11, 2018


  • name: Syncing pulp
    hosts: pulp server
    any_errors_fatal: True
    tasks:

    • include_tasks: /etc/ansible/inventories/playbooks/common/pulprpmcheck.yml
      with_items:
      • { rpmname: 'rpmname1' }
      • { rpmname: 'rpmname2' }
  • name: Starting deployment
    any_errors_fatal: True
    hosts: node2
    tasks:

    • name: Running puppet & checking rpms are deployed or not
      block:
      • include_tasks: /etc/ansible/inventories/playbooks/common/puppet.yaml
      • include_tasks: /etc/ansible/inventories/playbooks/common/rpmcheck.yaml
        with_items:
        • { rpmname: 'rpmname1'}
        • { rpmname: 'rpmname2'}

@thatsk
Copy link

thatsk commented Jul 11, 2018

what if i want to start with --start-at-task='Running puppet & checking rpms are deployed or not' ?

@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
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants