Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That looks great!

I'm trying to do a similar thing but I'd like to be compatible with the existing Ansible tasks. Still trying to figure out the API, especially for cases like calling a playbook from playbook with some parameters.



I am looking at adding the ability to call Ansible tasks (community.apt, for example) from uPlaybook, but that would not involve calling YAML playbooks I'm not thinking... But maybe that would be possible.

I did try some other YAML control structures in the original version of uPlaybook, what I'm calling uPlaybook1 [1] now, which I think has some more natural control structures than Ansible. If you are doing something similar, may be worth looking at what I came up with:

- I ended up using "block:" as a way of grouping tasks, and you could add conditionals or loops on those:

    block:
      tasks:
        - copy:
          [args here]
        - command:
          [more args here]
      loop:
        - vars:
          basename: XXX
        - vars:
          basename YYY
- Conditionals were also blocks and could be nested within loops:

    - if:
      condition: "x < 1"
      tasks:
        - copy:
          [args here]
    - elif:
      condition: "x >= 1 and x < 10"
      tasks:
        [tasks here]
    - else:
      tasks:
        [more tasks here]
[1] https://github.com/linsomniac/uplaybook1




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: