Does Ansible support inclusion of no-op/empty/placeholder tasks?

10 views
Skip to first unread message

Behrang Saeedzadeh

unread,
Oct 12, 2017, 2:44:01 AM10/12/17
to Ansible Project
In some test frameworks, we can start a test suite by providing a list of empty tests. Then we can implement the tests one by one.

Similarly, I want to start a playbook by only providing the set of tasks I want to execute, without implementing them:

- hosts: localhost
  tasks:
    - name: Step 1
    - name: Step 2
    - name: Step 3

But this is invalid syntax in Ansible.

Any workarounds available to do this?

Jordan Borean

unread,
Oct 12, 2017, 2:55:13 AM10/12/17
to Ansible Project
The easiest way is to use the debug module and you can output an empty string, it would work like this

- name: test 1
  debug:
    msg: ""

- name: test 2
  debug:
     msg: ""

You can also use meta: noop but it isn't recommended for general use, it would work like this

- name: test 1
  meta: noop

- name: test 2
  meta: noop

Thanks

Jordan
Reply all
Reply to author
Forward
0 new messages