Skip to content
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

Drop code related to unsupported ansible versions #4376

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -18,9 +18,7 @@ testing scenarios.
Molecule encourages an approach that results in consistently developed
roles that are well-written, easily understood and maintained.

Molecule supports only the latest two major versions of Ansible (N/N-1),
meaning that if the latest version is 2.9.x, we will also test our code
with 2.8.x.
Molecule supports only the latest two major versions of Ansible (N/N-1).

Once installed, the command line can be called using any of the methods
below:
4 changes: 1 addition & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -16,9 +16,7 @@ testing scenarios.
Molecule encourages an approach that results in consistently developed
roles that are well-written, easily understood and maintained.

Molecule supports only the latest two major versions of Ansible (N/N-1),
meaning that if the latest version is 2.9.x, we will also test our code
with 2.8.x.
Molecule supports only the latest two major versions of Ansible (N/N-1).

Once installed, the command line can be called using any of the methods
below:
4 changes: 1 addition & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -6,13 +6,11 @@ Molecule.

## Requirements

- ansible-core >= 2.12
A recent version of `ansible-core` that is still under support.

Depending on the driver chosen, you may need to install additional OS
packages.

- Python >= 3.10

=== "CentOS"

``` bash
17 changes: 2 additions & 15 deletions src/molecule/config.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
from uuid import uuid4

from ansible_compat.ports import cache, cached_property
from packaging.version import Version

from molecule import api, interpolation, platforms, scenario, state, util
from molecule.app import get_app
@@ -45,6 +44,8 @@
from collections.abc import MutableMapping
from typing import Literal

from packaging.version import Version

from molecule.dependency.base import Base as Dependency
from molecule.driver.base import Driver
from molecule.state import State
@@ -134,20 +135,6 @@ def write(self) -> None:
"""Write config file to filesystem."""
util.write_file(self.config_file, util.safe_dump(self.config))

@property
def ansible_collections_path(
self,
) -> str:
"""Return collection path variable for current version of Ansible.
Returns:
The correct ansible collection path to use.
"""
# https://github.com/ansible/ansible/pull/70007
if self.runtime.version >= Version("2.10.0.dev0"):
return "ANSIBLE_COLLECTIONS_PATH"
return "ANSIBLE_COLLECTIONS_PATHS"

@property
def config_file(self) -> str:
"""Path to the config file.
2 changes: 1 addition & 1 deletion src/molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
@@ -537,7 +537,7 @@ def default_env(self) -> dict[str, str]:
{
"ANSIBLE_CONFIG": self.config_file,
"ANSIBLE_ROLES_PATH": ":".join(roles_path_list),
self._config.ansible_collections_path: ":".join(collections_path_list),
"ANSIBLE_COLLECTIONS_PATH": ":".join(collections_path_list),
"ANSIBLE_LIBRARY": ":".join(self._get_modules_directories()),
"ANSIBLE_FILTER_PLUGINS": ":".join(
self._get_filter_plugins_directories(),
Original file line number Diff line number Diff line change
@@ -7,4 +7,4 @@ galaxy_info:
namespace: molecule
role_name: delegated_test
license: GPL
min_ansible_version: "2.9"
min_ansible_version: "2.15"
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@ galaxy_info:
namespace: molecule
role_name: delegated-test
license: GPL
min_ansible_version: "2.10"
min_ansible_version: "2.15"
2 changes: 1 addition & 1 deletion tests/fixtures/resources/roles/molecule/meta/main.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ galaxy_info:
author: Ansible Molecule by Red Hat
description: Test Molecule role
license: MIT
min_ansible_version: "2.10"
min_ansible_version: "2.15"
platforms:
- name: GenericLinux
versions:
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
requires =
tox>=4.23.2
tox-uv>=1.16
tox-uv>=1.20.1
env_list =
py
deps