Last week, the Ansible playbook created an 11.2g Oracle database that passed the ArsDigita SQL acceptance test.
Next up, building AOL server, then the Oracle driver and finally ACS.
Last week, the Ansible playbook created an 11.2g Oracle database that passed the ArsDigita SQL acceptance test.
Next up, building AOL server, then the Oracle driver and finally ACS.
This is a follow-on to my last post, Creating a Vagrant box from Oracle 11.2g Virtualbox Appliance. It tells how to modify the Vagrant box so it is Ansible-ready.
If you successfully got vagrant up
to spin up a VirtualBox, you will see a new entry in the list that VirtualBox displays when it starts up (the bottom one in the screenshot below).
To get the Vagrant box to support Ansible, we need to modify the original one and then re-export it. In my case, the original box is called "oracle_11.2g", so I pick that one, click Start, and login as root (password = oracle).
Note:
One thing I found suprising about Vagrant is that an up/halt cycle of the vagrant box saves state. That is, if you
the installed software is still there.
vagrant up
,- install some software,
vagrant halt
, and thenvagrant up
againTo restart from a blank state (say, if you want to retest your Ansible script from step 1), you need to delete the VirtualBox that Vagrant generates, then run
vagrant up
.
The version of Oracle Linux that comes in the 11.2g appliance does not provide a Python version greater than 2.4. (I'm guessing Oracle built there's based on Centos 5.9). To get a more recent Python, you need to install "Extra Packages for Enterprise Linux". I followed How to Enable EPEL Repository for RHEL/CentOS 6/5
[root@localhost ~]# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm --2013-08-16 06:43:58-- http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm Resolving download.fedoraproject.org... 66.135.62.201, 67.203.2.67, 66.35.62.166, ... Connecting to download.fedoraproject.org|66.135.62.201|:80... connected. HTTP request sent, awaiting response... 302 FOUND Location: http://mirror.pnl.gov/epel/5/i386/epel-release-5-4.noarch.rpm [following] --2013-08-16 06:43:59-- http://mirror.pnl.gov/epel/5/i386/epel-release-5-4.noarch.rpm Resolving mirror.pnl.gov... 192.101.102.2 Connecting to mirror.pnl.gov|192.101.102.2|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 12232 (12K) [application/octet-stream] Saving to: `epel-release-5-4.noarch.rpm' 100%[==============================>] 12,232 --.-K/s in 0.09s 2013-08-16 06:44:00 (128 KB/s) - `epel-release-5-4.noarch.rpm' saved [12232/12232] [root@localhost ~]# rpm -ivh epel-release-5-4.noarch.rpm warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6 Preparing... ################################# [100%] 1:epel-release ################################# [100%] [root@localhost ~]#
# yum update # yum install python26 # cd /usr/bin # ln -sf python26 python [root@localhost bin]# python -V Python 2.6.8 #
# halt -p
We repeat the steps from the last log entry, except that we remove the old version before adding the new one.
$ cd ~/VirtualBox\ VMs/oracle_11.2g $ rm package.box $ vagrant package --base oracle_11.2g [oracle_11.2g] Clearing any previously set forwarded ports... [oracle_11.2g] Creating temporary directory for export... [oracle_11.2g] Exporting VM... [oracle_11.2g] Compressing package to: /Users/mark/VirtualBox VMs/oracle_11.2g/package.box $ vagrant box remove oracle_11.2g Removing box 'oracle_11.2g' with provider 'virtualbox'... $ vagrant box add oracle_11.2g package.box Downloading or copying the box... Extracting box...te: 216M/s, Estimated time remaining: --:--:--) Successfully added box 'oracle_11.2g' with provider 'virtualbox'! $
$ cd ~/src/cm3/ansible $ vi Vagrantfile ... $ cat Vagrantfile VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "oracle_11.2g" config.vm.network :private_network, ip: "192.168.67.10" end $ vagrant up $ ping 192.168.67.10 PING 192.168.67.10 (192.168.67.10): 56 data bytes 64 bytes from 192.168.67.10: icmp_seq=0 ttl=64 time=1.071 ms ^C --- 192.168.67.10 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 1.071/1.071/1.071/0.000 ms $
By default, Ansible ssh's in on the usual port.
$ ssh vagrant@192.168.67.10 vagrant@192.168.67.10's password: Last login: Sat Aug 17 18:54:12 2013 from 192.168.67.1 [vagrant@localhost ~]$ exit
Add the static IP of the Vagrant host as well as the ssh credentials to the Ansible hosts file
$ vi /etc/ansible/hosts ... $ cat /etc/ansible/hosts [vagrant] 192.168.67.10 ansible_ssh_user=vagrant ansible_ssh_pass=vagrant ansible_ssh_pass=vagrant $
Hello World, in Ansible
$ cat playbook.yml - hosts: vagrant sudo: yes tasks: - name: Test task. command: /bin/echo "Hello World!" $
Action!
$ ansible-playbook playbook.yml PLAY [vagrant] *********************************************************** GATHERING FACTS ********************************************************** ok: [192.168.67.10] TASK: [Test task.] ******************************************************* changed: [192.168.67.10] PLAY RECAP *************************************************************** 192.168.67.10 : ok=2 changed=1 unreachable=0 failed=0 $Next up ... we build an Ansible playbook to install AOLSever, start up Oracle and install ArsDigita Community System.
I'm having a hell of a time trying to get a box up and running with v3 of ArsDigita Community System, the version described in the book Philip and Alex's Guide to Web Publishing.
My current plan is to create a Vagrant box with Oracle 11.2g and use Ansible to automate as much of the setup as possible.
Here are the best source code links I have found so far:
I've looked at OpenACS a bunch. I really wanted to use it as it would save me a ton of time, but I'm not a big fan. Their web site is hard to navigate, not all the ACS 3.0 modules were converted, and the focus of 4.0 seems to have shifted to bug tracking and CMS, which seems like a poor decision in retrospect. The quality of the ArsDigita documentation is so much better, and I expect the code, UX and data schemas will also be superior. So I'm going to try this route.
This blog entry documents step 1: creating the vagrant box from the Oracle Virtualbox appliance.
From a brief look at the Oracle store, it looks I could get a one-CPU perpetual license for Oracle for somewhere around $150. (In the ArsDigita Oracle install documentation, they say that Oracle would cost $40, and that is circa 2000. That's a 11% annual rate of increase, not bad!) In any case, Oracle is free for development uses.
[oracle@localhost ~]$ su - root Password: oracle [root@localhost ~]# adduser vagrant [root@localhost ~]# usermod -G wheel vagrant [root@localhost ~]# passwd vagrant Changing password for user vagrant. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@localhost ~]#
[root@localhost ~]# cp /etc/sudoers.orig /etc/sudoers [root@localhost ~]# visudo < edits: * don't require TTY (so password-less sudo works via SSH) * don't require password for users in wheel group sudo > [root@localhost ~]# diff /etc/sudoers /etc/sudoers.orig 56c56 < Defaults requiretty --- > # Defaults requiretty 86c86 < # %wheel ALL=(ALL) NOPASSWD: ALL --- > %wheel ALL=(ALL) NOPASSWD: ALL
Note: Oracle Linux certificate bundle does not come with the DigiCert one (see http://bugs.centos.org/view.php?id=4899). So we use the -k
argument to tell curl it is OK to accept the "insecure" file from github.
[root@localhost ~]# curl -kL $h/keys/vagrant.pub > vagrant.pub % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 409 100 409 0 0 315 0 0:00:01 0:00:01 --:--:-- 399k [root@localhost ~]# mkdir ~vagrant/.ssh [root@localhost ~]# cp vagrant.pub ~vagrant/.ssh/authorized_keys [root@localhost ~]# chmod 700 ~vagrant/.ssh [root@localhost ~]# chmod 600 ~vagrant/.ssh/authorized_keys [root@localhost ~]# chown vagrant.vagrant ~vagrant/.ssh [root@localhost ~]# chown vagrant.vagrant ~vagrant/.ssh/authorized_keys
[root@localhost ~]# vi /etc/ssh/sshd_config ... Port 22 Port 2222 ...
In VirtualBox GUI, rename Oracle VM from "Oracle Developer Days" to "oracle_11.2g" (mainly cosmetic). Then we package up the box and add it to Vagrant: $ cd ~/VirtualBox\ VMs/oracle_11.2g $ time vagrant package --base oracle_11.2g [oracle_11.2g] Clearing any previously set forwarded ports... [oracle_11.2g] Creating temporary directory for export... [oracle_11.2g] Exporting VM... [oracle_11.2g] Compressing package to: /Users/mark/VirtualBox VMs/oracle_11.2g/package.box real 11m6.57s user 5m3.42s sys 0m6.07s $ vagrant box add oracle_11.2g package.box Successfully added box 'oracle_11.2g' with provider 'virtualbox'! $
$ cat > Vagrantfile VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "oracle_11.2g" end ^D $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Importing base box 'oracle_11.2g'... [default] Matching MAC address for NAT networking... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Mounting shared folders... [default] -- /vagrantThe box should open without error. If there are problems, Vagrant shows you the stdout and stderr output, which should give you a clue as to the problem. To shut it down, type
$ vagrant halt
.
Next up, configuring the server with Ansible.
# cat vagrant > /etc/myname # hostname vagrant
# echo dhcp > /etc/hostname.em0 # rm -f /etc/resolv.conf
# pkg_add bash
# pkg_add python Ambiguous: choose package for python a 0: <None> 1: python-2.5.4p18 2: python-2.7.3p1 3: python-3.2.3.p0 Your choice: 2 ...
# adduser vagrant shell = bash group = vagrant password = vagrant ... # usermod -G wheel vagrant
# visudo [uncomment the line:] %wheel ALL=(ALL) NOPASSWD: SETENV: ALL
# export h=http://github.com/mitchellh/vagrant/raw/master # ftp $h/keys/vagrant -o vagrant # ftp $h/keys/vagrant.pub -o vagrant.pub # cp vagrant ~vagrant/.ssh # cp vagrant.put ~vagrant/.ssh/authorized_keys # chmod 0700 ~vagrant/.ssh # chmod 0640 ~vagrant/.ssh/authorized_keys # chmod 0640 ~vagrant/.ssh/vagrant
# sudo vi /etc/ssh/sshd_config [uncomment Port 22 line and add Port 2222 line after that.]
- Open VirtualBox. - Settings --> General --> Basic - Set name to vagrant_openbsd_5.3
$ cd ~/VirtualBox\ VMs/vagrant_openbsd_5.3 $ rm -f package.box $ vagrant package --base vagrant_openbsd_5.3 [vagrant_openbsd_5.3] Clearing any previously set forwarded ports... [vagrant_openbsd_5.3] Creating temporary directory for export... [vagrant_openbsd_5.3] Exporting VM... [vagrant_openbsd_5.3] Compressing package to: /Users/mark/VirtualBox VMs/vagrant_openbsd_5.3/package.box $
$ vagrant box remove vagrant_openbsd_5.3 virtualbox $ vagrant box add vagrant_openbsd_5.3 package.box Downloading or copying the box... Extracting box...te: 439M/s, Estimated time remaining: --:--:--) Successfully added box 'vagrant_openbsd_5.3' with provider 'virtualbox'! $ vagrant box list openbsd (virtualbox) vagrant_openbsd_5.3 (virtualbox) $
$vagrant plugin install vagrant-guests-openbsd
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.require_plugin "vagrant-guests-openbsd" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "vagrant_openbsd_5.3" # config.vm.guest = :openbsd_v2 config.vm.synced_folder "../", "/vagrant", :disabled => true #config.vm.synced_folder "../", "/vagrant", :nfs => true config.vm.network :private_network, ip: "192.168.67.10", netmask: "255.255.255.0" # Uncomment to debug. #config.vm.provider "virtualbox" do |v| # v.gui = true #end end
$ time vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] No guest additions were detected on the base box for this VM! Guest additions are required for forwarded ports, shared folders, host only networking, and more. If SSH fails on this machine, please install the guest additions and repackage the box to continue. This is not an error message; everything may continue to work properly, in which case you may ignore this message. [default] Mounting shared folders... real 0m51.05s user 0m1.46s sys 0m0.55s $ vagrant ssh Last login: Fri Aug 2 15:39:10 2013 from 10.0.2.2 OpenBSD 5.3 (GENERIC) #50: Tue Mar 12 18:35:23 MDT 2013 Welcome to OpenBSD: The proactively secure Unix-like operating system. Please use the sendbug(1) utility to report bugs in the system. Before reporting a bug, please try to reproduce it with the latest version of the code. With bug reports, please try to ensure that enough information to reproduce the problem is enclosed, and if a known fix for it exists, include that as well. $ whoami vagrant $ hostname vagrant $ exit Connection to 127.0.0.1 closed. $ time vagrant halt [default] Attempting graceful shutdown of VM... real 0m14.15s user 0m1.23s sys 0m0.50s $