-
Notifications
You must be signed in to change notification settings - Fork 1
/
centos7-oraclexe.yml
51 lines (47 loc) · 1.67 KB
/
centos7-oraclexe.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
#Vagrant Ansible Playbook
- name: Install docker and base images
hosts: docker
remote_user: $user
roles:
- {role: docker, pip_version_docker_py: 1.1}
vars_files:
- defaults/main.yml
- vars/centos7.yml
post_tasks:
- include: tasks/main.yml
- name: Install oracle db and schemas
hosts: oracle
remote_user: $user
pre_tasks:
- set_fact: oracle_xe_base_image=centos7-oraclexe
roles:
- oracle
post_tasks:
- set_fact: db_port=1522
- name: ensure oracle container is running
docker:
image: "{{module}}:{{module_version}}"
memory_limit: 1024MB
name: "{{module}}"
ports: 1521
state: reloaded
restart_policy: always
register: start_oracle
- name: inspect oracle container
shell: docker inspect {{module}}
register: inspect_oracle_response
- set_fact: oracle_db_ip="{{(inspect_oracle_response.stdout|from_json)[0].NetworkSettings.IPAddress}}" oracle_db_port="{{(inspect_oracle_response.stdout|from_json)[0].NetworkSettings.Ports['1521/tcp'][0].HostPort}}"
when: inspect_oracle_response|changed
- name: ensure {{module}} ambassador is running
docker:
image: cpuguy83/docker-grand-ambassador
name: "oracle_{{module}}_ambassador"
command: "-name {{module}}"
net: "bridge"
expose: "1521"
ports: "{{ hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] }}:{{db_port}}:1521"
volumes: /var/run/docker.sock:/var/run/docker.sock:ro
state: reloaded
restart_policy: always
register: start_ambassador