--Hello. Now I do sime things from roles/host_generic/tasks/main.yaml:- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'bash'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'bash-completion'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: "{{generic_vim_pkg_name}}"
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'screen'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'logrotate'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'sudo'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'wget'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'rsync'
- include: ../../includes_common/pkg_from_repo.yaml
vars:
name: 'munin-node'I guess it's a long way. Is it possible to reuse some code from roles shorter? Using role from other role will be perfect solution, but I unable to found way how.
roles/includes_common/pkg_from_repo.yaml is installer for all possible operation systems is I replace includes in previous file to modules command, this file will bigger at 3-4 times.---- name: install RedHat packageyum: name="{{name}}" state=presentwhen: ansible_os_family == 'RedHat'- name: install RedHat packageapt: name="{{name}}" state=presentwhen: ansible_os_family == 'Debian'- name: install RedHat packageopenbsd_pkg: name="{{name}}" state=presentwhen: ansible_system == 'OpenBSD'- name: install FreeBSD packagepkgng: name="{{name}}" state=presentwhen: ansible_system == 'FreeBSD'Also, it is incorrect decision to move pkg_from_repo.yaml to another directory like roles/host_generic/tasks, because from other roles it will be called as "include: ../../host_genetic/tasks/pkg_from_files.yaml" - much more text in call.
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ab61eb2a-8a0e-4652-8d9a-0bf61cb73c9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALGZhhswdnkPEKg20dixdJ8PjnDnCzfTW1U7Z%3Dh1HLjF3TKRuQ%40mail.gmail.com.