Ansible Tower Vagrant

From tannerjc wiki
Jump to: navigation, search

Tower is published as a vagrant box here https://app.vagrantup.com/ansible/boxes/tower

The box is only published as a virtualbox image and is not usable by default with libvirt.

# get the virtualbox image
vagrant box add ansible/tower
# install the mutate plugin
VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install vagrant-mutate
# mutate the box into a libvirt box
vagrant mutate ansible/tower libvirt

Before you can use the box, the vagrantfile needs to be created with a few key settings.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "ansible/tower"
  config.vm.provider :libvirt do |libvirt|
    # default cpus is 1
    libvirt.cpus = 2
    # default memory is less than a gig
    libvirt.memory = 8096
    # match this value to the same mask set for your vagrant-libvirt 
    # network as listed by virt-manager.
    libvirt.management_network_address = "10.99.99.0/24"
  end
  # nfs config is a PITA.
  config.vm.synced_folder ".", "/vagrant", disabled: true
end

Spin up the machine

vagrant up --provider=libvirt

Connect to the machine and note the MOTD

[jtanner@jt420 tower]$ vagrant ssh
Ignoring nokogiri-1.6.8.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8.1
Ignoring unf_ext-0.0.7.4 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.4
Last login: Thu Jun  7 00:39:01 2018 from 192.168.122.1

  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/

The url listed is incorrect. Check the ip settings and use that ip instead

[vagrant@localhost ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:62:1b:b1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.36/24 brd 192.168.122.255 scope global noprefixroute dynamic ens4
       valid_lft 2273sec preferred_lft 2273sec
    inet6 fe80::9f26:b82b:5185:a43c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever