-
Notifications
You must be signed in to change notification settings - Fork 669
Enable ansible_args
for user-provided create/destroy
playbooks
#4505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ansible_args
for user-provided create/destroy playbooks
d6c15f9
to
9bafd40
Compare
ansible_args
for user-provided create/destroy playbooksansible_args
for user-provided create/destroy
playbooks
Qalthos
approved these changes
Aug 11, 2025
9f561f3
to
291629d
Compare
cidrblock
added a commit
that referenced
this pull request
Aug 15, 2025
Depends on #4505 ## Summary This pull request adds comprehensive testing philosophy documentation to help users understand Molecule's approach to Ansible automation testing and its strategic direction. ## Changes Made ### New Documentation: docs/philosophy.md - **Testing suite fundamentals**: Universal testing framework capabilities and core phases applicable to any robust testing system - **Molecule's Ansible-centric approach**: How Molecule addresses testing requirements specifically for Ansible automation across all domains (infrastructure, applications, network, cloud, APIs, business processes) - **Resource lifecycle management**: Detailed explanation of shared state and shared inventory mechanisms for cost optimization and workflow efficiency - **Configuration flexibility**: Ansible as unified driver, provisioner, and verifier with enterprise customization capabilities - **Evolution and strategic direction**: Molecule's focused development on deeper Ansible integration rather than broader tool support ### Key Technical Improvements - **Corrected shared state implementation**: Accurate documentation of automatic default scenario management for create/destroy operations - **Shared inventory mechanism**: Clear explanation of how centralized inventory enables resource sharing across scenarios - **Enterprise customization**: Documentation of how sequence configurations can be committed and shared between teams - **Framework evolution**: Nine-year optimization history and future roadmap focusing on Ansible ecosystem alignment ### Documentation Quality - Professional technical writing suitable for seasoned Ansible practitioners - Framework-agnostic core concepts with Ansible-specific implementation details - Comprehensive workflow examples and real-world usage patterns - Accurate technical details verified through codebase analysis ## Target Audience This documentation serves automation practitioners, enterprise teams, and decision makers who need to understand Molecule's testing philosophy, capabilities, and strategic direction within the Ansible ecosystem. ## Testing - Documentation builds successfully with ROOT: will run in automatically provisioned tox, host /home/bthornto/github/molecule311/.venv/bin/python3 is missing [requires (has)]: tox-uv>=1.20.2 ROOT: provision> .tox/.tox/bin/python -m tox -e docs .pkg: _optional_hooks> python /home/bthornto/github/molecule311/.tox/.tox/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta .pkg: get_requires_for_build_editable> python /home/bthornto/github/molecule311/.tox/.tox/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta .pkg: build_editable> python /home/bthornto/github/molecule311/.tox/.tox/lib/python3.10/site-packages/pyproject_api/_backend.py True setuptools.build_meta docs: install_package> .tox/.tox/bin/uv pip install --reinstall --no-deps molecule@/home/bthornto/github/molecule311/.tox/.tmp/package/49/molecule-25.7.1.dev20-0.editable-py3-none-any.whl docs: commands_pre[0]> sh -c 'rm -f /home/bthornto/github/molecule311/.tox/docs/.coverage* 2>/dev/null || true' docs: commands[0]> mkdocs build --strict --site-dir=_readthedocs/html/ docs: OK (8.61=setup[1.41]+cmd[0.01,7.19] seconds) congratulations :) (8.71 seconds) - All technical details verified through codebase review - Examples tested for accuracy and clarity --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enhances Molecule's
ansible_args
handling to intelligently provide arguments to user-provided create/destroy playbooks while maintaining safety for bundled playbooks. Previously,ansible_args
were excluded from all create/destroy actions regardless of playbook source.Changes Overview
Core Enhancement
ansible_args
to user-provided create/destroy playbooks, excludes them from bundled playbooksKey Features
MOLECULE_ANSIBLE_ARGS_STRICT_MODE
reverts to legacy behavior (exclude all create/destroy args)ansible_args
Technical Implementation
Modified Files
src/molecule/provisioner/ansible_playbook.py
_should_provide_args()
method with smart detection logicbake()
methodtests/unit/provisioner/test_ansible_playbook.py
docs/configuration.md
MOLECULE_ANSIBLE_ARGS_STRICT_MODE
environment variabledocs/examples/native_inventory.md
(NEW)tests/fixtures/integration/test_command/molecule/native_inventory/
(NEW SCENARIO)01-inventory.yml
): Host definitions with container images02-constructed.yml
): Constructed plugin creating 'containers' groupgroup_vars/containers.yml
): Connection settings for container hostshost_vars/container-devtools.yml
): Environment variables per hostcreate.yml
: Creates containers from inventory-defined hostsconverge.yml
: Targets constructed 'containers' groupverify.yml
: Validates environment variables and group membershipdestroy.yml
: Cleans up containers using inventory datarequirements.yml
): Collections needed for container managementREADME.md
): Scenario overview and implementation detailsUse Cases Enabled
Native Inventory Integration
Multiple Inventory Sources
Real-World Scenarios
Migration Path
Existing Users
MOLECULE_ANSIBLE_ARGS_STRICT_MODE=true
to maintain exact legacy behaviorNew Capabilities
Testing
Breaking Changes
None. All existing functionality is preserved with optional strict mode fallback.