Documentation

2. Upgrading Ansible Tower

2.1. Upgrade Planning

This section covers changes that you should keep in mind as you attempt to upgrade your Ansible Tower Instance

  • If you are not yet using a 2.4.x version of Ansible Tower, do not attempt to upgrade directly to Ansible Tower 3.0. You must start with a system which has a verison of Tower 2.4.x installed or the upgrade will fail.
  • Ansible Tower 3.0 simplifies installation and removes the need to run ./configure/ as part of the initial setup.
  • The file tower_setup_conf.yml is no long used. Instead, you should now edit the inventory file in the /ansible-tower-setup-<tower_version>/ directory.
  • Earlier version of Tower used MongoDB when setting up an initial database; please note that Ansible Tower 3.0 has replaced the use of MongoDB with PostgreSQL.

2.2. Obtaining Ansible Tower

Download and then extract the Ansible Tower installation/upgrade tool: http://releases.ansible.com/ansible-tower/setup/

root@localhost:~$ tar xvzf ansible-tower-setup-latest.tar.gz
root@localhost:~$ cd ansible-tower-setup-<tower_version>

To install or upgrade, start by editing the inventory file in the ansible-tower-setup-<tower_version> directory, replacing <tower_version> with the version number, such as 2.4.5 or 3.0.0. directory.

2.4. Setting up the Inventory File

As you edit your inventory file, there are a few things you must keep in mind:

  • The contents of the inventory file should be defined in ./inventory, next to the ./setup.sh installer playbook.
  • For installations and upgrades: If you need to make use of external databases, you must ensure the database sections of your inventory file are properly setup. Edit this file and add your external database information before running the setup script.
  • For redundant installations: If you are creating a redundant setup, you must replace localhost with the hostname or IP address of the primary instance.
  • For installations: When performing an installation, you must supply any necessary passwords in the inventory file.
  • For upgrades: When upgrading, your prior configuration should migrate over and filling out the passwords in the inventory file should be unnecessary.
admin_password='password'
redis_password='password'
pg_password='password'

Note

Redis passwords must not contain spaces or any of the following characters: @, :, -, \, /, #

For example, Passw0rd is acceptable, but P@ssword is not. (It is not recommended that you use this example password as anything other than an example. Setting your actual password to anything other than a secure password that is only known by you or your trusted administration staff is extremly dangerous.)

Example Inventory file

[primary]
localhost ansible_connection=local

[secondary]

[database]

[all:vars]
admin_password='password'
redis_password='password'

pg_host=''
pg_port=''

pg_database='awx'
pg_username='awx'
pg_password='password'

Example Inventory file for an external existing database

[primary]
node1.example.com ansible_connection=local

[secondary]
node2.example.com

[database]

[all:vars]
admin_password='password'
redis_password='password'

pg_host=‘database.example.com’
pg_port=’5432’

pg_database='awx'
pg_username='awx'
pg_password='password'

Example Inventory file for external database which needs installation

[primary]
node1.example.com ansible_connection=local

[secondary]
node2.example.com

[database]
database.example.com

[all:vars]
admin_password='password'
redis_password='password'

pg_host=‘database.example.com’
pg_port=’5432’

pg_database='awx'
pg_username='awx'
pg_password='password'

Once any necessary changes have been made, you are ready to run ./setup.sh.

Note

Root access to the remote machines is required. With Ansible, this can be achieved in different ways:

  • ansible_ssh_user=root ansible_ssh_password=”your_password_here” inventory host or group variables
  • ansible_ssh_user=root ansible_ssh_private_key_file=”path_to_your_keyfile.pem” inventory host or group variables
  • ANSIBLE_BECOME_METHOD=’sudo’ ANSIBLE_BECOME=True ./setup.sh
  • ANSIBLE_SUDO=True ./setup.sh

2.5. The Setup Playbook

Note

Ansible Tower 3.0 simplifies installation and removes the need to run ./configure/ as part of the installation setup. Users of older versions should follow the instructions available in the v.2.4.5 (or earlier) releases of the Tower Documentation available at: http://docs.ansible.com/

The Tower setup playbook script uses the inventory file and is invoked as ./setup.sh from the path where you unpacked the Tower installer tarball.

root@localhost:~$ ./setup.sh

The setup script takes the following arguments:

  • -h – Show this help message and exit
  • -i INVENTORY_FILE – Path to Ansible inventory file (default: inventory)
  • -e EXTRA_VARS – Set additional Ansible variables as key=value or YAML/JSON (i.e. -e bundle_install=false forces an online installation)
  • -b – Perform a database backup in lieu of installing
  • -r – Perform a database restore in lieu of installing (a default restore path is used unless EXTRA_VARS are provided with a non-default path, as shown in the code example below)
./setup.sh -e 'restore_backup_file=/path/to/nondefault/location' -r

Note

Please note that a issue was discovered in Tower 3.0.0 and 3.0.1 that prevented proper system backups and retorations.

If you need to back up or restore your Tower v3.0.0 or v3.0.1 installation, use the v3.0.2 installer to do so.