1
0
Fork 0
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:
Martin Krizek 2018-02-12 20:04:27 +01:00 committed by Brian Coca
parent 5f68892e81
commit 39d9496282

View file

@ -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: