Hi!

I would like to load Tasks or Playbooks from file.
I created a setup using http://docs.ansible.com/ansible/developing_api.html for 
ansible 2.0 python-api.
Currently I have this: https://gist.github.com/catmin/cd51dda473ebeb3e99e8

Aim is to have a File (instead of the dict) containing Ansible tasks and 
and run them via Play() and TaskQueueManager() - as stated in the following 
example.

task-file:

  tasks:
  - copy: src=files/foo dest=/tmp/foo owner=root group=root mode=0644
  - sysctl: name=net.ipv4.ip_forward value=1 state=present
  - apt: name=wget state=absent

I'm looking for something like this:

f = open('task_file','r')
play_source =  dict(
        name = "Ansible Play",
        hosts = '192.168.56.212',
        gather_facts = 'no',
        tasks = read_tasks_from_file(f.read())
    )


Is there a method or Class to do that?

Thank you!

- Reinhard


Ansible Version:

ansible 2.0.0.2


Environment:

docker python-2.7



-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0e524ce8-6b41-4f09-b3c2-fded613c93ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to