diff --git a/changelogs/fragments/78204-galaxy-role-file-detection.yml b/changelogs/fragments/78204-galaxy-role-file-detection.yml new file mode 100644 index 00000000000..3659285f940 --- /dev/null +++ b/changelogs/fragments/78204-galaxy-role-file-detection.yml @@ -0,0 +1,3 @@ +bugfixes: +- ansible-galaxy - Fix detection of ``--role-file`` in arguments for implicit role invocation + (https://github.com/ansible/ansible/issues/78204) diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index b2998eab699..f11150f834d 100755 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -501,7 +501,12 @@ class GalaxyCLI(CLI): else: install_parser.add_argument('-r', '--role-file', dest='requirements', help='A file containing a list of roles to be installed.') - if self._implicit_role and ('-r' in self._raw_args or '--role-file' in self._raw_args): + + r_re = re.compile(r'^(?