I am getting the unknown type string error when I execute the ansible playbook
implementation error: unknown type string requested for name
I am trying to display my name using a ansible playbook. The bg code is python.
---
- name: Test hello module
hosts: localhost
tasks:
- name: run the hello module
hello:
name: 'Test'
register: helloout
- name: dump test output
debug:
msg: '{{ helloout }}'
#!/usr/bin/python
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(required=True, type='string')
),
supports_check_mode=False
)
name = module.params['name']
module.exit.json(changed=False, meta=name)
from ansible.module_utils.basic import *
if __name__ == '__main__':
main()
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [Test hello module] ****************************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************************** ok: [localhost]
TASK [run the hello module] ************************************************************************************************************************* fatal: [localhost]: FAILED! => {"changed": false, "msg": "implementation error: unknown type string requested for name"}
PLAY RECAP ****************************************************************************************************************************************** localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0