Skip to content

Commit 0590718

Browse files
authored
Merge pull request #1 from oravirt/master
upstream sync
2 parents 4b4c1f5 + 788e3ae commit 0590718

File tree

245 files changed

+17256
-2498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+17256
-2498
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "library"]
2+
path = library
3+
url = https://github.com/oravirt/ansible-oracle-modules
4+
branch = master

README.md

Lines changed: 158 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,59 @@
1+
# ansible-oracle
12

3+
- Installs Oracle RAC, RAC One Node and normal single instances.
4+
- Start with one or more clean machine(s), end up with a fully configured RAC Cluster.
25

3-
<b> Requirements:
6+
### Getting started
47

5-
- Ansible >= 1.6
8+
Pre-requisites:
9+
10+
- Ansible >= 2.4
611
- Oracle Linux (or any RHEL-based Linux System) >= 6.4
7-
- Oracle Database/Grid Infrastructure 12.2.0.1, 12.1.0.1, 12.1.0.2, 11.2.0.4, 11.2.0.3
12+
- Oracle Database/Grid Infrastructure 18.3.0.0, 12.2.0.1, 12.1.0.1, 12.1.0.2, 11.2.0.4, 11.2.0.3
13+
- For example configurations, look in:
14+
```
15+
SI/FS: group_vars/vbox-si-fs. - vagrant config: http://github.com/oravirt/vagrant-vbox-si-fs
16+
SI/ASM: group_vars/vbox-si-asm - vagrant config: http://github.com/oravirt/vagrant-vbox-si-asm
17+
RAC/ASM: group_vars/vbox-rac-dc1 - vagrant config: http://github.com/oravirt/vagrant-vbox-rac
18+
```
19+
20+
By default, installs a single instance 18.3.0.0 database on a filesystem.
21+
22+
1. Clone this repository:
23+
`git clone --recursive https://github.com/oravirt/ansible-oracle`
24+
25+
2. Add the following file to `/tmp` on the controlmachine
26+
- `LINUX.X64_180000_db_home.zip`
27+
28+
3. Create an Ansible inventory file
29+
```
30+
[myhostgroup]
31+
dbhost
32+
```
833

9-
</b>
34+
4. Run the playbook:
1035

11-
At the moment you can install Oracle RAC, RAC One Node and normal single instances.
12-
You can take a freshly installed machine and configure it from ground up. It'll configure users, profiles, kernel parameters, storage and install the database server and create one or more databases.
13-
It also supports role separation when installing Grid Infrastructure, meaning a 'grid' user owns and runs the GI and the 'oracle' user owns and runs the databases.
36+
`ansible-playbook single-instance-db-on-fs.yml -e hostgroup=myhostgroup -i /path/to/inventory`
1437

15-
By default, you can install a single instance 12.1.0.2 database on filesystem, without having to change any parameters. Just put the following files in /tmp on the control-machine:
16-
- linuxamd64_12102_database_1of2.zip
17-
- linuxamd64_12102_database_2of2.zip
38+
where the `-i` part is optional
1839

19-
I'm creating a bunch of examples which illustrates how to use/run the different roles. They can be found here: http://oravirt.wordpress.com/category/ansible-oracle.
2040

21-
As this is based on the EL6 platform the lowest supported Oracle version will be 11.2.0.3, as per Oracle's certification matrix.
41+
### Roles
2242

