#18 Define ansible implementation for the prepare step
Merged 4 years ago by psss. Opened 4 years ago by psss.
fedora-ci/ psss/metadata prepare  into  master

file modified
+12 -2
@@ -130,11 +130,21 @@ 

  * `shell` ... execute arbitratry shell commands to set up the system

  * `ansible` ... apply ansible playbook to get the desired final state

  

- Example config:

+ Example prepare config using the `ansible` implementation:

  

      prepare:

          how: ansible

-         playbook: setup.yml

+         roles:

+             - nginxinc.nginx

+         playbooks:

+             - common.yml

+             - rhel7.yml

+ 

+ One or more playbooks can be provided as a list under the `playbooks` attribute.

+ Each of them will be applied using `ansible-playbook` in the given order.

+ Optional attribute `roles` can be used to enable additional roles.

+ Role can be either an ansible galaxy role name, git url or a path to file with detailed requirements.

+ 

  

  ### Execute

  

Include a full example and description for the ansible prepare
implementation. This resolves #16.

Metadata Update from @psss:
- Pull-request tagged with: L2 Metadata

4 years ago

What is the 'root' location for playbooks?
What about using roles inside playbooks? Will e.g. requirements.yml be supported (as in ansible-galaxy install -r requirements.yml)

Good points! Thanks, @lzachar. I would suggest to keep the ansible playbook root consisent with the metadata tree root. That would be, for the ci.fmf case in dist git, root of the dist git repository. For example:

prepare:
    how: ansible
    playbooks:
        - tests/common.yml
        - tests/rhel7.yml

Regarding extra roles: I think we could provide an easy way to specify which roles should be installed from the ansible galaxy before playbooks are executed:

prepare:
    how: ansible
    roles:
        - nginxinc.nginx
    playbooks:
        - web.yml

Would something like this work for you?

Regarding extra roles: I think we could provide an easy way to specify which roles should be installed from the ansible galaxy before playbooks are executed:
prepare:
how: ansible
roles:
- nginxinc.nginx

Disclaimer - I'm not power user of roles - but you can specify SCM in https://docs.ansible.com/ansible/latest/reference_appendices/galaxy.html#installing-multiple-roles-from-a-file
Which looks like very handy feature.
How about keeping same functionality? In simplest case we could dump them into requirements.yml and let ansible-galaxy to take care of it.

I'd say we start with the simple use case only or support both role names and requirement files under a single roles attribute.

+1 for roles containing (possible) mixture of role names, git URLs or files with requirements.

rebased onto 94cb25f

4 years ago

Thanks for the feedback. Updated.

rebased onto e5373e3

4 years ago

I like it like this for the start, so +1 from me

Pull-Request has been merged by psss

4 years ago
Metadata