Skip to content

Commit

Permalink
Drop code related to unsupported ansible versions (#4376)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jan 22, 2025
1 parent 14ce6c0 commit 9fae3b5
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 29 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 2 additions & 15 deletions src/molecule/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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:
Expand Down
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
Expand Down

0 comments on commit 9fae3b5

Please sign in to comment.