diff --git a/lib/ansible/module_utils/aws/urls.py b/lib/ansible/module_utils/aws/urls.py
index 55e22c6d151..909dd6e13dc 100644
--- a/lib/ansible/module_utils/aws/urls.py
+++ b/lib/ansible/module_utils/aws/urls.py
@@ -154,7 +154,7 @@ def signed_request(
         if session_in_query:
             query["X-Amz-Security-Token"] = session_token
 
-    if method is "GET":
+    if method == "GET":
         body = ""
 
     # Derived data
@@ -194,7 +194,7 @@ def signed_request(
 
     url = "https://" + host + uri
 
-    if query_string is not "":
+    if query_string != "":
         url = url + "?" + query_string
 
     final_headers = {
diff --git a/lib/ansible/module_utils/network/ironware/ironware.py b/lib/ansible/module_utils/network/ironware/ironware.py
index 22a86b1218b..9f813d68eb2 100644
--- a/lib/ansible/module_utils/network/ironware/ironware.py
+++ b/lib/ansible/module_utils/network/ironware/ironware.py
@@ -97,13 +97,13 @@ def run_commands(module, commands, check_rc=True):
 
 def get_config(module, source='running', flags=None):
     global _DEVICE_CONFIG
-    if source is 'running' and flags is None and _DEVICE_CONFIG is not None:
+    if source == 'running' and flags is None and _DEVICE_CONFIG is not None:
         return _DEVICE_CONFIG
     else:
         conn = get_connection(module)
         out = conn.get_config(source=source, flags=flags)
         cfg = to_text(out, errors='surrogate_then_replace').strip()
-        if source is 'running' and flags is None:
+        if source == 'running' and flags is None:
             _DEVICE_CONFIG = cfg
         return cfg
 
diff --git a/lib/ansible/modules/cloud/alicloud/ali_instance.py b/lib/ansible/modules/cloud/alicloud/ali_instance.py
index edc2609ed8f..d6a115b76c9 100644
--- a/lib/ansible/modules/cloud/alicloud/ali_instance.py
+++ b/lib/ansible/modules/cloud/alicloud/ali_instance.py
@@ -660,7 +660,7 @@ def main():
             if len(instances) > count:
                 for i in range(0, len(instances) - count):
                     inst = instances[len(instances) - 1]
-                    if inst.status is not 'stopped' and not force:
+                    if inst.status != 'stopped' and not force:
                         module.fail_json(msg="That to delete instance {0} is failed results from it is running, "
                                              "and please stop it or set 'force' as True.".format(inst.id))
                     try:
@@ -765,7 +765,7 @@ def main():
         else:
             try:
                 for inst in instances:
-                    if inst.status is not 'stopped' and not force:
+                    if inst.status != 'stopped' and not force:
                         module.fail_json(msg="Instance is running, and please stop it or set 'force' as True.")
                     if inst.terminate(force=module.params['force']):
                         changed = True
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
index 8f333b94ff6..f0f3db20b21 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
@@ -923,7 +923,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
                     if set(current_nics) != set(network_interfaces):
                         self.log('CHANGED: virtual machine {0} - network interfaces are different.'.format(self.name))
                         differences.append('Network Interfaces')
-                        updated_nics = [dict(id=id, primary=(i is 0))
+                        updated_nics = [dict(id=id, primary=(i == 0))
                                         for i, id in enumerate(network_interfaces)]
                         vm_dict['properties']['networkProfile']['networkInterfaces'] = updated_nics
                         changed = True
@@ -1067,7 +1067,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
                     if not self.short_hostname:
                         self.short_hostname = self.name
 
-                    nics = [self.compute_models.NetworkInterfaceReference(id=id, primary=(i is 0))
+                    nics = [self.compute_models.NetworkInterfaceReference(id=id, primary=(i == 0))
                             for i, id in enumerate(network_interfaces)]
 
                     # os disk
@@ -1217,7 +1217,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
 
                     self.log("Update virtual machine {0}".format(self.name))
                     self.results['actions'].append('Updated VM {0}'.format(self.name))
-                    nics = [self.compute_models.NetworkInterfaceReference(id=interface['id'], primary=(i is 0))
+                    nics = [self.compute_models.NetworkInterfaceReference(id=interface['id'], primary=(i == 0))
                             for i, interface in enumerate(vm_dict['properties']['networkProfile']['networkInterfaces'])]
 
                     # os disk
diff --git a/lib/ansible/modules/cloud/misc/rhevm.py b/lib/ansible/modules/cloud/misc/rhevm.py
index 6d7366da0ff..0b398efaf9e 100644
--- a/lib/ansible/modules/cloud/misc/rhevm.py
+++ b/lib/ansible/modules/cloud/misc/rhevm.py
@@ -1378,7 +1378,7 @@ def core(module):
 
             # Set VM Host
             vmhost = module.params.get('vmhost')
-            if vmhost is not False and vmhost is not "False":
+            if vmhost is not False and vmhost != "False":
                 if r.setVMHost(vminfo['name'], vmhost) is False:
                     return RHEV_FAILED, msg
 
diff --git a/lib/ansible/modules/cloud/misc/virt.py b/lib/ansible/modules/cloud/misc/virt.py
index ad3850a0607..268f62b9515 100644
--- a/lib/ansible/modules/cloud/misc/virt.py
+++ b/lib/ansible/modules/cloud/misc/virt.py
@@ -489,22 +489,22 @@ def core(module):
             module.fail_json(msg="state change requires a guest specified")
 
         if state == 'running':
-            if v.status(guest) is 'paused':
+            if v.status(guest) == 'paused':
                 res['changed'] = True
                 res['msg'] = v.unpause(guest)
-            elif v.status(guest) is not 'running':
+            elif v.status(guest) != 'running':
                 res['changed'] = True
                 res['msg'] = v.start(guest)
         elif state == 'shutdown':
-            if v.status(guest) is not 'shutdown':
+            if v.status(guest) != 'shutdown':
                 res['changed'] = True
                 res['msg'] = v.shutdown(guest)
         elif state == 'destroyed':
-            if v.status(guest) is not 'shutdown':
+            if v.status(guest) != 'shutdown':
                 res['changed'] = True
                 res['msg'] = v.destroy(guest)
         elif state == 'paused':
-            if v.status(guest) is 'running':
+            if v.status(guest) == 'running':
                 res['changed'] = True
                 res['msg'] = v.pause(guest)
         else:
diff --git a/lib/ansible/modules/cloud/misc/virt_net.py b/lib/ansible/modules/cloud/misc/virt_net.py
index d7454c93c4f..62d80241941 100644
--- a/lib/ansible/modules/cloud/misc/virt_net.py
+++ b/lib/ansible/modules/cloud/misc/virt_net.py
@@ -509,7 +509,7 @@ def core(module):
 
         res['changed'] = False
         if state in ['active']:
-            if v.status(name) is not 'active':
+            if v.status(name) != 'active':
                 res['changed'] = True
                 res['msg'] = v.start(name)
         elif state in ['present']:
@@ -523,13 +523,13 @@ def core(module):
         elif state in ['inactive']:
             entries = v.list_nets()
             if name in entries:
-                if v.status(name) is not 'inactive':
+                if v.status(name) != 'inactive':
                     res['changed'] = True
                     res['msg'] = v.destroy(name)
         elif state in ['undefined', 'absent']:
             entries = v.list_nets()
             if name in entries:
-                if v.status(name) is not 'inactive':
+                if v.status(name) != 'inactive':
                     v.destroy(name)
                 res['changed'] = True
                 res['msg'] = v.undefine(name)
diff --git a/lib/ansible/modules/cloud/misc/virt_pool.py b/lib/ansible/modules/cloud/misc/virt_pool.py
index 148a5a6fe5f..3ee43e3399e 100644
--- a/lib/ansible/modules/cloud/misc/virt_pool.py
+++ b/lib/ansible/modules/cloud/misc/virt_pool.py
@@ -578,7 +578,7 @@ def core(module):
 
         res['changed'] = False
         if state in ['active']:
-            if v.status(name) is not 'active':
+            if v.status(name) != 'active':
                 res['changed'] = True
                 res['msg'] = v.start(name)
         elif state in ['present']:
@@ -592,20 +592,20 @@ def core(module):
         elif state in ['inactive']:
             entries = v.list_pools()
             if name in entries:
-                if v.status(name) is not 'inactive':
+                if v.status(name) != 'inactive':
                     res['changed'] = True
                     res['msg'] = v.destroy(name)
         elif state in ['undefined', 'absent']:
             entries = v.list_pools()
             if name in entries:
-                if v.status(name) is not 'inactive':
+                if v.status(name) != 'inactive':
                     v.destroy(name)
                 res['changed'] = True
                 res['msg'] = v.undefine(name)
         elif state in ['deleted']:
             entries = v.list_pools()
             if name in entries:
-                if v.status(name) is not 'inactive':
+                if v.status(name) != 'inactive':
                     v.destroy(name)
                 v.delete(name, mode)
                 res['changed'] = True
diff --git a/lib/ansible/modules/cloud/openstack/os_ironic.py b/lib/ansible/modules/cloud/openstack/os_ironic.py
index cdd36b83dea..6a09afe2faf 100644
--- a/lib/ansible/modules/cloud/openstack/os_ironic.py
+++ b/lib/ansible/modules/cloud/openstack/os_ironic.py
@@ -196,7 +196,7 @@ def _choose_id_value(module):
 
 
 def _choose_if_password_only(module, patch):
-    if len(patch) is 1:
+    if len(patch) == 1:
         if 'password' in patch[0]['path'] and module.params['skip_update_of_masked_password']:
             # Return false to abort update as the password appears
             # to be the only element in the patch.
diff --git a/lib/ansible/modules/cloud/openstack/os_ironic_node.py b/lib/ansible/modules/cloud/openstack/os_ironic_node.py
index 6ae50652abe..85cdc4f033a 100644
--- a/lib/ansible/modules/cloud/openstack/os_ironic_node.py
+++ b/lib/ansible/modules/cloud/openstack/os_ironic_node.py
@@ -259,7 +259,7 @@ def main():
         timeout = module.params['timeout']
 
         # User has reqeusted desired state to be in maintenance state.
-        if module.params['state'] is 'maintenance':
+        if module.params['state'] == 'maintenance':
             module.params['maintenance'] = True
 
         if node['provision_state'] in [
diff --git a/lib/ansible/modules/clustering/pacemaker_cluster.py b/lib/ansible/modules/clustering/pacemaker_cluster.py
index 8451fafc3c6..fa1c6df500e 100644
--- a/lib/ansible/modules/clustering/pacemaker_cluster.py
+++ b/lib/ansible/modules/clustering/pacemaker_cluster.py
@@ -92,7 +92,7 @@ def get_node_status(module, node='all'):
     else:
         cmd = "pcs cluster pcsd-status"
     rc, out, err = module.run_command(cmd)
-    if rc is 1:
+    if rc == 1:
         module.fail_json(msg="Command execution failed.\nCommand: `%s`\nError: %s" % (cmd, err))
     status = []
     for o in out.splitlines():
@@ -103,7 +103,7 @@ def get_node_status(module, node='all'):
 def clean_cluster(module, timeout):
     cmd = "pcs resource cleanup"
     rc, out, err = module.run_command(cmd)
-    if rc is 1:
+    if rc == 1:
         module.fail_json(msg="Command execution failed.\nCommand: `%s`\nError: %s" % (cmd, err))
 
 
@@ -115,7 +115,7 @@ def set_cluster(module, state, timeout, force):
         if force:
             cmd = "%s --force" % cmd
     rc, out, err = module.run_command(cmd)
-    if rc is 1:
+    if rc == 1:
         module.fail_json(msg="Command execution failed.\nCommand: `%s`\nError: %s" % (cmd, err))
 
     t = time.time()
@@ -143,7 +143,7 @@ def set_node(module, state, timeout, force, node='all'):
         if node[1].strip().lower() != state:
             cmd = "%s %s" % (cmd, node[0].strip())
             rc, out, err = module.run_command(cmd)
-            if rc is 1:
+            if rc == 1:
                 module.fail_json(msg="Command execution failed.\nCommand: `%s`\nError: %s" % (cmd, err))
 
     t = time.time()
diff --git a/lib/ansible/modules/database/aerospike/aerospike_migrations.py b/lib/ansible/modules/database/aerospike/aerospike_migrations.py
index 1cff28411b9..793b36310b5 100644
--- a/lib/ansible/modules/database/aerospike/aerospike_migrations.py
+++ b/lib/ansible/modules/database/aerospike/aerospike_migrations.py
@@ -384,7 +384,7 @@ class Migrations:
                 cluster_keys[cluster_key] = 1
             else:
                 cluster_keys[cluster_key] += 1
-        if len(cluster_keys.keys()) is 1 and \
+        if len(cluster_keys.keys()) == 1 and \
                 self._start_cluster_key in cluster_keys:
             return True
         return False
diff --git a/lib/ansible/modules/database/mysql/mysql_variables.py b/lib/ansible/modules/database/mysql/mysql_variables.py
index fd50c1caa3c..14507a1aa14 100644
--- a/lib/ansible/modules/database/mysql/mysql_variables.py
+++ b/lib/ansible/modules/database/mysql/mysql_variables.py
@@ -85,7 +85,7 @@ def typedvalue(value):
 def getvariable(cursor, mysqlvar):
     cursor.execute("SHOW VARIABLES WHERE Variable_name = %s", (mysqlvar,))
     mysqlvar_val = cursor.fetchall()
-    if len(mysqlvar_val) is 1:
+    if len(mysqlvar_val) == 1:
         return mysqlvar_val[0][1]
     else:
         return None
diff --git a/lib/ansible/modules/identity/ipa/ipa_user.py b/lib/ansible/modules/identity/ipa/ipa_user.py
index 77f782e8304..924c660b06f 100644
--- a/lib/ansible/modules/identity/ipa/ipa_user.py
+++ b/lib/ansible/modules/identity/ipa/ipa_user.py
@@ -310,7 +310,7 @@ def main():
     # Therefore a small check here to replace list(None) by None. Otherwise get_user_diff() would return sshpubkey
     # as different which should be avoided.
     if module.params['sshpubkey'] is not None:
-        if len(module.params['sshpubkey']) == 1 and module.params['sshpubkey'][0] is "":
+        if len(module.params['sshpubkey']) == 1 and module.params['sshpubkey'][0] == "":
             module.params['sshpubkey'] = None
 
     try:
diff --git a/lib/ansible/modules/monitoring/logicmonitor.py b/lib/ansible/modules/monitoring/logicmonitor.py
index e4acfdb4dfa..50ca3b8892b 100644
--- a/lib/ansible/modules/monitoring/logicmonitor.py
+++ b/lib/ansible/modules/monitoring/logicmonitor.py
@@ -601,7 +601,7 @@ class LogicMonitor(object):
         resp = self.rpc("getAgents", {})
         resp_json = json.loads(resp)
 
-        if resp_json["status"] is 200:
+        if resp_json["status"] == 200:
             self.module.debug("RPC call succeeded")
             return resp_json["data"]
         else:
@@ -1063,7 +1063,7 @@ class Collector(LogicMonitor):
                 self.module.debug("Making RPC call to 'addAgent'")
                 create = (json.loads(self.rpc("addAgent", h)))
 
-                if create["status"] is 200:
+                if create["status"] == 200:
                     self.module.debug("RPC call succeeded")
                     self.info = create["data"]
                     self.id = create["data"]["id"]
@@ -1100,7 +1100,7 @@ class Collector(LogicMonitor):
             delete = json.loads(self.rpc("deleteAgent",
                                          {"id": self.id}))
 
-            if delete["status"] is 200:
+            if delete["status"] == 200:
                 self.module.debug("RPC call succeeded")
                 return delete
             else:
diff --git a/lib/ansible/modules/monitoring/logicmonitor_facts.py b/lib/ansible/modules/monitoring/logicmonitor_facts.py
index 5811f011d04..3af19567bcb 100644
--- a/lib/ansible/modules/monitoring/logicmonitor_facts.py
+++ b/lib/ansible/modules/monitoring/logicmonitor_facts.py
@@ -185,7 +185,7 @@ class LogicMonitor(object):
         resp = self.rpc("getAgents", {})
         resp_json = json.loads(resp)
 
-        if resp_json["status"] is 200:
+        if resp_json["status"] == 200:
             self.module.debug("RPC call succeeded")
             return resp_json["data"]
         else:
diff --git a/lib/ansible/modules/monitoring/sensu_check.py b/lib/ansible/modules/monitoring/sensu_check.py
index a773a53c5d3..f640a73afcb 100644
--- a/lib/ansible/modules/monitoring/sensu_check.py
+++ b/lib/ansible/modules/monitoring/sensu_check.py
@@ -182,7 +182,7 @@ def sensu_check(module, path, name, state='present', backup=False):
             stream = open(path, 'r')
             config = json.load(stream)
         except IOError as e:
-            if e.errno is 2:  # File not found, non-fatal
+            if e.errno == 2:  # File not found, non-fatal
                 if state == 'absent':
                     reasons.append('file did not exist and state is `absent\'')
                     return changed, reasons
diff --git a/lib/ansible/modules/monitoring/sensu_subscription.py b/lib/ansible/modules/monitoring/sensu_subscription.py
index fd1bd4b422d..3e3b55ae1d8 100644
--- a/lib/ansible/modules/monitoring/sensu_subscription.py
+++ b/lib/ansible/modules/monitoring/sensu_subscription.py
@@ -79,7 +79,7 @@ def sensu_subscription(module, path, name, state='present', backup=False):
     try:
         config = json.load(open(path))
     except IOError as e:
-        if e.errno is 2:  # File not found, non-fatal
+        if e.errno == 2:  # File not found, non-fatal
             if state == 'absent':
                 reasons.append('file did not exist and state is `absent\'')
                 return changed, reasons
diff --git a/lib/ansible/modules/network/eos/eos_logging.py b/lib/ansible/modules/network/eos/eos_logging.py
index 79ee748ae90..5330237cfdc 100644
--- a/lib/ansible/modules/network/eos/eos_logging.py
+++ b/lib/ansible/modules/network/eos/eos_logging.py
@@ -259,7 +259,7 @@ def parse_name(line, dest):
 def parse_level(line, dest):
     level = None
 
-    if dest is not 'host':
+    if dest != 'host':
 
         # Line for buffer logging entry in running-config is of the form:
         # logging buffered <size> <level>
diff --git a/lib/ansible/modules/network/panos/panos_query_rules.py b/lib/ansible/modules/network/panos/panos_query_rules.py
index 562ba45433f..85b064b82c0 100644
--- a/lib/ansible/modules/network/panos/panos_query_rules.py
+++ b/lib/ansible/modules/network/panos/panos_query_rules.py
@@ -237,7 +237,7 @@ def get_services(device, dev_group, svc_list, obj_list):
 
 def port_in_svc(orientation, port, protocol, obj):
     # Process address objects
-    if orientation is 'source':
+    if orientation == 'source':
         for x in obj.source_port.split(','):
             if '-' in x:
                 port_range = x.split('-')
@@ -248,7 +248,7 @@ def port_in_svc(orientation, port, protocol, obj):
             else:
                 if port == x and obj.protocol == protocol:
                     return True
-    elif orientation is 'destination':
+    elif orientation == 'destination':
         for x in obj.destination_port.split(','):
             if '-' in x:
                 port_range = x.split('-')
diff --git a/lib/ansible/modules/system/beadm.py b/lib/ansible/modules/system/beadm.py
index 1c3764ca16f..248cb5d3e42 100644
--- a/lib/ansible/modules/system/beadm.py
+++ b/lib/ansible/modules/system/beadm.py
@@ -250,8 +250,8 @@ class BE(object):
                 # On FreeBSD, we exclude currently mounted BE on /, as it is
                 # special and can be activated even if it is mounted. That is not
                 # possible with non-root BEs.
-                if line.split('\t')[2] is not '-' and \
-                        line.split('\t')[2] is not '/':
+                if line.split('\t')[2] != '-' and \
+                        line.split('\t')[2] != '/':
                     return True
             else:
                 if out.split(';')[3]: