Hi,
Newbie to Ansible, but I already made a lot of things with it.
One thing, though, I can't do is re-use a task file for adhoc commands or
re-use a playbook in another playbook :
For example, I use a task file (R_packages.yml) in a role, that starts like
this :
- name: Recuperation de la version de R installee
win_shell: (Get-ItemProperty
HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object
DisplayName -like "R for Win*").DisplayVersion
register: Rversion
I'd like to be able to launch it with an ad hoc command like :
ansible-playbook R_packages.yml .....
But it doesn't work :
ERROR! 'register' is not a valid attribute for a Play
I had to create a playbook to launch it :
- hosts: fst-win-tp-bio
gather_facts: "false"
tasks:
- name: Install packages R
import_tasks: /etc/ansible/roles/fst-win-tp-bio/tasks/R_packages.yml
I didn't fond anything in the doc that makes me understand how I could make
an "hybrid" task/playbook file I could launch both ways
To be clear : This task file is part of a role, and I like to be able to
use it from times to times on adhoc command.
Thanks for your help
E.T.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e3b038d6-a99d-4b52-b02c-bdc8c9578c84n%40googlegroups.com.