Running different versions of Ansible from source

You can run Ansible from a source code checkout (we will look at Git as a version control mechanism in Chapter 10, Working with Git): 

$ git clone https://github.com/ansible/ansible.git --recursive
$ cd ansible/
$ source ./hacking/env-setup
...
Setting up Ansible to run out of checkout...
$ ansible --version
ansible 2.7.0.dev0 (devel cde3a03b32) last updated 2018/07/11 08:39:39 (GMT -700)
config file = /etc/ansible/ansible.cfg
...

To run different versions, we can simply use git checkout for the different branch or tag and perform the environment setup again:

$ git branch -a
$ git tag --list
$ git checkout v2.5.6
...
HEAD is now at 0c985fe... New release v2.5.6
$ source ./hacking/env-setup
$ ansible --version
ansible 2.5.6 (detached HEAD 0c985fee8a) last updated 2018/07/11 08:48:20 (GMT -700)
config file = /etc/ansible/ansible.cfg
If the Git commands seem a bit strange to you, we will cover Git in more detail in Chapter 10, Working with Git

Once we are at the version you need, such as Ansible 2.2, we can run the update for the core modules for that version: 

$ ansible --version
ansible 2.2.3.0 (detached HEAD f5be18f409) last updated 2018/07/14 07:40:09 (GMT -700)
...
$ git submodule update --init --recursive

Submodule 'lib/ansible/modules/core' (https://github.com/ansible/ansible-modules-core) registered for path 'lib/ansible/modules/core'

Let's take a look at the lab topology we will use in this chapter and Chapter 8, The Python Automation Framework – Beyond Basics

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset