title: Implementation error for type bool when writing custom Ansible module
body: <p>I'm trying to write a custom module in Ansible 2.3 to use in my playbook. The details of it has been abstracted to run a minimal <code>date</code> command below, but I'm developing a much complicated example.</p>
  
  <pre><code>[dev@foobar Gist]$ tree ansible_version_err/
  ansible_version_err/
  ├── dev_command.yml
  └── library
      └── dev_command.py
  </code></pre>
  
  <p>The contents of the library file is using the <code>ansible.module</code> package to implement the custom command.</p>
  
  <pre><code>#!/usr/bin/python
  
  from ansible.module_utils.basic import *
  from subprocess import Popen, PIPE
  
  import time
  
  if __name__ == '__main__':
      module = AnsibleModule(
          argument_spec={
              'command': { 'type':'str', 'required': True },
              'print_elapsed': {  'type':bool, 'required': False },
              'print_time': { 'type':bool, 'required': False } } )
  
      stdout = None
      stderr = None
      rc = None
  
      try:
          time_start = time.time()
          proc = Popen( module.params['command'], shell = True)
          stdout, stderr = proc.communicate()
          time_end = time.time()
          rc = proc.returncode
  
          if rc != 0:
              raise Exception("error while obtaining date")
  
          time_elapsed = time_end - time_start
  
          if 'print_elapsed' in module.params and module.params['print_elapsed']:
              stdout = stdout + "\nelapsed time: " + str(time_elapsed)
  
          if 'print_time' in module.params and module.params['print_time']:
              stdout = stderr + "\ntime: " + time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(time_start))
  
          module.exit_json( changed = False, stdout = stdout, stderr = stderr, rc = rc, time_elapsed = time_elapsed  )
  
      except Exception:
          pass
  </code></pre>
  
  <p>and the <code>.yml</code> file using this <code>dev_command</code> is called as</p>
  
  <pre><code>---
  - hosts: localhost
    gather_facts: no
    tasks:
    - name: testing a custom command
      vars:
        print_stdout: True
      dev_command: command="{{cmd}}" print_elapsed=True print_time=True
  </code></pre>
  
  <p>I'm just calling the <code>cmd</code> with <code>date</code> which will go ahead and run the date command. </p>
  
  <pre><code>ansible-playbook dev_command.yml -vvv -e "cmd=date"
  </code></pre>
  
  <p>While I expect this work on Ansible 2.3, it is throwing me an error as</p>
  
  <pre><code>fatal: [localhost]: FAILED! =&gt; {
      "changed": false, 
      "failed": true, 
      "invocation": {
          "module_args": {
              "command": "date", 
              "print_elapsed": "True", 
              "print_time": "True"
          }
      }, 
      "msg": "implementation error: unknown type &lt;type 'bool'&gt; requested for print_time"
  }
  </code></pre>
  
  <p>This error is not seen in v2.6. Why is this happening? Is this a known Ansible feature bug that can only be resolved by moving to a newer version. Version details</p>
  
  <pre><code>$ ansible --version
  ansible 2.3.0.0
    config file = /etc/ansible/ansible.cfg
    configured module search path = Default w/o overrides
    python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
  </code></pre>