23-
<b>Note: </b>
24-
- You'll need to manually download the Oracle software and make it available to the control-machine (either locally or on a web-server, or through a nfs-share) before running the playbook. By default the
25-
path to the software is /tmp on the control-machine.
26-
- All roles are built on Oracle Linux 6, but should work with any EL6-based system.
27-
- Storage options only supports block devices at the moment (FS & ASM). Will add support for NFS
43+
A lot of these roles uses Ansible modules that comes from [ansible-oracle-modules](https://github.com/oravirt/ansible-oracle-modules)
2844

29-
<b>The different roles are:</b>
45+
**common**
3046

31-
<b> common: </b>
3247
This will configure stuff common to all machines
33-
- Install some generic packages
34-
- Configure ntp
35-
- Possibly add a default/deploy user.
48+
- Install some generic packages
49+
- Configure ntp
50+
51+
52+
**orahost**
3653

37-
<b>orahost:</b>
3854
This will configure the host specific Oracle stuff:
3955
- Add a user & group
4056
- Create directory structures
41-
- Generate ssh-keys and set up passwordless ssh between clusternodes in case of RAC/RAC One node
4257
- Handle filesystem storage (partition devices, creates vg/lv and a filesystem (ext4, xfs, btrfs) etc). If you want to create your database on a filesystem (instead of ASM) this is where you define the layout.
4358
- Install required packages
4459
- Change kernel paramemeters
@@ -47,66 +62,151 @@ This will configure the host specific Oracle stuff:
4762
- Disables transparent hugepages
4863
- Disables NUMA (if needed)
4964
- Configures the interconnect network (if needed)
50-
- Configures Oracle ASMLib
65+
- Configures Oracle ASMLib
66+
67+
68+
**orahost-ssh**
69+
70+
Configures passwordless ssh between clusternodes if setting up RAC (`configure_cluster=True`)
71+
- Uses existing ssh-keys
72+
73+
74+
**orahost-storage**
5175

52-
<b>orahost-storage:</b>
5376
This role configures storage that shoud be used by ASM.
5477
- Partitions devices (using parted)
5578
- Create ASMlib labels or sets up udev-rules for device name persistence
5679

57-
<b>oraswgi-install:</b>
58-
This role will install and configure Oracle Grid Infrastructure. Tested with 12.1.0.1/12.1.0.2 & 11.2.0.4/11.2.0.3
80+
81+
**oraswgi-install**
82+
83+
This role will install and configure Oracle Grid Infrastructure (RAC/SI)
5984
- Adds a .profile_grid to the oracle user
6085
- Sets up directory structures
6186
- Copies the install-files to the servers, or installs from a remote location (e.g nfs share)
6287
- Install Oracle Grid Infrastructure
6388

6489

6590

66-
<b>oraasm-configureasm:</b>
67-
This role will create and configure the ASM-instance with an initial diskgroup.
91+
**oraasm-manage-diskgroups**
6892

69-
- Generates a shellscript that uses asmca to create the ASM instance
93+
This role will statefully manage the lifecycle of an ASM diskgroup
94+
- Uses the **oracle_asmdg** module
95+
- Create/delete diskgroup.
96+
- Add/remove disks
97+
- Manage attributes for the DG
7098

71-
<b>oraasm-createdg:</b>
72-
This role will create the diskgroup(s) that should be used for database storage. Uses asmca to create diskgroups.
73-
- Generates a shellscript that uses asmca to create the diskgroups.
99+
**oraswdb-install**
74100

75-
<b>oraswdb-install:</b>
76101
This role will install the oracle database server(s). It is possible to run more than 1 database from each home. It performs both Single Instance/RAC installations.
77-
- Creates a .profile_databasename
102+
- Creates a .profile with the correct environment
78103
- Creates directory structures
79-
- Transfers installfiles to server(s)
80104
- Installs the database-server(s)
81105

82-
<b>oradb-create:</b>
83-
This role creates the databases (RAC/RAC One Node, Single Instance). Possible to create container databases. Performs a dbca silent run to create the database.
84-
Note:
85-
At the moment there is no listener configured when creating a database on a filesystem (i.e no grid infrastructure present). Will be added later though.
86-
- Generates a responsefile to be used by dbca
87-
- Creates the db using dbca
88-
- Changes parameters based on input.
106+
107+
**oradb-manage-db**
108+
109+
This role statefully manages the lifecycle of a database
110+
- Uses the **oracle_db** module
111+
- Creates/deletes: `state: present/absent`
112+
- Maintains archivelog/force_logging True/False
113+
114+
**oraswgi-manage-patches**
115+
116+
Manage patches in a GI environment
117+
- Uses the **oracle_opatch** module
118+
- Manages opatchauto type of patches as well as 'normal' one-offs
119+
120+
**oraswdb-manage-patches**
121+
122+
Statefully manage patches in a DB environment
123+
- Uses the **oracle_opatch** module
124+
- Manages opatchauto type of patches as well as 'normal' one-offs
125+
126+
127+
**cxoracle**
128+
129+
Installs cx_Oracle in preparation for using [ansible-oracle-modules](https://github.com/oravirt/ansible-oracle-modules)
130+
131+
132+
**orahost-cron**
133+
134+
Configures cron schedules if needed
135+
136+
137+
**orahost-logrotate**
138+
139+
140+
**oradb-manage-<*>**
141+
142+
Statefully manages various aspects of the DB. They all use modules from [ansible-oracle-modules](https://github.com/oravirt/ansible-oracle-modules)
143+
144+
- **oradb-manage-pdb**
145+
- **oradb-manage-tablespace**
146+
- **oradb-manage-parameters**
147+
- **oradb-manage-roles**
148+
- **oradb-manage-users**
149+
- **oradb-manage-grants**
150+
- **oradb-manage-redo**
151+
- **oradb-manage-services**
152+
153+
154+
155+
### Deprecated roles
156+
157+
_**oraasm-createdg (use oraasm-manage-diskgroups instead)**_
158+
159+
_**oradb-create (use oradb-manage-db instead)**_
160+
161+
_**oradb-delete (use oradb-manage-db instead)**_
162+
163+
_**oraswgi-opatch (use oraswgi-manage-patches instead)**_
164+
89165

90166

91-
<b>oraswgi-opatch:</b>
92-
This role will use opatch to apply a patch to a Grid Infrastructure home. At the moment it is basically written to apply PSU's, not one-off patches. It'll probably work but it is not designed for that.
93-
Does an initial check to see if the patches are already applied, and skips through all steps if they are.
167+
### Note
94168

169+
These are the Oracle binaries that are pre-configured to be used. They have to be manually downloaded and made available (either locally, from a web endpoint or through a nfs-share)
95170

96-
<b>*** THE FOLLOWING ROLES ARE NOT FINISHED/NOT WORKING PROPERLY YET ****</b>
171+
For 18.3.0.0:
172+
```
173+
LINUX.X64_180000_db_home.zip
174+
LINUX.X64_180000_grid_home.zip
175+
```
97176

98-
<b>oraswgi-clone:</b>
99-
This role will use a previously installed/patched Grid Infrastructure installation to perform a new Grid Infrastructure installation using the clone method
100177

101-
<b>oraswracdb-clone:</b>
102-
This role will take a previously installed/patched Oracle Database Server installation to perform a new database server installation using the clone method.
178+
For 12.2.0.1:
179+
```
180+
linuxx64_12201_database.zip
181+
linuxx64_12201_grid_home.zip
182+
```
103183

184+
For 12.1.0.2
185+
```
186+
linuxamd64_12102_database_1of2.zip
187+
linuxamd64_12102_database_2of2.zip
188+
linuxamd64_12102_grid_1of2.zip
189+
linuxamd64_12102_grid_2of2.zip
190+
```
104191

192+
For 12.1.0.1:
193+
```
194+
linuxamd64_12c_database_1of2.zip
195+
linuxamd64_12c_database_2of2.zip
196+
linuxamd64_12c_grid_1of2.zip
197+
linuxamd64_12c_grid_2of2.zip
198+
```
105199

106-
<b>TODO</b>
107-
- Add service to database as part of db-creation
108-
- Add support for NFS storage
109-
- Cleanup
110-
- .........
200+
For 11.2.0.4:
201+
```
202+
p13390677_112040_Linux-x86-64_1of7.zip
203+
p13390677_112040_Linux-x86-64_2of7.zip
204+
p13390677_112040_Linux-x86-64_3of7.zip
205+
```
111206

112-
********************************
207+
For 11.2.0.3:
208+
```
209+
p10404530_112030_Linux-x86-64_1of7.zip
210+
p10404530_112030_Linux-x86-64_2of7.zip
211+
p10404530_112030_Linux-x86-64_3of7.zip
212+
```

aws-si-asm-install.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
3+
4+
- name: Host configuration
5+
hosts: aws-si-asm
6+
connection: local
7+
user: ec2-user
8+
become: yes
9+
roles:
10+
- common
11+
- orahost
12+
- orahost-storage
13+
14+
- name: Oracle Grid Infrastructure installation & ASM Configuration
15+
hosts: aws-si-asm
16+
connection: local
17+
user: ec2-user
18+
become: yes
19+
roles:
20+
- oraswgi-install
21+
- oraasm-createdg
22+
23+
- name: Database Server Installation & Database Creation
24+
hosts: aws-si-asm
25+
connection: local
26+
user: ec2-user
27+
become: yes
28+
roles:
29+
- oraswdb-install
30+
- oradb-manage-db
31+
32+
- name: Install cx_oracle
33+
hosts: aws-si-asm
34+
connection: local
35+
user: ec2-user
36+
become: yes
37+
roles:
38+
- cxoracle
39+
40+
- name: Configure Logrotate
41+
hosts: aws-si-asm
42+
connection: local
43+
user: ec2-user
44+
become: yes
45+
roles:
46+
- orahost-logrotate

customize-db.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- name: Customize database
2+
hosts: "{{ hostgroup }}"
3+
sudo: yes
4+
roles:
5+
- oradb-manage-pdb
6+
- oradb-manage-tablespace
7+
- oradb-manage-parameters
8+
- oradb-manage-redo
9+
- oradb-manage-roles
10+
- oradb-manage-users
11+
- oradb-manage-grants
12+
- oradb-manage-services

db-opatch.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- name: Apply binary patches
2+
hosts: "{{ hostgroup }}"
3+
become: yes
4+
serial: 1
5+
roles:
6+
- {role: oraswdb-manage-patches }
7+
8+
- name: Run datapatch
9+
hosts: "{{ hostgroup }}"
10+
become: yes
11+
roles:
12+
- {role: oradb-datapatch }

0 commit comments

Comments
 (0)