This repo allows for a simple VM environment to be created on a mobile laptop (e.g. MBP)
This Example Ansible Project will be used with is VM environment.
- vagrant installed
- vagrant-hosts plugin installed (vagrant plugin install vagrant-hosts)
- virtual box installed (provider)
$ git clone https://github.com/johnkim76/ansible_tower_vm_env.git
$ cd ansible_tower_vm_env
$ vagrant up
One Tower, and 3 Additional ansible-hosts will be created
$ vagrant status
Current machine states:
tower running (virtualbox)
machine1 running (virtualbox)
machine2 running (virtualbox)
machine3 running (virtualbox)
The following maps the VM name to the hostname & IP address
VM Name | Hostname | IP Address |
---|---|---|
tower | ansible-tower.example.com | 192.168.37.20 |
machine1 | ansible-node1.example.com | 192.168.37.21 |
machine2 | ansible-node2.example.com | 192.168.37.22 |
machine3 | ansible-node3.example.com | 192.168.37.23 |
NOTE: All VM's internally mounts this repo (parent) folder to /vagrant. Therefore, you can easily bring files back and forth from any of the VMs by simply copying files to and from /vagrant and this parent repo folder on the laptop.
You'll need to logon to the Tower VM to view the MOTD message containing the initial login credentials. If you restore from a backup, the password will be restored to what it was in the backup files.
$ vagrant ssh tower
Last login: Mon Apr 10 22:11:00 2020 from gateway
Welcome to Ansible Tower!
Log into the web interface here:
https://10.44.0.45/
Username: admin
Password: <password>
The documentation for Ansible Tower is available here:
http://www.ansible.com/tower/
If something happened to a VM, I found it easier to simply destroy that VM and recreate it
$ vagrant destroy <vm name>
$ vagrant up <vm name>
Once you've setup your Ansible Tower, you may want to back it up and create a tarball on the /vagrant folder for you to restore from. The below are simple notes to backup and restore your tower settings.
$ vagrant ssh tower
$ sudo su -
$ curl https://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-3.6.3-1.tar.gz > ansible-tower-setup-3.6.3-1.tar.gz
$ tar xfvz ansible-tower-setup-3.6.3-1.tar.gz
Navigate to the Ansible Tower folder, and edit the inventory file. Fill in blank password values
$ cd ansible-tower-setup-3.6.3-1
$ vi inventory
...
admin_password='admin'
...
pg_password='awx'
...
rabbitmq_password='tower'
$ ./setup.sh -e 'backup_dest=/path/to/tower/backup/folder/' -b
$ ./setup.sh -e 'restore_backup_file=/path/to/tower/backup/folder/tower-backup-latest.tar.gz' -r