Skip to content

Instantly share code, notes, and snippets.

@jlaska
Created November 9, 2016 03:31
Show Gist options
  • Save jlaska/f727eda68e348710d3ebec6d8b7ad98f to your computer and use it in GitHub Desktop.
Save jlaska/f727eda68e348710d3ebec6d8b7ad98f to your computer and use it in GitHub Desktop.
Starting ansible-tower vagrant box
# vagrant init ansible/tower
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
# vagrant up --provider virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ansible/tower' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ansible/tower'
default: URL: https://atlas.hashicorp.com/ansible/tower
==> default: Adding box 'ansible/tower' (v3.0.3) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/ansible/boxes/tower/versions/3.0.3/providers/virtualbox.box
==> default: Successfully added box 'ansible/tower' (v3.0.3) for 'virtualbox'!
==> default: Importing base box 'ansible/tower'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ansible/tower' is up to date...
==> default: Setting the name of the VM: ansible-tower_default_1478662182181_94133
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/jlaska/Projects/ansible-tower
# vagrant ssh
Welcome to Ansible Tower!
Log into the web interface here:
https://10.42.0.42/
Username: admin
Password: ************
The documentation for Ansible Tower is available here:
http://www.ansible.com/tower/
For help, visit http://support.ansible.com/
[vagrant@ansible-tower ~]$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[vagrant@ansible-tower ~]$ rpm -q ansible-tower
ansible-tower-3.0.3-1.el7.centos.x86_64
@prajnadnayak
Copy link

I am able to bring the vagrant up but when i do vagrant ssh it does not show the display message with the admin password and the tower login. Can you please help ?

@dealkk
Copy link

dealkk commented Jan 22, 2018

same no password or url

@vtzan
Copy link

vtzan commented Jan 22, 2018

+1 no url / no password provided after vagrant ssh

@vtzan
Copy link

vtzan commented Jan 22, 2018

Solution:

Well with little reverse engineering here are the steps to retrieve your password if you don't see the MOTD Message

Execute the following commands:

vagrant ssh

echo "from django.contrib.auth.models import User; passwd=User.objects.make_random_password(length=12); usr=User.objects.get(username='admin'); usr.set_password(passwd); usr.save(); open('{{admin_password_file}}', 'w').write(passwd); import os; os.chmod('{{admin_password_file}}', 0640);" | awx-manage shell

cat /etc/tower/{{admin_password_file}}

  1. get the ip address of where http server is running
    ss -a |grep https|awk -F " " '{print $5}'

You should see something like

*:https
10.42.0.42:https

And then only have to type https://10.42.0.42 on your browser and type Username: admin and password the result of command 3) and voila enjoy Ansible Tower!!!

@prajnadnayak
Copy link

prajnadnayak commented Jan 30, 2018

SOLUTION::

thank you @vtzan. Finally someone looked into this issue and provided the some solution.
but step 3 and 4 did not work. step 3 said "No such file or directory". and step4 only displayed *:https

This is what I did to get the admin password and the URL:
/etc/tower/51-tower-welcome.j2 has the default IP address and the default password for admin.

your login url will be https://
user name and password are also present in the same file.

I was able to open the URL but the default password for admin did not work so i manually changed the password with the below command awx-manage changepassword admin

Voilaa!! I am finally able to login to tower now. I hope Ansible updates the document or vagrant starts displaying the MOTD with the password and the URL

@rsheyd
Copy link

rsheyd commented Jan 30, 2018

Neither above worked for me (there was no 51-tower-welcome.j2 file in /etc/tower). I had to reset admin password using tower-manage command, and was able to use the default ip (https://10.42.0.42) to login.

To reset admin password:
sudo tower-manage changepassword admin

@jiang-wei
Copy link

@rsheyd good solution.
but after the login, it jumps to a page to ask me for a licence :(

@Kalyan-Alamuru
Copy link

I tried to run Vagarnat Up Command after installing Virtual Box and Ansible Tower Image. I'm getting following error, Even I checked BIOS to see whether I need to enable any virtualization options. I've two options which are alredy enabled they are : Intel(R) Vitualization Technology and Interl (R) VT-d Feature, But I don't see any VT-x. Is it old one one?

Stderr: VBoxManage: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment