task file includes

Hi,

I’m trying to include a subset of OS tasks in another task file, which in turn is included in the main book, ie.

playbook.yml
→ include: tasks/os_common.yml
→ include: sysctl.yml

os_common.yml contains a bunch of normal tasks in addition to the include:

Can you please post these files on gist.github.com so we can see them
with formatting?

Please also include the command you are using to run things in the gist.

Thanks!

https://gist.github.com/pjoakimsson/d06a726ef1e6840d2b44

If I skip os_common.yml, i.e. specify sysctl.yml as include file in main.yml it works just fine…

PJ, I believe your sysctl.yml task include needs the action attribute:


  lineinfile: dest=/etc/sysctl.conf regexp=^kernel.core_pattern line="kernel.core_pattern = /var/cores/core_%h_%e.%p"

becomes …


  action: lineinfile dest=/etc/sysctl.conf regexp=^kernel.core_pattern line="kernel.core_pattern = /var/cores/core_%h_%e.%p"

Indeed, thanks for spotting it.
That would still imply that shorthands doesn’t work in that structure and that it’s also unable to pick up the task name when producing the error message.

Is this something that I should create a ticket on perhaps?

Might be a good idea, at the least we can spawn a document ticket from it to make sure its very clear in the documentation.

I revert that… tried to set it up again and failed to reproduce the successful run (maybe I managed to fiddle with the wrong playbook yesterday).

I still get ‘ERROR: ‘action’ or ‘local_action’ attribute missing in task “”’

Did some initial debugging it seems it expects action/local_action in the os_common.yml and don’t even read sysctl.yml before exiting.

Tested on the devel branch and there it works fine… I was running my initial tests on 0.9.

case closed. :slight_smile: