#  Copyright (c) 2015-2018 Cisco Systems, Inc.
#
#  Permission is hereby granted, free of charge, to any person obtaining a copy
#  of this software and associated documentation files (the "Software"), to
#  deal in the Software without restriction, including without limitation the
#  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
#  sell copies of the Software, and to permit persons to whom the Software is
#  furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#  DEALINGS IN THE SOFTWARE.
"""Create Command Module."""

import logging

import click

from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logging.getLogger(__name__)


class Create(base.Base):
    """Create Command Class."""

    def execute(self, action_args=None):
        """Execute the actions necessary to perform a `molecule create` and \
        returns None.

        :return: None
        """
        self._config.state.change_state("driver", self._config.driver.name)

        self._config.provisioner.create()

        self._config.state.change_state("created", True)


@base.click_command_ex()
@click.pass_context
@click.option(
    "--scenario-name",
    "-s",
    default=base.MOLECULE_DEFAULT_SCENARIO_NAME,
    help=f"Name of the scenario to target. ({base.MOLECULE_DEFAULT_SCENARIO_NAME})",
)
@click.option(
    "--driver-name",
    "-d",
    type=click.Choice([str(s) for s in drivers()]),
    help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
def create(ctx, scenario_name, driver_name):  # pragma: no cover
    """Use the provisioner to start the instances."""
    args = ctx.obj.get("args")
    subcommand = base._get_subcommand(__name__)
    command_args = {"subcommand": subcommand, "driver_name": driver_name}

    base.execute_cmdline_scenarios(scenario_name, args, command_args)

src/molecule/command/create.py
#  Copyright (c) 2015-2018 Cisco Systems, Inc.
#
#  Permission is hereby granted, free of charge, to any person obtaining a copy
#  of this software and associated documentation files (the "Software"), to
#  deal in the Software without restriction, including without limitation the
#  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
#  sell copies of the Software, and to permit persons to whom the Software is
#  furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#  DEALINGS IN THE SOFTWARE.
"""Create Command Module."""

import logging

import click

from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logging.getLogger(__name__)


class Create(base.Base):
    """Create Command Class."""

    def execute(self, action_args=None):
        """Execute the actions necessary to perform a `molecule create` and \
        returns None.

        :return: None
        """
        self._config.state.change_state("driver", self._config.driver.name)

        if self._config.state.created:
            msg = "Skipping, instances already created."
            LOG.warning(msg)
            return

        self._config.provisioner.create()

        self._config.state.change_state("created", True)


@base.click_command_ex()
@click.pass_context
@click.option(
    "--scenario-name",
    "-s",
    default=base.MOLECULE_DEFAULT_SCENARIO_NAME,
    help=f"Name of the scenario to target. ({base.MOLECULE_DEFAULT_SCENARIO_NAME})",
)
@click.option(
    "--driver-name",
    "-d",
    type=click.Choice([str(s) for s in drivers()]),
    help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
def create(ctx, scenario_name, driver_name):  # pragma: no cover
    """Use the provisioner to start the instances."""
    args = ctx.obj.get("args")
    subcommand = base._get_subcommand(__name__)
    command_args = {"subcommand": subcommand, "driver_name": driver_name}

    base.execute_cmdline_scenarios(scenario_name, args, command_args)

src/molecule/command/create.py
diff --git a/src/molecule/command/create.py b/src/molecule/command/create.py
index a10bca06ee..a4a96f7c7d 100644
--- a/src/molecule/command/create.py
+++ b/src/molecule/command/create.py
@@ -41,6 +41,11 @@ def execute(self, action_args=None):
         """
         self._config.state.change_state("driver", self._config.driver.name)
 
+        if self._config.state.created:
+            msg = "Skipping, instances already created."
+            LOG.warning(msg)
+            return
+
         self._config.provisioner.create()
 
         self._config.state.change_state("created", True)

created: true is ignored in state.yml
# Issue Type

- Bug report

# Molecule and Ansible details

```
ansible --version && molecule --version
ansible [core 2.15.3]
  config file = None
  configured module search path = ['/home/manu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/lib/python3.11/site-packages/ansible
  ansible collection location = /home/manu/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/bin/ansible
  python version = 3.11.5 (main, Aug 28 2023, 20:02:58) [GCC 13.2.1 20230801] (/home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/bin/python)
  jinja version = 3.1.2
  libyaml = True
molecule 6.0.2 using python 3.11
    ansible:2.15.3
    default:6.0.2 from molecule
    molecule-qemu:0.5.3 from molecule_qemu
```

Molecule installation method: source
Ansible installation method: pip

# Desired Behavior

In molecule v5, the `create` step was automatically skipped when `created: true` in `<XDG_CACHE_HOME>/molecule//<scenario>/state.yml` with the message `WARNING  Skipping, instances already created.`. This is the desired behavior.

Here an example with a simple hello_world role after a `molecule create` execution. The molecule-qemu plugin is used here.
```
❯ molecule converge
INFO     default scenario test matrix: dependency, create, prepare, converge
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/manu/.cache/ansible-compat/35072c/modules:/home/manu/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/manu/.cache/ansible-compat/35072c/collections:/home/manu/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/manu/.cache/ansible-compat/35072c/roles:/home/manu/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > create
WARNING  Skipping, instances already created.
INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

PLAY [all] *********************************************************************

TASK [hello_world : Hello world] ***********************************************
ok: [test-hello-world] => {
    "msg": "Hello, world!"
}

PLAY RECAP *********************************************************************
test-hello-world           : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
```

# Actual Behaviour

Since molecule v6, the `WARNING  Skipping, instances already created.` message is no longer displayed and the create step is executed each time the `molecule converge` is called.

Here an example with the same role, with the same conditions except that molecule version is 6.0.2.
```
INFO     default scenario test matrix: dependency, create, prepare, converge
INFO     Performing prerun with role_name_check=0...
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > create

PLAY [Create] ******************************************************************

TASK [Gather only necessary facts] *********************************************
ok: [localhost]

TASK [Register VMs data] *******************************************************
ok: [localhost] => (item=test-hello-world)

TASK [Prepare VMs data] ********************************************************
ok: [localhost]
...
TASK [Dump VMs config] *********************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=31   changed=0    unreachable=0    failed=0    skipped=5    rescued=0    ignored=0

INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

PLAY [all] *********************************************************************

TASK [hello_world : Hello world] ***********************************************
ok: [test-hello-world] => {
    "msg": "Hello, world!"
}

PLAY RECAP *********************************************************************
test-hello-world           : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
```
