After recent updates to sysutils/ansible, the Ansible modules installed via ports like sysutils/ansible-sshjail are not automatically found by the ansible program. We need to address that. The fix is likely to install modules under a different path. We may also add a test target with a command like "ansible localhost -m modulename --check" to avoid such breakage in the future. References: - https://docs.ansible.com/ansible/latest/dev_guide/developing_locally.html
I agree we can use another path for installation. I'm going to create a patch to this effect.
Good point. Now, I'm wondering whether or not it would be useful introducing a new USES=ansible (for lack of better names) target to reduce some of the boilerplate and define a do-test target too. Maybe something like... .if !defined (_INCLUDE_USES_ANSIBLE_MK) _INCLUDE_USES_ANSIBLE_MK= yes .if !${USES:Mpython*} .include "${USESDIR}/python.mk" .endif RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}ansible>0:sysutils/ansible@${PY_FLAVOR} _ANSIBLE_PREFIX?= share/ansible ANSIBLE_PLUGIN= ${_ANSIBLE_PREFIX}/plugins ANSIBLE_MOD= ${ANSIBLE_PLUGIN}/modules .if !target(do-test): # Foo, baz .endif .endif ...in Mk/Uses/ansible.mk. Thoughts?
Created attachment 225011 [details] ansble-base patch I've made some tests and noticed the ansible base uses the following: ${FIND} ${WRKSRC} -not -regex '${WRKSRC}/test/units/cli/galaxy/test_execute_list_collection.py' -type f -print0 | \ ${XARGS} -0 ${REINPLACE_CMD} \ -e 's|/etc/ansible|${ETCDIR}|g' \ -e 's|/usr/share/ansible|${DATADIR}|g' By using DATADIR it point the search paths to /usr/local/share/py38-ansible-base/plugins which looks wrong. also this causes this substitution to create a different path than the one in the ansible port. Upstream code shown they are intended to be the same. So I created the attached patch to address this and put back the original search path Regarding adding a uses it looks like a good idea, but first we should correct the search path and then make such USES point to it.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=c8e37b455176cb3c016a50c671226a9d88f89570 commit c8e37b455176cb3c016a50c671226a9d88f89570 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-05-17 09:59:21 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-05-17 09:59:21 +0000 sysutils/py-ansible-*: Fix DATADIR for Ansible plugins All the Ansible plugins assume that the Ansible DATADIR is ${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible instead of ${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible-base or ${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible-core. This patch sets the DATADIR back to its historical value. It's based on a patch provided by madpilot. PR: 255920 Reported by: madpilot sysutils/py-ansible-base/Makefile | 4 +++- sysutils/py-ansible-core/Makefile | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
(In reply to Guido Falsi from comment #3) I've modified the patch a bit and also updated sysutils/py-ansible-core. I'm almost done with ansible.mk. I'll keep you posted.
(In reply to Lewis Cook from comment #2) I've published my ansible.mk on phabricator: https://reviews.freebsd.org/D30312
I'll close this PR as the modules should be working again. ansible.mk is just something extra we are adding to the framework.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=92939bfde271f881e76fdb94ee5047271d2d1b43 commit 92939bfde271f881e76fdb94ee5047271d2d1b43 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-05-17 11:51:15 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-05-17 13:38:41 +0000 Add USES=ansible for Ansible ports The purpose of this new USES file is to provide a central place for setting Ansible paths for modules and plugins. Perhaps in the future we will extend to reduce boilerplate code in existing Ansible-related ports. PR: 255920 Reported by: lcook Reviewed by: madpilot Differential Revision: https://reviews.freebsd.org/D30312 Mk/Uses/ansible.mk (new) | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)