@ -490,12 +490,31 @@ class GalaxyCLI(CLI):
ignore_errors_help = ' Ignore errors during installation and continue with the next specified ' \
ignore_errors_help = ' Ignore errors during installation and continue with the next specified ' \
' collection. This will not ignore dependency conflict errors. '
' collection. This will not ignore dependency conflict errors. '
else :
else :
args_kwargs [ ' help ' ] = ' Role name, URL or tar file '
args_kwargs [ ' help ' ] = ' Role name, URL or tar file . This is mutually exclusive with -r. '
ignore_errors_help = ' Ignore errors and continue with the next specified role. '
ignore_errors_help = ' Ignore errors and continue with the next specified role. '
if self . _implicit_role :
# might install both roles and collections
description_text = (
' Install roles and collections from file(s), URL(s) or Ansible '
' Galaxy to the first entry in the config COLLECTIONS_PATH for collections '
' and first entry in the config ROLES_PATH for roles. '
' The first entry in the config ROLES_PATH can be overridden by --roles-path '
' or -p, but this will result in only roles being installed. '
)
prog = ' ansible-galaxy install '
else :
prog = f " ansible-galaxy { galaxy_type } install "
description_text = (
' Install {0} (s) from file(s), URL(s) or Ansible '
' Galaxy to the first entry in the config {1} S_PATH '
' unless overridden by -- {0} s-path. ' . format ( galaxy_type , galaxy_type . upper ( ) )
)
install_parser = parser . add_parser ( ' install ' , parents = parents ,
install_parser = parser . add_parser ( ' install ' , parents = parents ,
help = ' Install {0} (s) from file(s), URL(s) or Ansible '
help = ' Install {0} (s) from file(s), URL(s) or Ansible '
' Galaxy ' . format ( galaxy_type ) )
' Galaxy ' . format ( galaxy_type ) ,
description = description_text ,
prog = prog , )
install_parser . set_defaults ( func = self . execute_install )
install_parser . set_defaults ( func = self . execute_install )
install_parser . add_argument ( ' args ' , metavar = ' {0} _name ' . format ( galaxy_type ) , nargs = ' * ' , * * args_kwargs )
install_parser . add_argument ( ' args ' , metavar = ' {0} _name ' . format ( galaxy_type ) , nargs = ' * ' , * * args_kwargs )
@ -548,8 +567,12 @@ class GalaxyCLI(CLI):
' This does not apply to collections in remote Git repositories or URLs to remote tarballs. '
' This does not apply to collections in remote Git repositories or URLs to remote tarballs. '
)
)
else :
else :
install_parser . add_argument ( ' -r ' , ' --role-file ' , dest = ' requirements ' ,
if self . _implicit_role :
help = ' A file containing a list of roles to be installed. ' )
install_parser . add_argument ( ' -r ' , ' --role-file ' , dest = ' requirements ' ,
help = ' A file containing a list of collections and roles to be installed. ' )
else :
install_parser . add_argument ( ' -r ' , ' --role-file ' , dest = ' requirements ' ,
help = ' A file containing a list of roles to be installed. ' )
r_re = re . compile ( r ' ^(?<!-)-[a-zA-Z]*r[a-zA-Z]* ' ) # -r, -fr
r_re = re . compile ( r ' ^(?<!-)-[a-zA-Z]*r[a-zA-Z]* ' ) # -r, -fr
contains_r = bool ( [ a for a in self . _raw_args if r_re . match ( a ) ] )
contains_r = bool ( [ a for a in self . _raw_args if r_re . match ( a ) ] )