Command Line Reference¶
Check¶
-
class
molecule.command.check.
Check
¶ Check Command Class.
-
molecule
check
¶ Target the default scenario.
-
molecule
check --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug check
¶ Executing with debug.
-
molecule
--base-config base.yml check
¶ Executing with a base-config.
-
molecule
--env-file foo.yml check
¶ Load an env file to read variables from when rendering molecule.yml.
-
molecule
check --parallel
¶ Run in parallelizable mode.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Clean Up¶
-
class
molecule.command.cleanup.
Cleanup
¶ Cleanup Command Class.
This action has cleanup and is not enabled by default. See the provisioner’s documentation for further details.
-
molecule
cleanup
¶ Target the default scenario.
-
molecule
cleanup --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug cleanup
¶ Executing with debug.
-
molecule
--base-config base.yml cleanup
¶ Executing with a base-config.
-
molecule
--env-file foo.yml cleanup
¶ Load an env file to read variables when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Converge¶
Converge will execute the sequence necessary to converge the instances.
-
class
molecule.command.converge.
Converge
¶ Converge Command Class.
-
molecule
converge
¶ Target the default scenario.
-
molecule
converge --scenario-name foo
¶ Targeting a specific scenario.
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
--debug converge
¶ Executing with debug.
-
molecule
--base-config base.yml converge
¶ Executing with a base-config.
-
molecule
--env-file foo.yml converge
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Create¶
-
class
molecule.command.create.
Create
¶ Create Command Class.
-
molecule
create
¶ Target the default scenario.
-
molecule
create --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
create --driver-name foo
¶ Targeting a specific driver.
-
molecule
--debug create
¶ Executing with debug.
-
molecule
--base-config base.yml create
¶ Executing with a base-config.
-
molecule
--env-file foo.yml create
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Dependency¶
-
class
molecule.command.dependency.
Dependency
¶ Dependency Command Class.
-
molecule
dependency
¶ Target the default scenario.
-
molecule
dependency --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug dependency
¶ Executing with debug.
-
molecule
--base-config base.yml dependency
¶ Executing with a base-config.
-
molecule
--env-file foo.yml dependency
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Destroy¶
-
class
molecule.command.destroy.
Destroy
¶ Destroy Command Class.
-
molecule
destroy
¶ Target the default scenario.
-
molecule
destroy --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
destroy --all
¶ Target all scenarios.
-
molecule
destroy --driver-name foo
¶ Targeting a specific driver.
-
molecule
--debug destroy
¶ Executing with debug.
-
molecule
--base-config base.yml destroy
¶ Executing with a base-config.
-
molecule
--env-file foo.yml destroy
¶ Load an env file to read variables from when rendering molecule.yml.
-
molecule
destroy --parallel
¶ Run in parallelizable mode.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Idempotence¶
-
class
molecule.command.idempotence.
Idempotence
¶ Runs the converge step a second time. If no tasks will be marked as changed the scenario will be considered idempotent.
-
molecule
idempotence
¶ Target the default scenario.
-
molecule
idempotence --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug idempotence
¶ Executing with debug.
-
molecule
--base-config base.yml idempotence
¶ Executing with a base-config.
-
molecule
--env-file foo.yml idempotence
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Init¶
-
class
molecule.command.init.role.
Role
¶ Init Role Command Class.
-
molecule
init role foo
¶ Initialize a new role.
Initialize a new role using ansible-galaxy and include default molecule directory. Please refer to the
init scenario
command in order to generate a custommolecule
scenario.
Construct Role.
-
-
class
molecule.command.init.scenario.
Scenario
¶ Scenario Class.
-
molecule
init scenario bar --role-name foo
¶ Initialize a new scenario. In order to customise the role, please refer to the init role command.
-
cd
foo; molecule init scenario bar --role-name foo
¶ Initialize an existing role with Molecule:
-
cd
foo; molecule init scenario bar --role-name foo
¶ Initialize a new scenario using a local cookiecutter template for the driver configuration.
Construct Scenario.
-
Lint¶
-
class
molecule.command.lint.
Lint
¶ Lint command executes external linters.
You need to remember to install those linters. For convenience, there is a package extra that installs the most common ones, use it like
python3 -m pip install "molecule[lint]"
.-
molecule
lint
¶ Target the default scenario.
-
molecule
lint --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug lint
¶ Executing with debug.
-
molecule
--base-config base.yml lint
¶ Executing with a base-config.
-
molecule
--env-file foo.yml lint
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
List¶
-
class
molecule.command.list.
List
¶ List command shows information about current scenarios.
-
molecule
list
¶ Target the default scenario.
-
molecule
list --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
list --format plain
¶ Machine readable plain text output.
-
molecule
list --format yaml
¶ Machine readable yaml output.
-
molecule
--debug list
¶ Executing with debug.
-
molecule
--base-config base.yml list
¶ Executing with a base-config.
-
molecule
--env-file foo.yml list
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Login¶
-
class
molecule.command.login.
Login
¶ Login Command Class.
-
molecule
login
¶ Target the default scenario.
-
molecule
login --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
login --host hostname
¶ Targeting a specific running host.
-
molecule
login --host hostname --scenario-name foo
¶ Targeting a specific running host and scenario.
-
molecule
--debug login
¶ Executing with debug.
-
molecule
--base-config base.yml login
¶ Executing with a base-config.
-
molecule
--env-file foo.yml login
¶ Load an env file to read variables from when rendering molecule.yml.
Construct Login.
-
Matrix¶
Matrix will display the subcommand’s ordered list of actions, which can be changed in scenario configuration.
-
class
molecule.command.matrix.
Matrix
¶ Matric Command Class.
-
molecule
matrix subcommand
¶ Target the default scenario.
-
molecule
matrix --scenario-name foo subcommand
¶ Targeting a specific scenario.
-
molecule
--debug matrix subcommand
¶ Executing with debug.
-
molecule
--base-config base.yml matrix subcommand
¶ Executing with a base-config.
-
molecule
--env-file foo.yml matrix subcommand
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Prepare¶
-
class
molecule.command.prepare.
Prepare
¶ This action is for the purpose of preparing a molecule managed instance before the
molecule.command.converge.Converge
action is run.Tasks contained within the
prepare.yml
playbook in the scenario directory will be run remotely on the managed instance. This action is run only once per test sequence.-
molecule
prepare
¶ Target the default scenario.
-
molecule
prepare --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
prepare --driver-name foo
¶ Targeting a specific driver.
-
molecule
prepare --force
¶ Force the execution fo the prepare playbook.
-
molecule
--debug prepare
¶ Executing with debug.
-
molecule
--base-config base.yml prepare
¶ Executing with a base-config.
-
molecule
--env-file foo.yml prepare
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Side Effect¶
-
class
molecule.command.side_effect.
SideEffect
¶ This action has side effects and not enabled by default.
See the provisioners documentation for further details.
-
molecule
side-effect
¶ Target the default scenario.
-
molecule
side-effect --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug side-effect
¶ Executing with debug.
-
molecule
--base-config base.yml side-effect
¶ Executing with a base-config.
-
molecule
--env-file foo.yml side-effect
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Syntax¶
-
class
molecule.command.syntax.
Syntax
¶ Syntax Command Class.
-
molecule
syntax
¶ Target the default scenario.
-
molecule
syntax --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug syntax
¶ Executing with debug.
-
molecule
--base-config base.yml syntax
¶ Executing with a base-config.
-
molecule
--env-file foo.yml syntax
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Test¶
Test will execute the sequence necessary to test the instances.
-
class
molecule.command.test.
Test
¶ Test Command Class.
-
molecule
test
¶ Target the default scenario.
-
molecule
test --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
test --all
¶ Target all scenarios.
-
molecule
test --destroy=always
¶ Always destroy instances at the conclusion of a Molecule run.
-
molecule
--debug test
¶ Executing with debug.
-
molecule
--base-config base.yml test
¶ Executing with a base-config.
-
molecule
--env-file foo.yml test
¶ Load an env file to read variables from when rendering molecule.yml.
-
molecule
test --parallel
¶ Run in parallelizable mode.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-
Verify¶
-
class
molecule.command.verify.
Verify
¶ Verify Command Class.
-
molecule
verify
¶ Target the default scenario.
-
molecule
verify --scenario-name foo
¶ Targeting a specific scenario.
-
molecule
--debug verify
¶ Executing with debug.
-
molecule
--base-config base.yml verify
¶ Executing with a base-config.
-
molecule
--env-file foo.yml verify
¶ Load an env file to read variables from when rendering molecule.yml.
Initialize code for all command classes.
- Parameters
c – An instance of a Molecule config.
- Returns
None
-