Modules in the main Ansible repo have a defined life cycle, from first introduction to final removal. The module life cycle is tied to the
Ansible release cycle <release_cycle>
.
A module may move through these four states:
Deprecating modules
To deprecate a module, you must:
Rename the file so it starts with an
_
, for example, rename
old_cloud.py
to
_old_cloud.py
. This keeps the module available and marks it as deprecated on the module index pages.
Mention the deprecation in the relevant
CHANGELOG
.
Reference the deprecation in the relevant
porting_guide_x.y.rst
.
Add
deprecated:
to the documentation with the following sub-values:
removed_in
A
string
, such as
"2.10"
; the version of Ansible where the module will be replaced with a docs-only module stub. Usually current release +4. Mutually exclusive with :removed_by_date:.
remove_by_date
(Added in Ansible 2.10). An ISO 8601 formatted date when the module will be removed. Usually 2 years from the date the module is deprecated. Mutually exclusive with :removed_in:.
Optional string that used to detail why this has been removed.
alternative
Inform users they should do instead, for example,
Use
M(whatmoduletouseinstead)
instead.
.
note: with the advent of collections and
routing.yml
we might soon require another entry in this file to mark the deprecation.
For an example of documenting deprecation, see this
PR that deprecates multiple modules
.
Some of the elements in the PR might now be out of date.
Changing a module name
You can also rename a module and keep an alias to the old name by using a symlink that starts with _.
This example allows the
stat
module to be called with
fileinfo
, making the following examples equivalent:
EXAMPLES = '''
ln -s stat.py _fileinfo.py
ansible -m stat -a "path=/tmp" localhost
ansible -m fileinfo -a "path=/tmp" localhost