Home Technology ERROR! [DEPRECATED]: ansible.builtin.include has been removed

ERROR! [DEPRECATED]: ansible.builtin.include has been removed

by karani

ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

If you are experiencing the error “ERROR! [DEPRECATED]: ansible.builtin.include has been removed,” don’t panic. This blog post will guide you through this update and ensure your deployments continue smoothly.

Understanding the Error

This error arises because Ansible, a popular infrastructure automation tool, has deprecated the include module in favor of include_tasks and import_tasks. This means the old way of including tasks from other YAML files is no longer recommended.

Why the Change?

Ansible’s developers aim to improve code clarity and maintainability with this update. The new modules offer better structure and separation of concerns.

Fixing the Error: Updating Your Playbooks

To resolve this error, you need to replace instances of include with either include_tasks or import_tasks in your main.yml file. Here’s a quick breakdown:

  • include_tasks: Use this when you want to include a file containing a list of tasks that will be executed in the current context.
  • import_tasks: This is ideal when you want to import tasks from another file and add them to the current playbook for later execution.

Don’t worry, the specific changes you need to make are covered in detail in my YouTube video (link in the description below)!

Bonus: Free Updated main.yml File

For your convenience, I’ve provided a fully updated main.yml file on my GitHub repository (link in the description below). This file incorporates the necessary changes to address the deprecated include module.

By following these steps and utilizing the provided resources, you’ll have your Ansible playbooks running smoothly and up-to-date with the latest Ansible practices!

By following these steps and utilizing the provided resources, you’ll have your Ansible playbooks running smoothly and up-to-date with the latest Ansible practices!

GitHub repo: VIEW ON GITHUB

You may also like