Ansible is a fast-moving project, and with releases and new features added, new modules (and module enhancements) are released and the inevitable bugs that come with the software are fixed. There is no doubt that you will end up writing your code against one version of Ansible only to need to run it on a newer version again at some point. By way of example, when we started writing this book, the current release of Ansible was 2.7. As we are editing this book ready for publication, version 2.9.6 is the current stable version.
Often, you will find that your code from an earlier version "just about works" when you upgrade it, but this isn't always a given. Modules are sometimes deprecated (although usually not without warning) and features do change. Several major changes are expected when Ansible 2.10 is released. So, the question...