##### SUMMARY
The behavior in Ansible 2.9 was that `add_host:` always came back as changed.

Maybe if the host already existed it should return ok, but I expect that when a host is actually created it is changed.

Sometime between 2.9 and 2.11 it started to always return ok. Trying to make it changed with `changed_when: true` produces a traceback.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
add_host module

##### ANSIBLE VERSION
```
$ ansible --version
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under
development. This is a rapidly changing source of code and can become unstable at any point.
ansible 2.11.0.dev0
  config file = /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/ansible.cfg
  configured module search path = ['/Users/alancoding/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alancoding/Documents/repos/ansible/lib/ansible
  ansible collection location = /Users/alancoding/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/alancoding/.virtualenvs/awx_collection/bin/ansible
  python version = 3.7.7 (default, Mar 10 2020, 15:43:03) [Clang 11.0.0 (clang-1100.0.33.17)]
```

##### CONFIGURATION
```
$ ansible-config dump --only-changed
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under
development. This is a rapidly changing source of code and can become unstable at any point.
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
DEPRECATION_WARNINGS(/Users/alancoding/Documents/repos/jlaska-ansible-playbooks/ansible.cfg) = False
```

##### OS / ENVIRONMENT
Local action, Mac OS


##### STEPS TO REPRODUCE
Run this playbook with >=1 host in the inventory

```yaml
---
- name: add hosts to inventory
  hosts: all
  gather_facts: false
  connection: local
  vars:
    num_hosts: 10
  tasks:
    - name: create inventory
      add_host:
        name: 'host-{{item}}'
        groups: dynamic
        ansible_connection: local
        host_id: '{{item}}'
      with_sequence: start=1 end={{num_hosts}} format=%d
      # changed_when: true
      notify:
          - single host handler

  handlers:
    - name: single host handler
      command: 'true'
```

##### EXPECTED RESULTS
I expect the tasks to be changed, and I expect the handler to be ran.

look at output from Ansible 2.9

```
$ ansible-playbook -i host1, dynamic_inventory.yml

PLAY [add hosts to inventory] *******************************************************************************************************************************************************

TASK [create inventory] *************************************************************************************************************************************************************
changed: [host1] => (item=1)
changed: [host1] => (item=2)
changed: [host1] => (item=3)
changed: [host1] => (item=4)
changed: [host1] => (item=5)
changed: [host1] => (item=6)
changed: [host1] => (item=7)
changed: [host1] => (item=8)
changed: [host1] => (item=9)
changed: [host1] => (item=10)

RUNNING HANDLER [single host handler] ***********************************************************************************************************************************************
[WARNING]: Platform darwin on host host1 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
changed: [host1]

PLAY RECAP **************************************************************************************************************************************************************************
host1                      : ok=2    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 
```

##### ACTUAL RESULTS
with `# changed_when: true` left as a comment

```
$ ansible-playbook -i host1, dynamic_inventory.yml
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under
development. This is a rapidly changing source of code and can become unstable at any point.

PLAY [add hosts to inventory] *******************************************************************************************************************************************************

TASK [create inventory] *************************************************************************************************************************************************************
ok: [host1] => (item=1)
ok: [host1] => (item=2)
ok: [host1] => (item=3)
ok: [host1] => (item=4)
ok: [host1] => (item=5)
ok: [host1] => (item=6)
ok: [host1] => (item=7)
ok: [host1] => (item=8)
ok: [host1] => (item=9)
ok: [host1] => (item=10)

PLAY RECAP **************************************************************************************************************************************************************************
host1                      : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  
```

no handler is ran

When uncommenting `changed_when: true`

