mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add_host: check if name or hostname arg is provided
This commit is contained in:
parent
5f68892e81
commit
39d9496282
1 changed files with 6 additions and 0 deletions
|
@ -48,6 +48,12 @@ class ActionModule(ActionBase):
|
|||
|
||||
# Parse out any hostname:port patterns
|
||||
new_name = self._task.args.get('name', self._task.args.get('hostname', self._task.args.get('host', None)))
|
||||
|
||||
if new_name is None:
|
||||
result['failed'] = True
|
||||
result['msg'] = 'name or hostname arg needs to be provided'
|
||||
return result
|
||||
|
||||
display.vv("creating host via 'add_host': hostname=%s" % new_name)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue