├── .gitignore ├── README.md ├── Vagrantfile ├── oracle ├── set_listener.sql └── xe.rsp └── provisioning ├── inventory ├── oracle-xe.yml └── windows.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | vagrant_ansible_inventory_default 3 | oracle/*.zip 4 | oracle/Disk1 5 | oracle/Disk2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vagrant-centos-oracle 2 | ----------------- 3 | 4 | Vagrant box with oracle xe setup using ansible. 5 | 6 | Read the tutorial: 7 | 8 | http://blog.codiez.co.za/2013/11/vagrant-centos-64-base-box/ 9 | 10 | http://blog.codiez.co.za//2013/11/install-oracle-centos-64-vagrant-ansible/ 11 | 12 | Instructions 13 | ----------------- 14 | If you just want to run this, you can do the following: 15 | 16 | 1. Install Virtualbox 4.3.2 - https://www.virtualbox.org/wiki/Downloads 17 | 2. Install Vagrant 1.3.5 - http://downloads.vagrantup.com/ 18 | 3. Install Git - http://git-scm.com/downloads 19 | 4. Clone this repo - `git clone https://github.com/ismaild/vagrant-centos-oracle.git` 20 | 5. Run `vagrant up` from within `vagrant-centos-oracle` 21 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | config.vm.box = "CentOS-6.4-x86_64" 9 | config.vm.box_url = "https://dl.dropboxusercontent.com/u/3318148/vagrant/CentOS-6.4-x86_64-v2.box" 10 | 11 | config.vm.provider :virtualbox do |vb| 12 | vb.customize ["modifyvm", :id, "--memory", "1024"] 13 | end 14 | 15 | # ansible is not supported on windows, so we bootstrap it in VM and run the playbooks 16 | require 'rbconfig' 17 | is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) 18 | if is_windows 19 | config.vm.provision "shell" do |sh| 20 | sh.path = "provisioning/windows.sh" 21 | sh.args = "provisioning/oracle-xe.yml provisioning/inventory" 22 | end 23 | else 24 | config.vm.provision "ansible" do |ansible| 25 | ansible.playbook = "provisioning/oracle-xe.yml" 26 | end 27 | end 28 | 29 | config.vm.network "forwarded_port", guest: 8080, host: 8080, auto_correct: true 30 | config.vm.network "forwarded_port", guest: 1521, host: 1521, auto_correct: true 31 | end 32 | -------------------------------------------------------------------------------- /oracle/set_listener.sql: -------------------------------------------------------------------------------- 1 | EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); 2 | quit; 3 | / -------------------------------------------------------------------------------- /oracle/xe.rsp: -------------------------------------------------------------------------------- 1 | ORACLE_HTTP_PORT=8080 2 | ORACLE_LISTENER_PORT=1521 3 | ORACLE_PASSWORD=manager 4 | ORACLE_CONFIRM_PASSWORD=manager 5 | ORACLE_DBENABLE=y -------------------------------------------------------------------------------- /provisioning/inventory: -------------------------------------------------------------------------------- 1 | default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 -------------------------------------------------------------------------------- /provisioning/oracle-xe.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | sudo: yes 4 | tasks: 5 | - name: ensure packages required are installed 6 | yum: pkg={{item}} state=latest 7 | with_items: 8 | - libaio 9 | - bc 10 | - flex 11 | - unzip 12 | - name: unzip oracle rpm 13 | command: /usr/bin/unzip -q /vagrant/oracle/oracle*.rpm.zip -d /vagrant/oracle creates=/vagrant/oracle/Disk1 14 | - name: install oracle 15 | shell: /bin/rpm -ivh /vagrant/oracle/Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm creates=/u01 16 | - name: configure oracle 17 | shell: /etc/init.d/oracle-xe configure responseFile=/vagrant/oracle/xe.rsp 18 | ignore_errors: True 19 | - name: setup oracle environment 20 | shell: /bin/echo 'source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >> /home/vagrant/.bash_profile 21 | - name: stop ip tables 22 | shell: service iptables stop 23 | - name: set oracle listener 24 | shell: ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe /u01/app/oracle/product/11.2.0/xe/bin/sqlplus 25 | system/manager@localhost < /vagrant/oracle/set_listener.sql 26 | -------------------------------------------------------------------------------- /provisioning/windows.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Windows shell provisioner for Ansible playbooks, based on KSid's 4 | # windows-vagrant-ansible: https://github.com/KSid/windows-vagrant-ansible 5 | # 6 | # @todo - Allow proxy configuration to be passed in via Vagrantfile config. 7 | # 8 | # @see README.md 9 | # @author Jeff Geerling, 2014 10 | # @version 1.0 11 | # 12 | 13 | # Uncomment if behind a proxy server. 14 | # export {http,https,ftp}_proxy='http://username:password@proxy-host:80' 15 | 16 | ANSIBLE_PLAYBOOK=$1 17 | ANSIBLE_HOSTS=$2 18 | TEMP_HOSTS="/tmp/ansible_hosts" 19 | 20 | if [ ! -f /vagrant/$ANSIBLE_PLAYBOOK ]; then 21 | echo "Cannot find Ansible playbook." 22 | exit 1 23 | fi 24 | 25 | if [ ! -f /vagrant/$ANSIBLE_HOSTS ]; then 26 | echo "Cannot find Ansible hosts." 27 | exit 2 28 | fi 29 | 30 | # Install Ansible and its dependencies if it's not installed already. 31 | if [ ! -f /usr/bin/ansible ]; then 32 | echo "Installing Ansible dependencies and Git." 33 | yum install -y git python python-devel 34 | echo "Installing pip via easy_install." 35 | wget http://peak.telecommunity.com/dist/ez_setup.py 36 | python ez_setup.py && rm -f ez_setup.py 37 | easy_install pip 38 | # Make sure setuptools are installed crrectly. 39 | pip install setuptools --no-use-wheel --upgrade 40 | echo "Installing required python modules." 41 | pip install paramiko pyyaml jinja2 markupsafe 42 | echo "Installing Ansible." 43 | pip install ansible 44 | fi 45 | 46 | cp /vagrant/${ANSIBLE_HOSTS} ${TEMP_HOSTS} && chmod -x ${TEMP_HOSTS} 47 | echo "Running Ansible provisioner defined in Vagrantfile." 48 | ansible-playbook /vagrant/${ANSIBLE_PLAYBOOK} --inventory-file=${TEMP_HOSTS} --extra-vars "is_windows=true" --connection=local 49 | rm ${TEMP_HOSTS} 50 | --------------------------------------------------------------------------------