```
$ ansible-playbook -i host1, dynamic_inventory.yml -vvv
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under
development. This is a rapidly changing source of code and can become unstable at any point.
ansible-playbook 2.11.0.dev0
  config file = /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/ansible.cfg
  configured module search path = ['/Users/alancoding/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alancoding/Documents/repos/ansible/lib/ansible
  ansible collection location = /Users/alancoding/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/alancoding/.virtualenvs/awx_collection/bin/ansible-playbook
  python version = 3.7.7 (default, Mar 10 2020, 15:43:03) [Clang 11.0.0 (clang-1100.0.33.17)]
Using /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/ansible.cfg as config file
Parsed host1, inventory source with host_list plugin

PLAYBOOK: dynamic_inventory.yml *****************************************************************************************************************************************************
1 plays in dynamic_inventory.yml

PLAY [add hosts to inventory] *******************************************************************************************************************************************************
META: ran handlers

TASK [create inventory] *************************************************************************************************************************************************************
task path: /Users/alancoding/Documents/repos/jlaska-ansible-playbooks/dynamic_inventory.yml:9
creating host via 'add_host': hostname=host-1
changed: [host1] => (item=1) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-1",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "1"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "1"
}
creating host via 'add_host': hostname=host-2
changed: [host1] => (item=2) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-2",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "2"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "2"
}
creating host via 'add_host': hostname=host-3
changed: [host1] => (item=3) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-3",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "3"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "3"
}
creating host via 'add_host': hostname=host-4
changed: [host1] => (item=4) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-4",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "4"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "4"
}
creating host via 'add_host': hostname=host-5
changed: [host1] => (item=5) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-5",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "5"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "5"
}
creating host via 'add_host': hostname=host-6
changed: [host1] => (item=6) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-6",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "6"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "6"
}
creating host via 'add_host': hostname=host-7
changed: [host1] => (item=7) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-7",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "7"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "7"
}
creating host via 'add_host': hostname=host-8
changed: [host1] => (item=8) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-8",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "8"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "8"
}
creating host via 'add_host': hostname=host-9
changed: [host1] => (item=9) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-9",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "9"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "9"
}
creating host via 'add_host': hostname=host-10
changed: [host1] => (item=10) => {
    "add_host": {
        "groups": [
            "dynamic"
        ],
        "host_name": "host-10",
        "host_vars": {
            "ansible_connection": "local",
            "host_id": "10"
        }
    },
    "ansible_loop_var": "item",
    "changed": true,
    "item": "10"
}
NOTIFIED HANDLER single host handler for host1
ERROR! Unexpected Exception, this is probably a bug: local variable 'conditional' referenced before assignment
the full traceback was:

Traceback (most recent call last):
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/playbook/conditional.py", line 93, in evaluate_conditional
    for conditional in self.when:
TypeError: 'bool' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alancoding/Documents/repos/ansible/bin/ansible-playbook", line 125, in <module>
    exit_code = cli.run()
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/cli/playbook.py", line 128, in run
    results = pbex.run()
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/executor/playbook_executor.py", line 169, in run
    result = self._tqm.run(play=play)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/executor/task_queue_manager.py", line 292, in run
    play_return = strategy.run(iterator, play_context)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/plugins/strategy/linear.py", line 329, in run
    results += self._wait_on_pending_results(iterator)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/plugins/strategy/__init__.py", line 804, in _wait_on_pending_results
    results = self._process_pending_results(iterator)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/plugins/strategy/__init__.py", line 129, in inner
    results = func(self, iterator, one_pass=one_pass, max_passes=max_passes, do_handlers=do_handlers)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/plugins/strategy/__init__.py", line 661, in _process_pending_results
    post_process_whens(result_item, original_task, handler_templar)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/plugins/strategy/__init__.py", line 80, in post_process_whens
    result['changed'] = cond.evaluate_conditional(templar, templar.available_variables)
  File "/Users/alancoding/Documents/repos/ansible/lib/ansible/playbook/conditional.py", line 112, in evaluate_conditional
    raise AnsibleError("The conditional check '%s' failed. The error was: %s" % (to_native(conditional), to_native(e)), obj=ds)
UnboundLocalError: local variable 'conditional' referenced before assignment
```


play_context = play_context.set_task_and_variable_override(task=task, variables=all_vars, templar=templar)
            
            
            play_context.post_validate(templar=templar)
            
            
            if not play_context.remote_addr:
                play_context.remote_addr = target_host.address
            
            
            play_context.update_vars(all_vars)
            if target_host in self._active_connections:
                connection = Connection(self._active_connections[target_host])
                del self._active_connections[target_host]
            else:
                connection = plugin_loader.connection_loader.get(play_context.connection, play_context, os.devnull)
                connection.set_options(task_keys=task.dump_attrs(), var_options=all_vars)
                play_context.set_attributes_from_plugin(connection)
            if connection:
                try:
                    connection.reset()
                    msg = 'reset connection'
                except ConnectionError as e:
                    
                    display.debug("got an error while closing persistent connection: %s" % e)
            else:
                msg = 'no connection, nothing to reset'
        else:
            raise AnsibleError("invalid meta action requested: %s" % meta_action, obj=task._ds)