def METHOD_NAME(ansible_module, stop_pki_instance):
    """
    :id: 795f34af-2b14-4007-bd68-2db96eeec847
    :Title: Test pki-server db-upgrade command with stopped instance.
    :Description: Test pki-server db-upgrade command with stopped instance.
    :Requirement: Pki Server Db
    :Setup: Use the subsystems setup in ansible to run subsystem commands
    :Steps:
    :ExpectedResult:
        1. Verify whether pki-server db-upgrade command upgrade the pki server database
           when instance is stopped.
    """
    # Store commands in veriables.
    db_upgrade = 'pki-server db-upgrade -i {} ca'.format(constants.CA_INSTANCE_NAME)
    cmd_output = ansible_module.command(db_upgrade)
    for result in cmd_output.values():
        if result['rc'] == 0:
            assert "Upgrade complete" in result['stdout']
        else:
            pytest.xfail("Failed to run pki-server db-upgrade command when instance stopped.")