Bug 240788 - [NEW PORT] sysutils/ansible-sysrc: Ansible module to set sysvars in rc.conf
Summary: [NEW PORT] sysutils/ansible-sysrc: Ansible module to set sysvars in rc.conf
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Raphael Kubo da Costa
URL: https://github.com/dlundgren/ansible-...
Keywords: feature, needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2019-09-24 11:59 UTC by Lewis Cook
Modified: 2019-11-04 21:15 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (lcook)


Attachments
port diff (2.92 KB, patch)
2019-09-24 11:59 UTC, Lewis Cook
no flags Details | Diff
port diff fixed (2.96 KB, patch)
2019-09-24 12:15 UTC, Lewis Cook
no flags Details | Diff
port diff fix(?) (2.98 KB, patch)
2019-09-24 12:49 UTC, Lewis Cook
no flags Details | Diff
port diff (3.02 KB, patch)
2019-09-24 13:15 UTC, Lewis Cook
no flags Details | Diff
port diff final (3.04 KB, patch)
2019-09-24 23:14 UTC, Lewis Cook
lcook: maintainer-approval+
Details | Diff
updated (3.08 KB, patch)
2019-11-03 14:03 UTC, Lewis Cook
no flags Details | Diff
port diff (3.03 KB, patch)
2019-11-03 20:39 UTC, Lewis Cook
no flags Details | Diff
port diff (3.00 KB, patch)
2019-11-04 14:50 UTC, Lewis Cook
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lewis Cook freebsd_committer freebsd_triage 2019-09-24 11:59:00 UTC
Created attachment 207758 [details]
port diff

Ansible module to manipulate rc.conf on a FreeBSD system
via sysrc. The current states available are: append,
absent, present and subtract.
Comment 1 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 12:03:21 UTC
WWW: https://github.com/dlundgren/ansible-freebsd-modules/
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-24 12:08:48 UTC
Thank you for contributing a new port Lewis

Note:

'ansible' (the binary) only exists for the default (Python) version of the Ansible port, which may not be the Python version with which this and other ansible module ports may be build with by the user.

Use RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}ansible>0:sysutils/ansible@${PY_FLAVOR} instead.
Comment 3 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 12:14:41 UTC
(In reply to Kubilay Kocak from comment #2)

Oops! Sorry about that. I'll update the diff now, and the port I submitted earlier too (ansible-kld). Cheers!
Comment 4 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 12:15:35 UTC
Created attachment 207760 [details]
port diff fixed

Replaced RUN_DEPENDS with the updated value as requested.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-24 12:22:07 UTC
Thanks Lewis!

A couple more things:

- ansible-config needs to be the Python-version specific binary: ansible-config-PYTHON_VER 
- One should be able to use PYTHON_PKGNAMEPREFIX instead of py[0-9]{2} in the ANSIBLE_MOD line.

Please do the same for bug 240789 and future ansible module ports
Comment 6 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 12:49:22 UTC
(In reply to Kubilay Kocak from comment #5)

Thanks for your suggestions. I've applied the changes as said, although I'm facing this following error: https://s.wired.sh/~vulcan/uoAyITBhaPAjjulyOiqb. Either I've typed something incorrectly, or there's something else going on. 

Here's what I've done:

- svn checkout head to /usr/ports;
- Add the port and attempt to build the package;
- That error gets thrown.

I have a feeling this a simple fix, or that I'm missing out on something. Thanks for your time.
Comment 7 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 12:49:47 UTC
Created attachment 207762 [details]
port diff fix(?)
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-24 13:01:52 UTC
(In reply to Lewis Cook from comment #6)

The error indicates that PYTHON_PKGNAMEPREFIX wasn't being prefixed to 'ansible' in the RUN_DEPENDS line, but the latest diff looks ok. Was the "fix(?) patch produced to fix the error, or is that the version *with* the error?

Also, while we're here, we're going to need to PKGNAMEPREFIX=PYTHON_PKGNAMEPREFIX to the port too, as it will be built for/with a specific Python version

Same in bug 40789 too

The best way to do ports QA is with portlint/poudriere, see: https://www.freebsd.org/doc/en/books/porters-handbook/testing.html
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-24 13:09:36 UTC
Same in bug 240789 rather

Also: PYTHON_PKGNAMEPREFIX already contains a '-' character, so - is not needed in the ANSIBLE_MOD line
Comment 10 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 13:14:26 UTC
(In reply to Kubilay Kocak from comment #8)

The patch I submitted was *with* the error. I'll also add the PKGNAMEPREFIX and remove the trailing '-' now.
Comment 11 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 13:15:50 UTC
Created attachment 207763 [details]
port diff

Are you able to reproduce any errors from this patch?
Comment 12 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 13:16:34 UTC
About to reflect these changes in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240789 too.
Comment 13 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 16:54:03 UTC
(In reply to Kubilay Kocak from comment #9)

Managed to quickly setup poudriere on a server. Started the build process which yielded the results:

> [00:00:02] Warning: (sysutils/ansible-kld): Error: sysutils/ansible-kld has dependency on sysutils/ansible with invalid empty FLAVOR; Please contact maintainer of the port to fix this.
> [00:00:02] Warning: (sysutils/ansible-sysrc): Error: sysutils/ansible-sysrc has dependency on sysutils/ansible with invalid empty FLAVOR; Please contact maintainer of the port to fix this.

Turns out, the whole reasoning earlier for the error is because of a one line fix: 

> USES=python

Which would then define the values for PY_FLAVOR which was previously undefined. I'm 99.9% sure that this is the issue, and if such is the case I'll submit the patches for ansible-kld and ansible-sysrc and go from there, just wanted to confirm this with you. Thanks!

I cant say I've created a python port before so I'm a little rusty in this area. :)
Comment 14 Lewis Cook freebsd_committer freebsd_triage 2019-09-24 23:14:55 UTC
Created attachment 207779 [details]
port diff final

Added 'USES=python' in the Makefile, fixing the undefined 'PY_FLAVOR' error when building.
Comment 15 Lewis Cook freebsd_committer freebsd_triage 2019-09-27 14:52:32 UTC
Bump
Comment 16 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-03 11:48:28 UTC
Hi. I've tried building this port on Poudriere, and the ANSIBLE_MOD/PLIST_FILES lines fail:

=======================<phase: stage          >============================
===>  Staging for py36-ansible-sysrc-0.1
===>   py36-ansible-sysrc-0.1 depends on package: py36-ansible>0 - found
===>   py36-ansible-sysrc-0.1 depends on file: /usr/local/bin/python3.6 - found
===>   Generating temporary packing list
Unhandled error:
 Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'


Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-config-3.6", line 60, in <module>
    import ansible.constants as C
  File "/usr/local/lib/python3.6/site-packages/ansible/constants.py", line 189, in <module>
    config = ConfigManager()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 263, in __init__
    self.update_config_data()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 535, in update_config_data
    raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

/bin/mkdir -p /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/stage$(ansible-config-3.6 dump | /usr/bin/egrep -o '/usr/local/share/py36-ansible/plugins/modules')
Unhandled error:
 Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'


Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-config-3.6", line 60, in <module>
    import ansible.constants as C
  File "/usr/local/lib/python3.6/site-packages/ansible/constants.py", line 189, in <module>
    config = ConfigManager()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 263, in __init__
    self.update_config_data()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 535, in update_config_data
    raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

install  -m 555 /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/ansible-freebsd-modules-cf37fc1e16fc03852abc8933e7959b22b51a5c90/library/sysrc /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/stage$(ansible-config-3.6 dump | /usr/bin/egrep -o '/usr/local/share/py36-ansible/plugins/modules')/sysrc
Unhandled error:
 Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'


Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 77, in makedirs_safe
    os.makedirs(b_rpath, mode)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 523, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 467, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 110, in ensure_type
    makedirs_safe(value, 0o700)
  File "/usr/local/lib/python3.6/site-packages/ansible/utils/path.py", line 82, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
ansible.errors.AnsibleError: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-config-3.6", line 60, in <module>
    import ansible.constants as C
  File "/usr/local/lib/python3.6/site-packages/ansible/constants.py", line 189, in <module>
    config = ConfigManager()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 263, in __init__
    self.update_config_data()
  File "/usr/local/lib/python3.6/site-packages/ansible/config/manager.py", line 535, in update_config_data
    raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'

Switching to USES_PYTHON=autoplist, it fails with:

===>   Generating temporary packing list
/bin/mkdir -p /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/stage
install  -m 555 /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/ansible-freebsd-modules-cf37fc1e16fc03852abc8933e7959b22b51a5c90/library/sysrc /wrkdirs/usr/ports/sysutils/ansible-sysrc/work/stage/sysrc
====> Compressing man pages (compress-man)
===========================================================================
====> Running Q/A tests (stage-qa)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: /sysrc
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1
Comment 17 Lewis Cook freebsd_committer freebsd_triage 2019-11-03 14:02:41 UTC
(In reply to Raphael Kubo da Costa from comment #16)

Thanks for your report.

That's odd. I don't think the problem stems from the port itself, but rather the value of 'DEFAULT_LOCAL_TMP' as it doesn't seem to have permission to write to the directory, referring to the error below:

Unable to create local directories(/nonexistent/.ansible/tmp): [Errno 13] Permission denied: b'/nonexistent'.

I'm unable to reproduce this error within Poudriere or on my local machine too. When running stage-qa I was prompted to add the shebang fix:

====> Running Q/A tests (stage-qa)
Error: '/usr/bin/python' is an invalid shebang you need USES=shebangfix for 'share/py36-ansible/plugins/modules/sysrc'.

Which I have now reflected in the Makefile, now it doesn't use a hard-coded path to Python in the sysrc Ansible module, instead patched with the Python version used to build the port. Upon making this change I no longer am prompted with changes to be made.

'USES_PYTHON=autoplist' I believe isn't _needed_ either in this particular case as PLIST_FILES will resolve the 'sysrc' module. Which is more than likely causing the stage-qa error.

From what I've extrapolated from the errors posted it's more of a permission issue and the inability to write to the value of 'DEFAULT_LOCAL_TMP' in the Ansible configuration. Cheers.

* On another note, replaced ${EGREP} with ${GREP} as extended regex isn't necessary. Also have formatted the Makefile with portfmt.
Comment 18 Lewis Cook freebsd_committer freebsd_triage 2019-11-03 14:03:17 UTC
Created attachment 208820 [details]
updated
Comment 19 Lewis Cook freebsd_committer freebsd_triage 2019-11-03 14:40:31 UTC
Followed up these changes in bug #240814 and bug #240789.
Comment 20 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-03 17:49:54 UTC
I got the same "PermissionError: [Errno 13] Permission denied: b'/nonexistent'" errors in Poudriere when testing the latest version of the patch. FTR, I'm using "poudriere testport" to test this.

Since the port's installing just on file, isn't it easier to just have

  ANSIBLE_MOD= ${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible/plugins/modules

instead of invoking ansible-config and grepping for a value you already have?
Comment 21 Lewis Cook freebsd_committer freebsd_triage 2019-11-03 20:37:33 UTC
(In reply to Raphael Kubo da Costa from comment #20)

I created a new fresh environment for the build, then ran:

> poudriere testport -j builder-amd64 -p devel -c sysutils/ansible-sysrc
And was still unable to reproduce the error you've been facing. For the build logs, see here: https://s.wired.sh/~vulcan/log/py36-ansible-sysrc-0.1.log — which leads me to believe there's something not quite right in your jail build environment.

Also, made the amendment of ANSIBLE_MOD. Didn't seem to catch that, cheers! (I'll again forward the changes to bug #240814 and bug #240789). :)
Comment 22 Lewis Cook freebsd_committer freebsd_triage 2019-11-03 20:39:56 UTC
Created attachment 208827 [details]
port diff

* Amended ANSIBLE_MOD, remove un-needed call to 'ansible-config'.
Comment 23 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-04 09:09:58 UTC
Comment on attachment 208827 [details]
port diff

Removing the call to ansible-config finally made the port build fine here. The difference could be that I'm using poudriere-devel, but other than that I'm just invoking `poudriere testport -p default -j 13amd64 -i -o sysutils/ansible-sysrc' and have DEVELOPER_MODE=yes in make.conf.

As for the patch, one thing that can still be improved:

+ANSIBLE_MOD=	${PREFIX}/share/${PYTHON_PKGNAMEPREFIX}ansible/plugins/modules
+
+PLIST_FILES=	$$(${ECHO_CMD} ${ANSIBLE_MOD} | ${SED} -e 's|${PREFIX}/||')/sysrc

The echo+sed combination is unnecessary, remember you're setting ANSIBLE_MOD yourself. My suggestion is to do something like

  ANSIBLE_MOD_REL= share/${PYTHON_PKGNAMEPREFIX}ansible/plugins/modules
  PLIST_FILES= ${ANSIBLE_MOD_REL}/sysrc
  do-install:
    [...]
    ${INSTALL_SCRIPT} ${WRKSRC}/library/sysrc ${STAGEDIR}${PREFIX}/${ANSIBLE_MOD_REL}/sysrc
Comment 24 Lewis Cook freebsd_committer freebsd_triage 2019-11-04 14:49:01 UTC
(In reply to Raphael Kubo da Costa from comment #23)
Glad that's been resolved.

Thanks for the guidance, I'll take this into account with any further port submissions. Will make these changes in this port as well as bug #240814 and bug #240789. Cheers!
Comment 25 Lewis Cook freebsd_committer freebsd_triage 2019-11-04 14:50:02 UTC
Created attachment 208857 [details]
port diff

* Further revision of Makefile as suggested.
Comment 26 commit-hook freebsd_committer freebsd_triage 2019-11-04 20:21:28 UTC
A commit references this bug:

Author: rakuco
Date: Mon Nov  4 20:21:01 UTC 2019
New revision: 516737
URL: https://svnweb.freebsd.org/changeset/ports/516737

Log:
  New port: sysutils/ansible-sysrc

  Ansible module to manipulate rc.conf on a FreeBSD system via sysrc. The
  current states available are: append, absent, present and subtract.

  PR:		240788
  Submitted by:	Lewis Cook <vulcan@wired.sh>

Changes:
  head/sysutils/Makefile
  head/sysutils/ansible-sysrc/
  head/sysutils/ansible-sysrc/Makefile
  head/sysutils/ansible-sysrc/distinfo
  head/sysutils/ansible-sysrc/pkg-descr
Comment 27 Raphael Kubo da Costa freebsd_committer freebsd_triage 2019-11-04 20:22:46 UTC
Thank you!
Comment 28 Lewis Cook freebsd_committer freebsd_triage 2019-11-04 21:15:32 UTC
Awesome. Cheers!