Skip to content

ebiznext/ansible-oraclexe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-oraclexe

#Ansible playbook for oracle-xe

This is an Ansible playbook for Oracle XE 11g. You can use it by itself or as part of a larger playbook customized for your local environment.

It has been tested with ubuntu-14.04, fedora-21 and may be used to create ansible oraclexe base images for Docker (fupelaqu/ansible-oraclexe-docker-base)

Prerequisites

You need to download Oracle XE 11g release 2 from oracle and add oracle-xe-*.rpm under ./files directory.

Steps

Testing locally with Vagrant

A sample Vagrant configuration is provided to help with local testing. After installing Vagrant, run vagrant up at the root of the project to get a VM instance bootstrapped and configured with a running instance of Oracle XE 11g.

Include role in a larger playbook

Add this role as a git submodule

Assuming your playbook structure is such as:

- my-master-playbook
  |- vars
  |- roles
  |- my-master-playbook-main.yml
  \- my-master-inventory.ini

Checkout this project as a submodule under roles:

$  cd roles
$  git submodule add git://github.com/fupelaqu/ansible-oraclexe.git ./ansible-oraclexe
$  git submodule update --init
$  git commit ./ansible-oraclexe -m "Added ansible-oraclexe as ./ansible-oraclexe"

Include this playbook as a role in your master playbook

Example my-master-playbook-main.yml:

---

#########################
# Oracle XE install #
#########################

- hosts: dbservers
  user: ubuntu
  sudo: yes

  roles:
    - ansible-oraclexe

  vars_files:
    - vars/my-vars.yml

Ansible oraclexe base images for docker

Exemple for ubuntu-14.04 ansible base image

site.yml:

---

#########################
# Docker Oracle XE install #
#########################

  - name: Install oracle-xe db
    hosts: localhost
    roles:
      - ansible-oraclexe

start.sh: madhead/docker-oracle-xe

#!/bin/bash

# Update HOST with actual value, uniquely generated by Docker on each start
sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" $ORACLE_HOME/network/admin/listener.ora
sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" $ORACLE_HOME/network/admin/tnsnames.ora

while true; do
    pmon=`ps -ef | grep pmon_$ORACLE_SID | grep -v grep`

    if [ "$pmon" == "" ]
    then
        date
        /etc/init.d/oracle-xe start
    fi
    sleep 1m
done;

Dockerfile: ansible-docker-base

FROM ansible/ubuntu14.04-ansible

# Add playbooks to the Docker image
ADD site.yml /tmp/site.yml
ADD roles /tmp/

WORKDIR /tmp

# Run Ansible to configure the Docker image
RUN ansible-playbook site.yml -c local -e docker=yes && \
    rm -rf /tmp/*

ENV ORACLE_HOME /u01/app/oracle/product/11.2.0/xe
ENV ORACLE_SID  XE
ENV PATH        $ORACLE_HOME/bin:$PATH

EXPOSE 1521
EXPOSE 8080

# Run script
ADD start.sh /
RUN chmod u+x /start.sh
CMD /start.sh

Issues, requests, contributions

This software is provided as is. Having said that, if you see an issue, feel free to log a ticket. We'll do our best to address it. Same if you want to see a certain feature supported in the fututre. No guarantees are made that any requested feature will be implemented. If you'd like to contribute, feel free to clone and submit a pull request.

Dependencies

None

License

MIT

Author Information

Stéphane Manciot - stephane.manciot [at] gmail.com

About

Ansible playbook for oracle-xe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%