Command Line Reference¶
Special commands¶
- drivers
- init
- list
- login
- matrix
- reset
Valid actions¶
- check
- cleanup
-
This action has cleanup and is not enabled by default. See the provisioner's documentation for further details.
-
converge : Converge will execute the sequence necessary to converge the instances.
- create ** driver
- dependency
- destroy ** all, parallel, driver
- idempotence
- prepare ** force
- side-effect
- syntax
- test - ** - Test command will execute the sequence necessary to test the instances.
- verify
-s, --scenario-name¶
Target a specific scenario by name. In collection mode, nested scenarios can
be targeted using a / separator (e.g., -s appliance_vlans/merged), and
wildcards can target an entire group (e.g., -s "appliance_vlans/*").
See Nested Scenarios for details.
--parallel / --no-parallel¶
Passing extra arguments to the provisioner¶
... -- -vvv --tags foo,bar
Providing additional command line arguments to the `ansible-playbook`
command. Use this option with care, as there is no sanitation or
validation of input. Options passed on the CLI override options
provided in provisioner's `options` section of `molecule.yml`.
molecule init¶
molecule init scenario¶
molecule list¶
List command shows information about current scenarios.
molecule login¶
When using a pre ansible-native configuration, if configured, Molecule has per resource awareness and can facilitate an interactive connection to a system.
When using an ansible-native configuration, the same connection methods used to connect to production systems are available.
Options leveraging the resources defined in the ansible inventory include:
Resource native connection options include:
-
SSH -
podman exec -
curl -
psql,mysql, andmongosh -
oc,kubectl, andodo -
etc
molecule matrix¶
Matrix will display the subcommand's ordered list of actions, which can be changed in scenario configuration.
Test sequence commands¶
We can tell Molecule to create an instance with:
We can verify that Molecule has created the instance and they're up and running with:
Now, let's add a task to our role under tasks/main.yml file like so:
We can then tell Molecule to test our role against our instance with:
If we want to manually inspect the instance afterward, we can run:
We now have a free hand to experiment with the instance state.
Finally, we can exit the instance and destroy it with:
Note
If Molecule reports any errors, it can be useful to pass the --debug
option to get more verbose output.