├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── fmw_bsu ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── attributes │ └── default.rb ├── chefignore ├── libraries │ └── matchers.rb ├── metadata.rb ├── providers │ ├── bsu.rb │ └── bsu_windows.rb ├── recipes │ ├── default.rb │ └── weblogic.rb ├── resources │ ├── bsu.rb │ └── bsu_windows.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── default_spec.rb │ │ └── weblogic_spec.rb ├── test.md └── test │ └── integration │ ├── wls1036 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── spec_helper.rb │ │ └── weblogic_spec.rb │ └── wls1036_win │ └── serverspec │ ├── default_spec.rb │ ├── spec_helper.rb │ └── weblogic_spec.rb ├── fmw_domain ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── attributes │ └── default.rb ├── chefignore ├── files │ └── default │ │ └── domain │ │ └── common.py ├── libraries │ ├── helper.rb │ └── matchers.rb ├── metadata.rb ├── providers │ ├── adminserver_linux.rb │ ├── adminserver_solaris.rb │ ├── adminserver_windows.rb │ ├── nodemanager_service_debian.rb │ ├── nodemanager_service_redhat.rb │ ├── nodemanager_service_redhat_7.rb │ ├── nodemanager_service_solaris.rb │ ├── nodemanager_service_windows.rb │ ├── wlst.rb │ └── wlst_windows.rb ├── recipes │ ├── adminserver.rb │ ├── default.rb │ ├── domain.rb │ ├── extension_bam.rb │ ├── extension_enterprise_scheduler.rb │ ├── extension_jrf.rb │ ├── extension_service_bus.rb │ ├── extension_soa_suite.rb │ ├── extension_webtier.rb │ └── nodemanager.rb ├── resources │ ├── adminserver_linux.rb │ ├── adminserver_solaris.rb │ ├── adminserver_windows.rb │ ├── nodemanager_service_debian.rb │ ├── nodemanager_service_redhat.rb │ ├── nodemanager_service_redhat_7.rb │ ├── nodemanager_service_solaris.rb │ ├── nodemanager_service_windows.rb │ ├── wlst.rb │ └── wlst_windows.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── adminserver_spec.rb │ │ ├── default_spec.rb │ │ ├── domain_spec.rb │ │ ├── extension_service_bus_spec.rb │ │ ├── extension_soa_suite_spec.rb │ │ └── nodemanager_spec.rb ├── templates │ └── default │ │ ├── domain │ │ ├── domain.py │ │ └── extensions │ │ │ ├── bam.py │ │ │ ├── enterprise_scheduler.py │ │ │ ├── jrf.py │ │ │ ├── service_bus.py │ │ │ ├── soa_suite.py │ │ │ └── webtier.py │ │ └── nodemanager │ │ ├── nodemanager │ │ ├── nodemanager.properties_11g │ │ ├── nodemanager.properties_12c │ │ ├── nodemanager_smf.xml │ │ ├── nodemanager_solaris │ │ └── systemd ├── test.md └── test │ └── integration │ ├── data_bags │ └── fmw_domains │ │ └── DEV_WLS1.json │ ├── wls1036 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_infra │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_win │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1221 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ └── wls1221_jrf │ └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── fmw_inst ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── Vagrantfile.rb ├── attributes │ └── default.rb ├── chefignore ├── definitions │ └── fmw_install.rb ├── libraries │ └── matchers.rb ├── metadata.rb ├── providers │ ├── fmw_extract.rb │ ├── fmw_extract_windows.rb │ ├── fmw_install_linux.rb │ ├── fmw_install_solaris.rb │ └── fmw_install_windows.rb ├── recipes │ ├── default.rb │ ├── jrf.rb │ ├── mft.rb │ ├── oim.rb │ ├── service_bus.rb │ ├── soa_suite.rb │ └── webcenter.rb ├── resources │ ├── fmw_extract.rb │ ├── fmw_extract_windows.rb │ ├── fmw_install_linux.rb │ ├── fmw_install_solaris.rb │ └── fmw_install_windows.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── default_spec.rb │ │ ├── mft_spec.rb │ │ ├── oim_spec.rb │ │ ├── service_bus_spec.rb │ │ ├── soa_suite_spec.rb │ │ └── webcenter_spec.rb ├── templates │ └── default │ │ ├── fmw_11g.rsp │ │ └── fmw_12c.rsp ├── test.md └── test │ └── integration │ ├── wls1036 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1036_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1036_win │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_win │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ └── wls1221 │ └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── fmw_jdk ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── chefignore ├── files │ └── default │ │ └── solaris_admin.rsp ├── libraries │ └── matchers.rb ├── metadata.rb ├── providers │ ├── jdk_linux.rb │ ├── jdk_linux_rpm.rb │ ├── jdk_solaris.rb │ ├── jdk_solaris_z.rb │ ├── jdk_windows.rb │ ├── rng_service_debian.rb │ ├── rng_service_redhat.rb │ └── rng_service_redhat_7.rb ├── recipes │ ├── default.rb │ ├── install.rb │ └── rng_service.rb ├── resources │ ├── jdk_linux.rb │ ├── jdk_linux_rpm.rb │ ├── jdk_solaris.rb │ ├── jdk_solaris_z.rb │ ├── jdk_windows.rb │ ├── rng_service_debian.rb │ ├── rng_service_redhat.rb │ └── rng_service_redhat_7.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── rng_service_spec.rb ├── test.md └── test │ └── integration │ ├── exe │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── rpm │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ ├── rng_service_spec.rb │ │ └── spec_helper.rb │ ├── rpm_7 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ ├── rng_service_spec.rb │ │ └── spec_helper.rb │ ├── tar │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ ├── rng_service_spec.rb │ │ └── spec_helper.rb │ ├── tar_7 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ ├── rng_service_spec.rb │ │ └── spec_helper.rb │ ├── tar_7_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ └── tar_sol │ └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── fmw_opatch ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── attributes │ └── default.rb ├── chefignore ├── libraries │ └── matchers.rb ├── metadata.rb ├── providers │ ├── fmw_extract.rb │ ├── fmw_extract_windows.rb │ ├── opatch.rb │ └── opatch_windows.rb ├── recipes │ ├── default.rb │ ├── service_bus.rb │ ├── soa_suite.rb │ └── weblogic.rb ├── resources │ ├── fmw_extract.rb │ ├── fmw_extract_windows.rb │ ├── opatch.rb │ └── opatch_windows.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── default_spec.rb │ │ ├── service_bus_spec.rb │ │ └── soa_suite_spec.rb ├── test.md └── test │ └── integration │ ├── wls1036 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1036_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1036_win │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ ├── wls1213_sol │ └── serverspec │ │ ├── default_spec.rb │ │ ├── install_spec.rb │ │ └── spec_helper.rb │ └── wls1213_win │ └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── fmw_rcu ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── attributes │ └── default.rb ├── chefignore ├── files │ └── default │ │ └── checkrcu.py ├── libraries │ └── matchers.rb ├── metadata.rb ├── providers │ ├── repository.rb │ └── repository_windows.rb ├── recipes │ ├── common.rb │ ├── default.rb │ └── soa_suite.rb ├── resources │ ├── repository.rb │ └── repository_windows.rb ├── spec │ ├── spec_helper.rb │ └── unit │ │ └── recipes │ │ ├── default_spec.rb │ │ └── soa_suite_spec.rb ├── test.md └── test │ └── integration │ ├── data_bags │ └── fmw_databases │ │ ├── entry10.json │ │ ├── entry11.json │ │ ├── entry12.json │ │ └── entry13.json │ ├── wls1036 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── soa_suite_spec.rb │ │ └── spec_helper.rb │ ├── wls1036_win │ └── serverspec │ │ ├── default_spec.rb │ │ ├── soa_suite_spec.rb │ │ └── spec_helper.rb │ ├── wls1213 │ └── serverspec │ │ ├── default_spec.rb │ │ ├── soa_suite_spec.rb │ │ └── spec_helper.rb │ └── wls1213_win │ └── serverspec │ ├── default_spec.rb │ ├── soa_suite_spec.rb │ └── spec_helper.rb └── fmw_wls ├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── Gemfile ├── License ├── README.md ├── Rakefile ├── attributes └── default.rb ├── chefignore ├── definitions ├── ora_inst.rb ├── wls_install.rb └── wls_template.rb ├── libraries └── matchers.rb ├── metadata.rb ├── providers ├── wls_linux.rb ├── wls_solaris.rb └── wls_windows.rb ├── recipes ├── default.rb ├── install.rb └── setup.rb ├── resources ├── wls_linux.rb ├── wls_solaris.rb └── wls_windows.rb ├── spec ├── spec_helper.rb └── unit │ └── recipes │ ├── default_spec.rb │ ├── install_spec.rb │ └── setup_spec.rb ├── templates └── default │ ├── oraInst.loc │ ├── wls_11g.rsp │ └── wls_12c.rsp ├── test.md └── test └── integration ├── wls1036 └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1036_win └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1213 └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1213_infra └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1213_infra_win └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1213_sol └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb ├── wls1213_win └── serverspec │ ├── default_spec.rb │ ├── install_spec.rb │ └── spec_helper.rb └── wls1221 └── serverspec ├── default_spec.rb ├── install_spec.rb └── spec_helper.rb /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## chef-samples v0.1.5 (10 July 2018) 4 | - Also supports chef 14 5 | - RCU 11g unzip issue with common & soa_suite recipe 6 | - support for WebLogic/FMW 12.2.1.3 7 | 8 | ## chef-samples v0.1.4 (1 May 2017) 9 | - Support chef 13, use v0.1.3 release for chef 11 10 | - Drop support for chef 11 11 | - allow to name the windows nodemanager 12 | 13 | ## chef-samples v0.1.3 (6 Dec 2016) 14 | 15 | - support for WebLogic/FMW 12.2.1.2 16 | - state_attr fixes in some resources 17 | - fmw_inst fix in version 18 | 19 | ## chef-samples v0.1.2 (12 Jul 2016) 20 | 21 | - Support for WebLogic/FMW 12.2.1.1 22 | 23 | ## chef-samples v0.1.1 (14 Mar 2016) 24 | 25 | - Should also work on chef 11 besides 12 26 | - Recipes will detect if the databags are encrypted or not 27 | 28 | ## chef-samples v0.1.0 (23 Jan 2016) 29 | 30 | - Initial release -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to chef-samples 2 | 3 | *Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.* 4 | 5 | Pull requests can be made under 6 | [The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html) 7 | (OCA). 8 | 9 | For pull requests to be accepted into chef-samples, the bottom of 10 | your commit message must have the following line using your name and 11 | e-mail address as it appears in the OCA Signatories list. 12 | 13 | ``` 14 | Signed-off-by: Your Name 15 | ``` 16 | 17 | This can be automatically added to pull requests by committing with: 18 | 19 | ``` 20 | git commit --signoff 21 | ```` 22 | 23 | Only pull requests from committers that can be verified as having 24 | signed the OCA can be accepted. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Oracle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /fmw_bsu/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | .yardoc -------------------------------------------------------------------------------- /fmw_bsu/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_bsu/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | cookbook 'fmw_wls', path: '../fmw_wls' 8 | end -------------------------------------------------------------------------------- /fmw_bsu/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_bsu/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_bsu/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_bsu/attributes/default.rb: -------------------------------------------------------------------------------- 1 | include_attribute 'fmw_wls' -------------------------------------------------------------------------------- /fmw_bsu/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_bsu/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def install_fmw_bsu_bsu(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_bsu_bsu, :install, message) 4 | end 5 | 6 | def remove_fmw_bsu_bsu(message) 7 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_bsu_bsu, :remove, message) 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /fmw_bsu/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_bsu' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Patch Oracle WebLogic 10.3.6 or 12.1.1' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_bsu", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_bsu::weblogic", 12 | "This will install the 10.3.6 or 12.1.1 WebLogic BSU patch" 13 | 14 | depends 'fmw_wls' 15 | 16 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 17 | supports os 18 | end 19 | 20 | -------------------------------------------------------------------------------- /fmw_bsu/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_bsu 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 10 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 11 | -------------------------------------------------------------------------------- /fmw_bsu/resources/bsu.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_bsu 5 | # Resource:: bsu 6 | # 7 | provides :fmw_bsu_bsu, os: [ 'linux', 'solaris2'] 8 | 9 | # install or remove BSU patch on a WebLogic home 10 | actions :install, :remove 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # BSU patch id 16 | attribute :patch_id, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | # WebLogic Operating system user 20 | attribute :os_user, kind_of: String, required: true 21 | 22 | state_attrs :patch_id, :middleware_home_dir, :os_user 23 | 24 | attr_accessor :exists 25 | -------------------------------------------------------------------------------- /fmw_bsu/resources/bsu_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_bsu 5 | # Resource:: bsu 6 | # 7 | provides :fmw_bsu_bsu, os: 'windows' 8 | 9 | # install or remove BSU patch on a WebLogic home 10 | actions :install, :remove 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # BSU patch id 16 | attribute :patch_id, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | 20 | state_attrs :patch_id, :middleware_home_dir 21 | 22 | attr_accessor :exists 23 | -------------------------------------------------------------------------------- /fmw_bsu/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_bsu/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_bsu 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_bsu::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_bsu/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_bsu 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | set PATH=%PATH%;C:\Ruby\21\bin 49 | C:\Ruby\2_devkit\devkitvars.bat 50 | ruby -v 51 | gem update --system 52 | gem install bundler --no-rdoc --no-ri 53 | -------------------------------------------------------------------------------- /fmw_bsu/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_bsu::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_bsu/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_bsu/test/integration/wls1036_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_bsu::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_bsu/test/integration/wls1036_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_bsu/test/integration/wls1036_win/serverspec/weblogic_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_bsu::weblogic' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_11g.rsp') do 17 | it { should be_file } 18 | end 19 | 20 | describe file('C:/oracle/middleware_1036') do 21 | it { should be_directory } 22 | end 23 | 24 | describe file('C:/oracle/middleware_1036/wlserver_10.3/common/bin/wlst.cmd') do 25 | it { should be_file } 26 | end 27 | 28 | end -------------------------------------------------------------------------------- /fmw_domain/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | 18 | .yardoc -------------------------------------------------------------------------------- /fmw_domain/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_domain/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | cookbook 'fmw_wls', path: '../fmw_wls' 8 | cookbook 'fmw_inst', path: '../fmw_inst' 9 | end -------------------------------------------------------------------------------- /fmw_domain/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_domain/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_domain/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_domain/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_domain/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def execute_fmw_domain_wlst(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_domain_wlst, :execute, message) 4 | end 5 | def configure_fmw_domain_nodemanager_service(message) 6 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_domain_nodemanager_service, :configure, message) 7 | end 8 | def start_fmw_domain_adminserver(message) 9 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_domain_adminserver, :start, message) 10 | end 11 | def stop_fmw_domain_adminserver(message) 12 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_domain_adminserver, :stop, message) 13 | end 14 | def restart_fmw_domain_adminserver(message) 15 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_domain_adminserver, :restart, message) 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /fmw_domain/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_domain' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Create a WebLogic (FMW) Domain with FMW extensions on a Windows, Linux or Solaris host' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_domain", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_domain::domain", 12 | "This will create a basic WebLogic domain" 13 | recipe "fmw_domain::nodemanager", 14 | "Configures the nodemanager, create and starts the nodemanager service" 15 | recipe "fmw_domain::adminserver", 16 | "Starts the AdminServer WebLogic instance by connecting to the nodemanager" 17 | recipe "fmw_domain::extension_jrf", 18 | "Extend the standard domain with JRF/ADF" 19 | recipe "fmw_domain::extension_service_bus", 20 | "Extend the standard domain with Oracle Service Bus" 21 | recipe "fmw_domain::extension_soa_suite", 22 | "Extend the standard domain with Oracle SOA Suite" 23 | recipe "fmw_domain::extension_bam", 24 | "Extend the standard domain with BAM of Oracle SOA Suite" 25 | recipe "fmw_domain::extension_enterprise_scheduler", 26 | "Extend the standard domain with Enterprise Schuduler (ESS) of Oracle SOA Suite 12c" 27 | recipe "fmw_domain::extension_webtier", 28 | "Extend the standard domain with Webtier for OHS 12c" 29 | 30 | depends 'fmw_wls' 31 | depends 'fmw_inst' 32 | 33 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 34 | supports os 35 | end 36 | 37 | -------------------------------------------------------------------------------- /fmw_domain/providers/nodemanager_service_debian.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # nodemanager_service provider for Debian family 8 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'debian' if respond_to?(:provides) 9 | 10 | def whyrun_supported? 11 | true 12 | end 13 | 14 | def load_current_resource 15 | Chef::Log.info('nodemanager_service provider, nodemanager_service_redhat provider load current resource') 16 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_nodemanager_service_debian').new(new_resource.name) 17 | @current_resource.user_home_dir(@new_resource.user_home_dir) 18 | @current_resource.os_user(@new_resource.os_user) 19 | @current_resource 20 | end 21 | 22 | # Configure the nodemanager service on a Debian family host 23 | action :configure do 24 | Chef::Log.info("#{@new_resource} fired the configure action") 25 | converge_by("configure resource #{ @new_resource }") do 26 | 27 | execute "update-rc.d #{new_resource.name}" do 28 | command "update-rc.d #{new_resource.name} defaults" 29 | not_if "ls /etc/rc3.d/*${scriptName} | /bin/grep '#{new_resource.name}'" 30 | end 31 | 32 | service new_resource.name do 33 | action :start 34 | supports status: true, restart: true, reload: true 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /fmw_domain/providers/nodemanager_service_redhat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # nodemanager_service provider for RedHat family 8 | if respond_to?(:provides) 9 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'rhel' do |node| 10 | node['platform_version'] < '7.0' 11 | end 12 | end 13 | 14 | def whyrun_supported? 15 | true 16 | end 17 | 18 | def load_current_resource 19 | Chef::Log.info('nodemanager_service provider, nodemanager_service_redhat provider load current resource') 20 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_nodemanager_service_redhat').new(new_resource.name) 21 | @current_resource.user_home_dir(@new_resource.user_home_dir) 22 | @current_resource.os_user(@new_resource.os_user) 23 | @current_resource 24 | end 25 | 26 | # Configure the nodemanager service on a RedHat family 7 host 27 | action :configure do 28 | Chef::Log.info("#{@new_resource} fired the configure action") 29 | converge_by("configure resource #{ @new_resource }") do 30 | 31 | execute "chkconfig #{new_resource.name}" do 32 | command "chkconfig --add #{new_resource.name}" 33 | not_if "chkconfig | /bin/grep '#{new_resource.name}'" 34 | end 35 | 36 | service new_resource.name do 37 | action :start 38 | supports status: true, restart: true, reload: true 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /fmw_domain/providers/nodemanager_service_redhat_7.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # nodemanager_service provider for RedHat family 7 8 | if respond_to?(:provides) 9 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'rhel' do |node| 10 | node['platform_version'] >= '7.0' 11 | end 12 | end 13 | 14 | def whyrun_supported? 15 | true 16 | end 17 | 18 | def load_current_resource 19 | Chef::Log.info('nodemanager_service provider, nodemanager_service_redhat provider load current resource') 20 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_nodemanager_service_redhat_7').new(new_resource.name) 21 | @current_resource.user_home_dir(@new_resource.user_home_dir) 22 | @current_resource.os_user(@new_resource.os_user) 23 | @current_resource 24 | end 25 | 26 | # Configure the nodemanager service on a RedHat family 7 host 27 | action :configure do 28 | Chef::Log.info("#{@new_resource} fired the configure action") 29 | converge_by("configure resource #{ @new_resource }") do 30 | 31 | execute 'systemctl-daemon-reload' do 32 | command '/bin/systemctl --system daemon-reload' 33 | action :nothing 34 | end 35 | 36 | execute 'systemctl-enable' do 37 | command "/bin/systemctl enable #{new_resource.name}.service" 38 | not_if "/bin/systemctl list-units --type service --all | /bin/grep '#{new_resource.name}.service'" 39 | action :nothing 40 | end 41 | 42 | template "/lib/systemd/system/#{new_resource.name}.service" do 43 | source 'nodemanager/systemd' 44 | mode 0755 45 | variables(script_name: new_resource.name, 46 | user_home_dir: new_resource.user_home_dir, 47 | os_user: new_resource.os_user) 48 | notifies :run, 'execute[systemctl-daemon-reload]', :immediately 49 | notifies :run, 'execute[systemctl-enable]', :immediately 50 | notifies :enable, "service[#{new_resource.name}.service]", :immediately 51 | notifies :restart, "service[#{new_resource.name}.service]", :immediately 52 | end 53 | 54 | service "#{new_resource.name}.service" do 55 | action :start 56 | provider Chef::Provider::Service::Systemd 57 | supports status: true, restart: true, reload: true 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /fmw_domain/providers/nodemanager_service_solaris.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # nodemanager_service provider for Solaris 8 | provides :fmw_domain_nodemanager_service, os: 'solaris2' if respond_to?(:provides) 9 | 10 | def whyrun_supported? 11 | true 12 | end 13 | 14 | def load_current_resource 15 | Chef::Log.info('nodemanager_service provider, nodemanager_service_solaris provider load current resource') 16 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_nodemanager_service_solaris').new(new_resource.name) 17 | @current_resource.bin_dir(@new_resource.bin_dir) 18 | @current_resource.os_user(@new_resource.os_user) 19 | @current_resource.tmp_dir(@new_resource.tmp_dir) 20 | @current_resource.service_name(@new_resource.service_name) 21 | @current_resource 22 | end 23 | 24 | # Configure the nodemanager service on a RedHat family 7 host 25 | action :configure do 26 | Chef::Log.info("#{@new_resource} fired the configure action") 27 | converge_by("configure resource #{ @new_resource }") do 28 | 29 | # add solaris smf script to the right location 30 | template "/etc/#{new_resource.service_name}" do 31 | source 'nodemanager/nodemanager_solaris' 32 | mode 0755 33 | variables(nodemanager_bin_path: new_resource.bin_dir, 34 | os_user: new_resource.os_user) 35 | end 36 | 37 | # add solaris smf template 38 | template "#{new_resource.tmp_dir}/nodemanager_smf.xml" do 39 | source 'nodemanager/nodemanager_smf.xml' 40 | mode 0755 41 | variables(service_name: new_resource.service_name) 42 | end 43 | 44 | execute "svccfg #{new_resource.service_name} import" do 45 | command "svccfg -v import #{new_resource.tmp_dir}/nodemanager_smf.xml" 46 | not_if "svccfg list | grep #{new_resource.service_name}" 47 | end 48 | 49 | service new_resource.name do 50 | action :start 51 | supports restart: true 52 | end 53 | 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /fmw_domain/providers/wlst.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: wlst 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # Adminserver control on a unix host 8 | provides :fmw_domain_wlst, os: [ 'linux', 'solaris2'] if respond_to?(:provides) 9 | 10 | require 'chef/mixin/shell_out' 11 | include Chef::Mixin::ShellOut 12 | 13 | def whyrun_supported? 14 | true 15 | end 16 | 17 | def load_current_resource 18 | Chef::Log.info('wlst provider, wlst provider load current resource') 19 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_wlst').new(new_resource.name) 20 | @current_resource.version(@new_resource.version) 21 | @current_resource.script_file(@new_resource.script_file) 22 | @current_resource.middleware_home_dir(@new_resource.middleware_home_dir) 23 | @current_resource.weblogic_home_dir(@new_resource.weblogic_home_dir) 24 | @current_resource.os_user(@new_resource.os_user) 25 | @current_resource.java_home_dir(@new_resource.java_home_dir) 26 | @current_resource.weblogic_user(@new_resource.weblogic_user) 27 | @current_resource.weblogic_password(@new_resource.weblogic_password) 28 | @current_resource.repository_password(@new_resource.repository_password) 29 | @current_resource.tmp_dir(@new_resource.tmp_dir) 30 | 31 | @current_resource 32 | end 33 | 34 | # execute the WLST script 35 | action :execute do 36 | Chef::Log.info("#{@new_resource} execute the WLST script") 37 | converge_by("Create resource #{ @new_resource }") do 38 | DomainHelper.wlst_execute(@new_resource.version, @new_resource.os_user, @new_resource.script_file, @new_resource.weblogic_home_dir, @new_resource.weblogic_password, @new_resource.repository_password) 39 | new_resource.updated_by_last_action(true) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /fmw_domain/providers/wlst_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Provider:: wlst 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # Adminserver control on a windows host 8 | provides :fmw_domain_wlst, os: 'windows' if respond_to?(:provides) 9 | 10 | require 'chef/mixin/shell_out' 11 | include Chef::Mixin::ShellOut 12 | 13 | def whyrun_supported? 14 | true 15 | end 16 | 17 | def load_current_resource 18 | Chef::Log.info('wlst provider, wlst provider load current resource') 19 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_domain_wlst_windows').new(new_resource.name) 20 | @current_resource.version(@new_resource.version) 21 | @current_resource.script_file(@new_resource.script_file) 22 | @current_resource.middleware_home_dir(@new_resource.middleware_home_dir) 23 | @current_resource.weblogic_home_dir(@new_resource.weblogic_home_dir) 24 | @current_resource.java_home_dir(@new_resource.java_home_dir) 25 | @current_resource.weblogic_user(@new_resource.weblogic_user) 26 | @current_resource.weblogic_password(@new_resource.weblogic_password) 27 | @current_resource.repository_password(@new_resource.repository_password) 28 | @current_resource.tmp_dir(@new_resource.tmp_dir) 29 | @current_resource 30 | end 31 | 32 | # execute the WLST script 33 | action :execute do 34 | Chef::Log.info("#{@new_resource} execute the WLST script") 35 | converge_by("Create resource #{ @new_resource }") do 36 | DomainHelper.wlst_execute_windows(@new_resource.version, @new_resource.script_file, @new_resource.weblogic_home_dir, @new_resource.weblogic_password, @new_resource.repository_password) 37 | new_resource.updated_by_last_action(true) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /fmw_domain/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 8 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 9 | 10 | 11 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 12 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 13 | -------------------------------------------------------------------------------- /fmw_domain/resources/adminserver_linux.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: adminserver 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_adminserver, os: 'linux' 8 | 9 | # Adminserver control on a linux host 10 | actions :start, :stop, :restart 11 | 12 | # Make create the default action 13 | default_action :start 14 | 15 | # full domain dir path 16 | attribute :domain_dir, kind_of: String, required: true 17 | # WebLogic domain name 18 | attribute :domain_name, kind_of: String, required: true 19 | # WebLogic adminserver name 20 | attribute :adminserver_name, kind_of: String, required: true 21 | # weblogic home path 22 | attribute :weblogic_home_dir, kind_of: String, required: true 23 | # operating system user 24 | attribute :os_user, kind_of: String, required: true 25 | # java home path 26 | attribute :java_home_dir, kind_of: String, required: true 27 | # weblogic administration user 28 | attribute :weblogic_user, kind_of: String, required: true 29 | # weblogic password 30 | attribute :weblogic_password, kind_of: String, required: true 31 | # nodemanager listen address 32 | attribute :nodemanager_listen_address, kind_of: String, required: true 33 | # nodemanager port 34 | attribute :nodemanager_port, kind_of: Integer, required: true 35 | 36 | attr_accessor :started 37 | -------------------------------------------------------------------------------- /fmw_domain/resources/adminserver_solaris.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: adminserver 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_adminserver, os: 'solaris2' 8 | 9 | # Adminserver control on a solaris host 10 | actions :start, :stop, :restart 11 | 12 | # Make create the default action 13 | default_action :start 14 | 15 | # full domain dir path 16 | attribute :domain_dir, kind_of: String, required: true 17 | # WebLogic domain name 18 | attribute :domain_name, kind_of: String, required: true 19 | # WebLogic adminserver name 20 | attribute :adminserver_name, kind_of: String, required: true 21 | # weblogic home path 22 | attribute :weblogic_home_dir, kind_of: String, required: true 23 | # operating system user 24 | attribute :os_user, kind_of: String, required: true 25 | # java home path 26 | attribute :java_home_dir, kind_of: String, required: true 27 | # weblogic administration user 28 | attribute :weblogic_user, kind_of: String, required: true 29 | # weblogic password 30 | attribute :weblogic_password, kind_of: String, required: true 31 | # nodemanager listen address 32 | attribute :nodemanager_listen_address, kind_of: String, required: true 33 | # nodemanager port 34 | attribute :nodemanager_port, kind_of: Integer, required: true 35 | 36 | attr_accessor :started 37 | -------------------------------------------------------------------------------- /fmw_domain/resources/adminserver_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: adminserver 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_adminserver, os: 'windows' 8 | 9 | # Adminserver control on a windows host 10 | actions :start, :stop, :restart 11 | 12 | # Make create the default action 13 | default_action :start 14 | 15 | # full domain dir path 16 | attribute :domain_dir, kind_of: String, required: true 17 | # WebLogic domain name 18 | attribute :domain_name, kind_of: String, required: true 19 | # WebLogic adminserver name 20 | attribute :adminserver_name, kind_of: String, required: true 21 | # weblogic home path 22 | attribute :weblogic_home_dir, kind_of: String, required: true 23 | # java home path 24 | attribute :java_home_dir, kind_of: String, required: true 25 | # weblogic administration user 26 | attribute :weblogic_user, kind_of: String, required: true 27 | # weblogic password 28 | attribute :weblogic_password, kind_of: String, required: true 29 | # nodemanager listen address 30 | attribute :nodemanager_listen_address, kind_of: String, required: true 31 | # nodemanager port 32 | attribute :nodemanager_port, kind_of: Integer, required: true 33 | 34 | attr_accessor :started 35 | -------------------------------------------------------------------------------- /fmw_domain/resources/nodemanager_service_debian.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'debian' 8 | 9 | # Configure the nodemanager service on a Debian family host 10 | actions :configure 11 | 12 | # Make create the default action 13 | default_action :configure 14 | 15 | # user home folder, this is the folder where all the user homes are 16 | attribute :user_home_dir, kind_of: String, required: true 17 | # operating system user 18 | attribute :os_user, kind_of: String, required: true 19 | -------------------------------------------------------------------------------- /fmw_domain/resources/nodemanager_service_redhat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'rhel' do |node| 8 | node['platform_version'] < '7.0' 9 | end 10 | 11 | # Configure the nodemanager service on a RedHat family host 12 | actions :configure 13 | 14 | # Make create the default action 15 | default_action :configure 16 | 17 | # user home folder, this is the folder where all the user homes are 18 | attribute :user_home_dir, kind_of: String, required: true 19 | # operating system user 20 | attribute :os_user, kind_of: String, required: true 21 | -------------------------------------------------------------------------------- /fmw_domain/resources/nodemanager_service_redhat_7.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_nodemanager_service, os: 'linux', platform_family: 'rhel' do |node| 8 | node['platform_version'] >= '7.0' 9 | end 10 | 11 | # Configure the nodemanager service on a RedHat family 7 host 12 | actions :configure 13 | 14 | # Make create the default action 15 | default_action :configure 16 | 17 | # user home folder, this is the folder where all the user homes are 18 | attribute :user_home_dir, kind_of: String, required: true 19 | # operating system user 20 | attribute :os_user, kind_of: String, required: true 21 | -------------------------------------------------------------------------------- /fmw_domain/resources/nodemanager_service_solaris.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_nodemanager_service, os: 'solaris2' 8 | 9 | # Configure the nodemanager service on Solaris 10 | actions :configure 11 | 12 | # Make create the default action 13 | default_action :configure 14 | 15 | # webLogic bin dir path 16 | attribute :bin_dir, kind_of: String, required: true 17 | # operating system user 18 | attribute :os_user, kind_of: String, required: true 19 | # tmp folder 20 | attribute :tmp_dir, kind_of: String, required: true 21 | # service_name to make this unique 22 | attribute :service_name, kind_of: String, required: true 23 | -------------------------------------------------------------------------------- /fmw_domain/resources/nodemanager_service_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: nodemanager_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_nodemanager_service, os: 'windows' 8 | 9 | # Configure the nodemanager service on Windows 10 | actions :configure 11 | 12 | # Make create the default action 13 | default_action :configure 14 | 15 | # middleware home path 16 | attribute :middleware_home_dir, kind_of: String, required: true 17 | # full domain dir path 18 | attribute :domain_dir, kind_of: String, required: true 19 | # domain name 20 | attribute :domain_name, kind_of: String, required: true 21 | # webLogic version 22 | attribute :version, kind_of: String, required: true 23 | # webLogic bin dir path 24 | attribute :bin_dir, kind_of: String, required: true 25 | # java home path 26 | attribute :java_home_dir, kind_of: String, required: true 27 | # prod name for product re-branding 28 | attribute :prod_name, kind_of: String, required: false, default: nil 29 | # service description for product re-branding 30 | attribute :service_description, kind_of: String, required: false, default: nil 31 | -------------------------------------------------------------------------------- /fmw_domain/resources/wlst.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: wlst 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_wlst, os: [ 'linux', 'solaris2'] 8 | 9 | # WLST action on a unix host 10 | actions :execute 11 | 12 | # Make create the default action 13 | default_action :execute 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # script file 18 | attribute :script_file, kind_of: String, required: true 19 | # middleware home path 20 | attribute :middleware_home_dir, kind_of: String, required: true 21 | # weblogic home path 22 | attribute :weblogic_home_dir, kind_of: String, required: true 23 | # operating system user 24 | attribute :os_user, kind_of: String, required: true 25 | # java home path 26 | attribute :java_home_dir, kind_of: String, required: true 27 | # weblogic administration user 28 | attribute :weblogic_user, kind_of: [String, NilClass], default: nil 29 | # weblogic password 30 | attribute :weblogic_password, kind_of: [String, NilClass], default: 'xxx' 31 | # repository password 32 | attribute :repository_password, kind_of: [String, NilClass], default: 'xxx' 33 | # temp directory 34 | attribute :tmp_dir, kind_of: String, required: true 35 | -------------------------------------------------------------------------------- /fmw_domain/resources/wlst_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Resource:: wlst 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_domain_wlst, os: 'windows' 8 | 9 | # WLST action on a windows host 10 | actions :execute 11 | 12 | # Make create the default action 13 | default_action :execute 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # script file 18 | attribute :script_file, kind_of: String, required: true 19 | # middleware home path 20 | attribute :middleware_home_dir, kind_of: String, required: true 21 | # weblogic home path 22 | attribute :weblogic_home_dir, kind_of: String, required: true 23 | # java home path 24 | attribute :java_home_dir, kind_of: String, required: true 25 | # weblogic administration user 26 | attribute :weblogic_user, kind_of: [String, NilClass], default: nil 27 | # weblogic password 28 | attribute :weblogic_password, kind_of: [String, NilClass], default: 'xxx' 29 | # repository password 30 | attribute :repository_password, kind_of: [String, NilClass], default: 'xxx' 31 | # temp directory 32 | attribute :tmp_dir, kind_of: String, required: true 33 | -------------------------------------------------------------------------------- /fmw_domain/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_domain/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_domain::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/domain/extensions/jrf.py: -------------------------------------------------------------------------------- 1 | execfile('<%= @tmp_dir %>/common.py') 2 | 3 | # weblogic node params 4 | WLHOME = '<%= @weblogic_home_dir %>' 5 | JAVA_HOME = '<%= @java_home_dir %>' 6 | WEBLOGIC_VERSION = '<%= @version %>' 7 | 8 | # domain params 9 | DOMAIN_PATH = '<%= @domain_dir %>' 10 | DOMAIN = '<%= @domain_name %>' 11 | APP_PATH = '<%= @app_dir %>' 12 | 13 | # adminserver params 14 | ADMIN_SERVER_NAME = '<%= @adminserver_name %>' 15 | 16 | # templates 17 | WLS_EM_TEMPLATE = '<%= @wls_em_template %>' 18 | WLS_JRF_TEMPLATE = '<%= @wls_jrf_template %>' 19 | 20 | RESTRICTED = '<%= @restricted %>' 21 | 22 | # repository 23 | REPOS_DBURL = '<%= @repository_database_url %>' 24 | REPOS_DBUSER_PREFIX = '<%= @repository_prefix %>' 25 | REPOS_DBPASSWORD = sys.argv[2] 26 | 27 | readDomain(DOMAIN_PATH) 28 | 29 | cd('/') 30 | setOption( "AppDir", APP_PATH ) 31 | 32 | addTemplate(WLS_JRF_TEMPLATE) 33 | 34 | print 'Adding EM Template' 35 | addTemplate(WLS_EM_TEMPLATE) 36 | dumpStack() 37 | 38 | if WEBLOGIC_VERSION != '10.3.6': 39 | 40 | if RESTRICTED == 'false': 41 | print 'Change datasource LocalScvTblDataSource for service table' 42 | changeDatasource('LocalSvcTblDataSource', REPOS_DBUSER_PREFIX+'_STB', REPOS_DBPASSWORD, REPOS_DBURL) 43 | print 'Call getDatabaseDefaults which reads the service table' 44 | getDatabaseDefaults() 45 | print 'end datasources' 46 | 47 | print 'Add server group JRF-MAN-SVR to AdminServer' 48 | serverGroup = ["JRF-MAN-SVR"] 49 | setServerGroups(ADMIN_SERVER_NAME, serverGroup) 50 | print 'end server groups' 51 | 52 | updateDomain() 53 | dumpStack() 54 | 55 | closeDomain() 56 | 57 | print('Exiting...') 58 | exit() 59 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/domain/extensions/webtier.py: -------------------------------------------------------------------------------- 1 | execfile('<%= @tmp_dir %>/common.py') 2 | 3 | # weblogic node params 4 | WLHOME = '<%= @weblogic_home_dir %>' 5 | JAVA_HOME = '<%= @java_home_dir %>' 6 | WEBLOGIC_VERSION = '<%= @version %>' 7 | 8 | # domain params 9 | DOMAIN_PATH = '<%= @domain_dir %>' 10 | DOMAIN = '<%= @domain_name %>' 11 | APP_PATH = '<%= @app_dir %>' 12 | 13 | # adminserver params 14 | ADMIN_SERVER_NAME = '<%= @adminserver_name %>' 15 | 16 | # templates 17 | WLS_EM_TEMPLATE = '<%= @wls_em_template %>' 18 | WLS_WEBTIER_TEMPLATE = '<%= @wls_webtier_template %>' 19 | 20 | RESTRICTED = '<%= @restricted %>' 21 | 22 | # repository 23 | REPOS_DBURL = '<%= @repository_database_url %>' 24 | REPOS_DBUSER_PREFIX = '<%= @repository_prefix %>' 25 | REPOS_DBPASSWORD = sys.argv[2] 26 | 27 | readDomain(DOMAIN_PATH) 28 | 29 | cd('/') 30 | setOption( "AppDir", APP_PATH ) 31 | 32 | print 'Adding EM Template' 33 | addTemplate(WLS_EM_TEMPLATE) 34 | dumpStack() 35 | 36 | print 'Adding OHS Template' 37 | addTemplate(WLS_WEBTIER_TEMPLATE) 38 | dumpStack() 39 | 40 | if RESTRICTED == 'false': 41 | print 'Change datasource LocalScvTblDataSource for service table' 42 | changeDatasource('LocalSvcTblDataSource', REPOS_DBUSER_PREFIX+'_STB', REPOS_DBPASSWORD, REPOS_DBURL) 43 | print 'Call getDatabaseDefaults which reads the service table' 44 | getDatabaseDefaults() 45 | print 'end datasources' 46 | 47 | print 'Add server group JRF-MAN-SVR to AdminServer' 48 | serverGroup = ["JRF-MAN-SVR"] 49 | setServerGroups(ADMIN_SERVER_NAME, serverGroup) 50 | print 'end server groups' 51 | 52 | updateDomain() 53 | dumpStack() 54 | 55 | closeDomain() 56 | 57 | print('Exiting...') 58 | exit() 59 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/nodemanager/nodemanager.properties_11g: -------------------------------------------------------------------------------- 1 | DomainsFile=<%= @weblogic_home_dir %>/common/nodemanager/nodemanager.domains 2 | NodeManagerHome=<%= @weblogic_home_dir %>/common/nodemanager 3 | JavaHome=<%= @java_home_dir %> 4 | ListenPort=<%= @nodemanager_port %> 5 | LogFile=<%= @nodemanager_log_dir %> 6 | LogLimit=0 7 | PropertiesVersion=10.3 8 | DomainsDirRemoteSharingEnabled=false 9 | AuthenticationEnabled=true 10 | LogLevel=INFO 11 | DomainsFileEnabled=true 12 | <% if @platform_family == "windows" %> 13 | StartScriptName=startWebLogic.cmd 14 | <% else %> 15 | StartScriptName=startWebLogic.sh 16 | <% end %> 17 | ListenAddress=<%= @nodemanager_address %> 18 | NativeVersionEnabled=true 19 | LogToStderr=true 20 | SecureListener=<%= @nodemanager_secure_listener %> 21 | LogCount=1 22 | DomainRegistrationEnabled=false 23 | StopScriptEnabled=true 24 | QuitEnabled=false 25 | LogAppend=true 26 | StateCheckInterval=500 27 | CrashRecoveryEnabled=true 28 | StartScriptEnabled=true 29 | LogFormatter=weblogic.nodemanager.server.LogFormatter 30 | ListenBacklog=50 31 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/nodemanager/nodemanager.properties_12c: -------------------------------------------------------------------------------- 1 | #Node manager properties 2 | DomainsFile=<%= @domain_dir %>/nodemanager/nodemanager.domains 3 | LogLimit=0 4 | PropertiesVersion=<%= @version %> 5 | AuthenticationEnabled=true 6 | NodeManagerHome=<%= @domain_dir %>/nodemanager 7 | JavaHome=<%= @java_home_dir %> 8 | LogLevel=INFO 9 | DomainsFileEnabled=true 10 | <% if @platform_family == "windows" %> 11 | StartScriptName=startWebLogic.cmd 12 | <% else %> 13 | StartScriptName=startWebLogic.sh 14 | <% end %> 15 | ListenAddress=<%= @nodemanager_address %> 16 | NativeVersionEnabled=true 17 | ListenPort=<%= @nodemanager_port %> 18 | LogToStderr=true 19 | SecureListener=<%= @nodemanager_secure_listener %> 20 | LogCount=1 21 | StopScriptEnabled=true 22 | QuitEnabled=false 23 | LogAppend=true 24 | StateCheckInterval=500 25 | CrashRecoveryEnabled=true 26 | StartScriptEnabled=true 27 | LogFile=<%= @nodemanager_log_dir %> 28 | LogFormatter=weblogic.nodemanager.server.LogFormatter 29 | ListenBacklog=50 30 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/nodemanager/nodemanager_smf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/nodemanager/nodemanager_solaris: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | NODEMANAGER_HOME=<%= @nodemanager_bin_path %> 4 | USER=<%= @os_user %> 5 | 6 | export NODEMANAGER_HOME 7 | export USER 8 |   9 | case "$1" in 10 | 'start') 11 | # start nodemanager 12 | su $USER -c "$NODEMANAGER_HOME/startNodeManager.sh &" 13 | ;; 14 | 'stop') 15 | # stop nodemanager 16 | su $USER -c "$NODEMANAGER_HOME/stopNodeManager.sh" 17 | ;; 18 | 'restart') 19 | su $USER -c "$NODEMANAGER_HOME/stopNodeManager.sh" 20 | su $USER -c "$NODEMANAGER_HOME/startNodeManager.sh &" 21 | ;; 22 | esac 23 | -------------------------------------------------------------------------------- /fmw_domain/templates/default/nodemanager/systemd: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=WebLogic <%= @script_name %> service 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=<%= @user_home_dir %>/<%= @os_user %>/<%= @script_name %> start 8 | ExecStop=<%= @user_home_dir %>/<%= @os_user %>/<%= @script_name %> stop 9 | TimeoutSec=30 10 | KillMode=process 11 | RemainAfterExit=yes 12 | 13 | [Install] 14 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /fmw_domain/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/vagrant_chef_puppet_linux7.0/chef/node_win_1221_all.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_domain 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/data_bags/fmw_domains/DEV_WLS1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "DEV_WLS1", 3 | "domain_name": "base", 4 | "weblogic_user": "weblogic", 5 | "weblogic_password": "Welcome01", 6 | "adminserver_name": "AdminServer", 7 | "adminserver_listen_address": "10.10.10.135", 8 | "adminserver_listen_port": "7001" 9 | } 10 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_infra/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_infra/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_domain::domain' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('C:/java/jdk1.8.0_131') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('C:/java/jdk1.8.0_131/bin/java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=WebLogic Server' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | describe file('C:/oracle/middleware_1213/user_projects/domains/base') do 34 | it { should be_directory } 35 | end 36 | 37 | describe service('Oracle Weblogic base NodeManager (c_oracle_MIDDLE~1_wlserver)') do 38 | it { should be_enabled } 39 | it { should be_running } 40 | end 41 | 42 | describe port(5556) do 43 | it { should be_listening } 44 | end 45 | 46 | describe port(7001) do 47 | it { should be_listening } 48 | end 49 | 50 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1213_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1221/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1221/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1221_jrf/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_domain/test/integration/wls1221_jrf/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_inst/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | 18 | .yardoc/* -------------------------------------------------------------------------------- /fmw_inst/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_inst/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | cookbook 'fmw_wls', path: '../fmw_wls' 8 | end 9 | -------------------------------------------------------------------------------- /fmw_inst/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | gem 'winrm-transport' 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_inst/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_inst/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_inst/Vagrantfile.rb: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.boot_timeout=10000 3 | end 4 | -------------------------------------------------------------------------------- /fmw_inst/attributes/default.rb: -------------------------------------------------------------------------------- 1 | include_attribute 'fmw_wls' 2 | -------------------------------------------------------------------------------- /fmw_inst/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_inst/definitions/fmw_install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_inst 3 | # Definition:: fmw_install 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | define :fmw_install, :unix => true, :installer_file => nil, :rsp_file => nil, :java_home_dir => nil, :tmp_dir => nil, :version => nil, :os_group => nil, :os_user => nil, :orainst_dir => nil do 8 | 9 | if params[:unix] 10 | if ['solaris2'].include?(node['os']) 11 | java_params = '-d64' 12 | else 13 | java_params = '' 14 | end 15 | 16 | if ['10.3.6', '12.1.1'].include?(params[:version]) 17 | execute "Install #{params[:name]}" do 18 | command "#{params[:installer_file]} -silent -response #{params[:rsp_file]} -waitforcompletion -invPtrLoc #{params[:orainst_dir]}/oraInst.loc -ignoreSysPrereqs -jreLoc #{params[:java_home_dir]} -Djava.io.tmpdir=#{params[:tmp_dir]}" 19 | user params[:os_user] 20 | group params[:os_group] 21 | cwd params[:tmp_dir] 22 | end 23 | elsif ['12.2.1', '12.2.1.1', '12.2.1.2', '12.2.1.3', '12.1.3', '12.1.2'].include?(params[:version]) 24 | execute "Install #{params[:name]}" do 25 | command "#{params[:java_home_dir]}/bin/java #{java_params} -Xmx1024m -Djava.io.tmpdir=#{params[:tmp_dir]} -jar #{params[:installer_file]} -waitforcompletion -silent -responseFile #{params[:rsp_file]} -invPtrLoc #{params[:orainst_dir]}/oraInst.loc -jreLoc #{params[:java_home_dir]}" 26 | user params[:os_user] 27 | group params[:os_group] 28 | cwd params[:tmp_dir] 29 | end 30 | end 31 | else 32 | if ['10.3.6', '12.1.1'].include?(params[:version]) 33 | execute "Install #{params[:name]}" do 34 | command "#{params[:installer_file]} -silent -response #{params[:rsp_file]} -waitforcompletion -jreLoc #{params[:java_home_dir]} -ignoreSysPrereqs -Djava.io.tmpdir=#{params[:tmp_dir]}" 35 | cwd params[:tmp_dir] 36 | end 37 | elsif ['12.2.1', '12.2.1.1', '12.2.1.2', '12.2.1.3', '12.1.3', '12.1.2'].include?(params[:version]) 38 | execute "Install #{params[:name]}" do 39 | command "#{params[:java_home_dir]}\\bin\\java.exe -Xmx1024m -Djava.io.tmpdir=#{params[:tmp_dir]} -jar #{params[:installer_file]} -waitforcompletion -silent -responseFile #{params[:rsp_file]} -jreLoc #{params[:java_home_dir]}" 40 | cwd params[:tmp_dir] 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /fmw_inst/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def extract_fmw_inst_fmw_extract(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_inst_fmw_extract, :extract, message) 4 | end 5 | 6 | def install_fmw_inst_fmw_install(message) 7 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_inst_fmw_install, :install, message) 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /fmw_inst/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_inst' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Installs FMW Software on a WebLogic middleware environmment' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_inst", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_inst::jrf", 12 | "This will install 11g ADF/JRF on a Middleware home" 13 | recipe "fmw_inst::mft", 14 | "This will install MFT (Managed File Transfer) on a Middleware home" 15 | recipe "fmw_inst::service_bus", 16 | "This will install the Service Bus on a Middleware home" 17 | recipe "fmw_inst::soa_suite", 18 | "This will install the SOA Suite on a Middleware home" 19 | recipe "fmw_inst::webcenter", 20 | "This will install the Webcenter on a Middleware home" 21 | recipe "fmw_inst::oim", 22 | "This will install the Oracle Identity/Accesss Manager on a Middleware home" 23 | 24 | depends 'fmw_wls' 25 | 26 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 27 | supports os 28 | end 29 | -------------------------------------------------------------------------------- /fmw_inst/providers/fmw_install_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_inst 3 | # Provider:: fmw_install 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # fmw_install provider for windows 8 | provides :fmw_inst_fmw_install, os: 'windows' if respond_to?(:provides) 9 | 10 | def whyrun_supported? 11 | true 12 | end 13 | 14 | def load_current_resource 15 | Chef::Log.info('fmw install provider, fmw_install_windows load current resource') 16 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_inst_fmw_install_windows').new(new_resource.name) 17 | @current_resource.java_home_dir(@new_resource.java_home_dir) 18 | @current_resource.installer_file(@new_resource.installer_file) 19 | @current_resource.rsp_file(@new_resource.rsp_file) 20 | @current_resource.version(@new_resource.version) 21 | @current_resource.oracle_home_dir(@new_resource.oracle_home_dir) 22 | @current_resource.tmp_dir(@new_resource.tmp_dir) 23 | 24 | @current_resource.exists = true if ::File.exist?(@new_resource.oracle_home_dir) 25 | @current_resource 26 | end 27 | 28 | # Installs FMW software on a Windows host 29 | action :install do 30 | Chef::Log.info("#{@new_resource} fired the create action") 31 | if @current_resource.exists 32 | Chef::Log.info("#{@new_resource} already exists") 33 | else 34 | Chef::Log.info("#{@new_resource} doesn't exist, so lets install FMW") 35 | converge_by("Create resource #{ @new_resource }") do 36 | 37 | name = @new_resource.name 38 | version = @new_resource.version 39 | tmp_dir = @new_resource.tmp_dir 40 | java_home_dir = @new_resource.java_home_dir 41 | installer_file = @new_resource.installer_file 42 | rsp_file = @new_resource.rsp_file 43 | 44 | fmw_install name do 45 | unix false 46 | installer_file installer_file 47 | rsp_file rsp_file 48 | java_home_dir java_home_dir 49 | tmp_dir tmp_dir 50 | version version 51 | end 52 | 53 | new_resource.updated_by_last_action(true) 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /fmw_inst/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_inst 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | 10 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 11 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 12 | -------------------------------------------------------------------------------- /fmw_inst/resources/fmw_extract.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_inst 5 | # Resource:: fmw_extract 6 | # 7 | provides :fmw_inst_fmw_extract, os: [ 'linux', 'solaris2'] 8 | 9 | # extracts FMW 11g,12c software 10 | actions :extract 11 | 12 | # Make create the default action 13 | default_action :extract 14 | 15 | # FMW source file 16 | attribute :source_file, kind_of: String, required: true 17 | # FMW source file 2 18 | attribute :source_2_file, kind_of: String, required: false 19 | # FMW source file 3 20 | attribute :source_3_file, kind_of: String, required: false 21 | # WebLogic Operating system user 22 | attribute :os_user, kind_of: String, required: true 23 | # WebLogic Operating system group 24 | attribute :os_group, kind_of: String, required: true 25 | # tmp folder 26 | attribute :tmp_dir, kind_of: String, required: true 27 | 28 | state_attrs :source_file, :source_2_file, :source_3_file, :os_user, :os_group, :tmp_dir 29 | 30 | attr_accessor :exists 31 | -------------------------------------------------------------------------------- /fmw_inst/resources/fmw_extract_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_inst 5 | # Resource:: fmw_extract 6 | # 7 | provides :fmw_inst_fmw_extract, os: 'windows' 8 | 9 | # extracts FMW 11g,12c software 10 | actions :extract 11 | 12 | # Make create the default action 13 | default_action :extract 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # middleware home path 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | # FMW source file 20 | attribute :source_file, kind_of: String, required: true 21 | # FMW source file 2 22 | attribute :source_2_file, kind_of: String, required: false 23 | # FMW source file 3 24 | attribute :source_3_file, kind_of: String, required: false 25 | # tmp folder 26 | attribute :tmp_dir, kind_of: String, required: true 27 | 28 | state_attrs :source_file, :source_2_file, :source_3_file, :tmp_dir 29 | 30 | attr_accessor :exists 31 | -------------------------------------------------------------------------------- /fmw_inst/resources/fmw_install_linux.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_inst 5 | # Resource:: fmw_install 6 | # 7 | provides :fmw_inst_fmw_install, os: 'linux' 8 | 9 | # Installs FMW 11g,12c software on a Linux host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Oracle home folder 18 | attribute :oracle_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Linux (extracted) FMW installer file 22 | attribute :installer_file, kind_of: String, required: true 23 | # FMW response file 24 | attribute :rsp_file, kind_of: String, required: true 25 | # WebLogic Operating system user 26 | attribute :os_user, kind_of: String, required: true 27 | # WebLogic Operating system group 28 | attribute :os_group, kind_of: String, required: true 29 | # Parent folder of the OraInst.loc 30 | attribute :orainst_dir, kind_of: String, required: true 31 | # tmp folder 32 | attribute :tmp_dir, kind_of: String, required: true 33 | 34 | state_attrs :java_home_dir, :oracle_home_dir, :version, :os_user, :os_group, :orainst_dir, :tmp_dir, :rsp_file 35 | 36 | attr_accessor :exists 37 | -------------------------------------------------------------------------------- /fmw_inst/resources/fmw_install_solaris.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_inst 5 | # Resource:: fmw_install 6 | # 7 | provides :fmw_inst_fmw_install, os: 'solaris2' 8 | 9 | # Installs FMW 11g,12c software on a Solaris host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Oracle home folder 18 | attribute :oracle_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Solaris (extracted) FMW installer file 22 | attribute :installer_file, kind_of: String, required: true 23 | # FMW response file 24 | attribute :rsp_file, kind_of: String, required: true 25 | # WebLogic Operating system user 26 | attribute :os_user, kind_of: String, required: true 27 | # WebLogic Operating system group 28 | attribute :os_group, kind_of: String, required: true 29 | # Parent folder of the OraInst.loc 30 | attribute :orainst_dir, kind_of: String, required: true 31 | # tmp folder 32 | attribute :tmp_dir, kind_of: String, required: true 33 | 34 | state_attrs :java_home_dir, :oracle_home_dir, :version, :os_user, :os_group, :orainst_dir, :tmp_dir, :rsp_file 35 | 36 | attr_accessor :exists 37 | -------------------------------------------------------------------------------- /fmw_inst/resources/fmw_install_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_inst 5 | # Resource:: fmw_install 6 | # 7 | provides :fmw_inst_fmw_install, os: 'windows' 8 | 9 | # Installs FMW 11g,12c software on a windows host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Oracle home folder 18 | attribute :oracle_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Windows (extracted) FMW installer file 22 | attribute :installer_file, kind_of: String, required: true 23 | # FMW response file 24 | attribute :rsp_file, kind_of: String, required: true 25 | # tmp folder 26 | attribute :tmp_dir, kind_of: String, required: true 27 | 28 | state_attrs :java_home_dir, :oracle_home_dir, :version, :tmp_dir, :rsp_file 29 | 30 | attr_accessor :exists 31 | -------------------------------------------------------------------------------- /fmw_inst/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_inst/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_inst 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_inst::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::SoloRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_inst/templates/default/fmw_11g.rsp: -------------------------------------------------------------------------------- 1 | [ENGINE] 2 | Response File Version=1.0.0.0.0 3 | [GENERIC] 4 | SPECIFY_DOWNLOAD_LOCATION=false 5 | SKIP_SOFTWARE_UPDATES=true 6 | SOFTWARE_UPDATES_DOWNLOAD_LOCATION= 7 | ORACLE_HOME=<%= @oracle_home %> 8 | MIDDLEWARE_HOME=<%= @middleware_home_dir %> 9 | <% @option_array.each do |value| -%> 10 | <% unless value.empty? -%> 11 | <%= value %> 12 | <% end %> 13 | <% end %> 14 | [SYSTEM] 15 | [APPLICATIONS] 16 | [RELATIONSHIPS] 17 | -------------------------------------------------------------------------------- /fmw_inst/templates/default/fmw_12c.rsp: -------------------------------------------------------------------------------- 1 | [ENGINE] 2 | #DO NOT CHANGE THIS. 3 | Response File Version=1.0.0.0.0 4 | 5 | [GENERIC] 6 | #The oracle home location. This can be an existing Oracle Home or a new Oracle Home 7 | ORACLE_HOME=<%= @middleware_home_dir %> 8 | 9 | #Set this variable value to the Installation Type selected. e.g. SOA Suite, BPM. 10 | INSTALL_TYPE=<%= @install_type %> 11 | -------------------------------------------------------------------------------- /fmw_inst/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_inst 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_11g.rsp') do 17 | it { should be_file } 18 | end 19 | 20 | describe file('C:\\Program Files\\Oracle\\Inventory') do 21 | it { should be_directory } 22 | end 23 | 24 | describe file('C:/oracle/middleware_1036') do 25 | it { should be_directory } 26 | end 27 | 28 | describe file('C:/oracle/middleware_1036/wlserver_10.3/common/bin/wlst.cmd') do 29 | it { should be_file } 30 | end 31 | 32 | describe file('C:/oracle/middleware_1036/Oracle_OSB1') do 33 | it { should be_directory } 34 | end 35 | 36 | describe file('C:/oracle/middleware_1036/Oracle_SOA1') do 37 | it { should be_directory } 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1036_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=Fusion Middleware Infrastructure' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | describe file('C:/oracle/middleware_1213/oracle_common/bin/rcu.bat') do 34 | it { should be_file } 35 | end 36 | 37 | describe file('C:/oracle/middleware_1213/soa/bin') do 38 | it { should be_directory } 39 | end 40 | 41 | describe file('C:/oracle/middleware_1213/osb/bin') do 42 | it { should be_directory } 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1213_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1221/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_inst/test/integration/wls1221/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | 18 | .yardoc/* -------------------------------------------------------------------------------- /fmw_jdk/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_jdk/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | -------------------------------------------------------------------------------- /fmw_jdk/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_jdk/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_jdk/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_jdk/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_jdk/files/default/solaris_admin.rsp: -------------------------------------------------------------------------------- 1 | mail= 2 | instance=overwrite 3 | partial=nocheck 4 | runlevel=nocheck 5 | idepend=nocheck 6 | rdepend=nocheck 7 | space=nocheck 8 | setuid=nocheck 9 | conflict=nocheck 10 | action=nocheck 11 | basedir=default -------------------------------------------------------------------------------- /fmw_jdk/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def install_fmw_jdk_jdk(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_jdk_jdk, :install, message) 4 | end 5 | 6 | def configure_fmw_jdk_rng_service(message) 7 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_jdk_rng_service, :configure, message) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /fmw_jdk/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_jdk' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Installs Oracle JDK 7,8 on any Windows, Linux or Solaris host' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_jdk", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_jdk::install", 12 | "This will install the JDK on a host" 13 | recipe "fmw_jdk::rng_service", 14 | "This will install and configure the rng package on any RedHat or Debian family linux distribution" 15 | 16 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 17 | supports os 18 | end -------------------------------------------------------------------------------- /fmw_jdk/providers/jdk_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Provider:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # jdk provider for windows 8 | 9 | provides :fmw_jdk_jdk, os: 'windows' if respond_to?(:provides) 10 | 11 | def whyrun_supported? 12 | true 13 | end 14 | 15 | def initialize(*args) 16 | Chef::Log.info('jdk provider, jdk_windows provider initialize') 17 | super 18 | @java_home_dir = nil 19 | @source_file = nil 20 | end 21 | 22 | def load_current_resource 23 | Chef::Log.info('jdk provider, jdk_windows provider load current resource') 24 | @current_resource ||= Chef::ResourceResolver.resolve(:fmw_jdk_jdk_windows).new(new_resource.name) 25 | @current_resource.java_home_dir(@new_resource.java_home_dir) 26 | @current_resource.source_file(@new_resource.source_file) 27 | 28 | Chef::Log.info("#{@new_resource} checking if source_file exists") 29 | 30 | # check status of jdk 31 | @current_resource.exists = true if ::File.exist?(@new_resource.java_home_dir) 32 | 33 | @current_resource 34 | end 35 | 36 | # Installs a JDK executable on a Windows host 37 | action :install do 38 | Chef::Log.info("#{@new_resource} fired the create action") 39 | if @current_resource.exists 40 | Chef::Log.info("#{@new_resource} already exists") 41 | else 42 | Chef::Log.info("#{@new_resource} doesn't exist, so lets install the jdk") 43 | converge_by("Create resource #{ @new_resource }") do 44 | 45 | parent_folder = ::File.expand_path('..', @new_resource.java_home_dir) 46 | java_home_dir_windows = @new_resource.java_home_dir.gsub('/', '\\\\') 47 | 48 | directory parent_folder do 49 | recursive true 50 | action :create 51 | end 52 | 53 | execute 'Install JDK' do 54 | command "#{new_resource.source_file} /s ADDLOCAL=\"ToolsFeature\" INSTALLDIR=#{java_home_dir_windows}" 55 | end 56 | 57 | new_resource.updated_by_last_action(true) 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /fmw_jdk/providers/rng_service_debian.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Provider:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # rng service provider for Debian family 8 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'debian' if respond_to?(:provides) 9 | 10 | def whyrun_supported? 11 | true 12 | end 13 | 14 | def load_current_resource 15 | Chef::Log.info('rng_service provider, rng_service_debian provider load current resource') 16 | @current_resource ||= Chef::ResourceResolver.resolve(:fmw_jdk_rng_service_debian).new(new_resource.name) 17 | @current_resource 18 | end 19 | 20 | # Installs the rng package and the rngd services on a Debian family host 21 | action :configure do 22 | Chef::Log.info("#{@new_resource} fired the configure action") 23 | converge_by("configure resource #{ @new_resource }") do 24 | # service rngd status 25 | service 'rng-tools' do 26 | action :nothing 27 | supports status: true, restart: true, reload: true 28 | end 29 | 30 | # /etc/default/rng-tools 31 | # original EXTRAOPTIONS="" 32 | # changed: EXTRAOPTIONS="-r /dev/urandom -o /dev/random -b" 33 | execute 'sed rng-tools' do 34 | command "sed -i -e's/#HRNGDEVICE=\\/dev\\/null/HRNGDEVICE=\\/dev\\/urandom/g' /etc/default/rng-tools" 35 | not_if "grep '^HRNGDEVICE=/dev/urandom' /etc/default/rng-tools" 36 | notifies :enable, 'service[rng-tools]', :immediately 37 | notifies :restart, 'service[rng-tools]', :immediately 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /fmw_jdk/providers/rng_service_redhat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Provider:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # rng service provider for RedHat family 8 | if respond_to?(:provides) 9 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'rhel' do |node| 10 | node['platform_version'] < '7.0' 11 | end 12 | end 13 | 14 | def whyrun_supported? 15 | true 16 | end 17 | 18 | def load_current_resource 19 | Chef::Log.info('rng_service provider, rng_service_redhat provider load current resource') 20 | @current_resource ||= Chef::ResourceResolver.resolve(:fmw_jdk_rng_service_redhat).new(new_resource.name) 21 | @current_resource 22 | end 23 | 24 | # Installs the rng package and the rngd services on a RedHat family host 25 | action :configure do 26 | Chef::Log.info("#{@new_resource} fired the configure action") 27 | converge_by("configure resource #{ @new_resource }") do 28 | # service rngd status 29 | service 'rngd' do 30 | action :nothing 31 | supports status: true, restart: true, reload: true 32 | end 33 | 34 | # add service for auto start 35 | execute 'chkconfig rngd' do 36 | command 'chkconfig --add rngd' 37 | action :nothing 38 | end 39 | 40 | # /etc/sysconfig/rngd 41 | # original EXTRAOPTIONS="" 42 | # changed: EXTRAOPTIONS="-r /dev/urandom -o /dev/random -b" 43 | execute 'sed rngd.service' do 44 | command "sed -i -e's/EXTRAOPTIONS=\"\"/EXTRAOPTIONS=\"-r \\/dev\\/urandom -o \\/dev\\/random -b\"/g' /etc/sysconfig/rngd" 45 | not_if "grep '^EXTRAOPTIONS=\"-r /dev/urandom -o /dev/random -b\"' /etc/sysconfig/rngd" 46 | notifies :enable, 'service[rngd]', :immediately 47 | notifies :restart, 'service[rngd]', :immediately 48 | notifies :run, 'execute[chkconfig rngd]', :immediately 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /fmw_jdk/providers/rng_service_redhat_7.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Provider:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # rng service provider for RedHat 7 family 8 | if respond_to?(:provides) 9 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'rhel' do |node| 10 | node['platform_version'] >= '7.0' 11 | end 12 | end 13 | 14 | def whyrun_supported? 15 | true 16 | end 17 | 18 | def load_current_resource 19 | Chef::Log.info('rng_service provider, rng_service_redhat_7 provider load current resource') 20 | @current_resource ||= Chef::ResourceResolver.resolve(:fmw_jdk_rng_service_redhat_7).new(new_resource.name) 21 | @current_resource 22 | end 23 | 24 | # Installs the rng package and the rngd services on a RedHat 7 family host 25 | action :configure do 26 | Chef::Log.info("#{@new_resource} fired the configure action") 27 | converge_by("configure resource #{ @new_resource }") do 28 | # reload after a change in /lib/systemd/system/rngd.service 29 | execute 'systemctl-daemon-reload' do 30 | command '/bin/systemctl --system daemon-reload' 31 | action :nothing 32 | end 33 | 34 | # systemctl status rngd.service 35 | service 'rngd' do 36 | action :nothing 37 | provider Chef::Provider::Service::Systemd 38 | supports status: true, restart: true, reload: true 39 | end 40 | 41 | # /lib/systemd/system/rngd.service 42 | # original ExecStart=/sbin/rngd -f 43 | # changed: ExecStart=/sbin/rngd -r /dev/urandom -o /dev/random -f 44 | execute 'sed rngd.service' do 45 | command "sed -i -e's/ExecStart=\\/sbin\\/rngd -f/ExecStart=\\/sbin\\/rngd -r \\/dev\\/urandom -o \\/dev\\/random -f/g' /lib/systemd/system/rngd.service" 46 | not_if "grep 'ExecStart=/sbin/rngd -r /dev/urandom -o /dev/random -f' /lib/systemd/system/rngd.service" 47 | notifies :run, 'execute[systemctl-daemon-reload]', :immediately 48 | notifies :enable, 'service[rngd]', :immediately 49 | notifies :restart, 'service[rngd]', :immediately 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /fmw_jdk/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | 10 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 11 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 12 | -------------------------------------------------------------------------------- /fmw_jdk/recipes/install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Recipe:: install 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | unless ['windows', 'linux', 'solaris2'].include?(node['os']) 10 | fail 'Not supported Operation System, please use it on windows, linux or solaris host' 11 | end 12 | 13 | fail 'fmw attributes cannot be empty' unless node.attribute?('fmw') 14 | fail 'fmw_jdk attributes cannot be empty' unless node.attribute?('fmw_jdk') 15 | fail 'source_file parameter cannot be empty' unless node['fmw_jdk'].attribute?('source_file') 16 | fail 'source_file parameter cannot be empty' if node['fmw_jdk']['source_file'].nil? 17 | 18 | unless node['fmw_jdk']['source_x64_file'].nil? 19 | fail 'source_x64_file is only used in solaris for installing JDK x64 extension' if ['windows', 'linux'].include?(node['os']) 20 | end 21 | 22 | # linux 23 | if node['os'].include?('linux') 24 | 25 | if node['fmw_jdk']['source_file'].include?('rpm') 26 | node.default['fmw_jdk']['install_type'] = 'rpm' 27 | fail 'please use the rpm source_file on rhel linux family OS' unless node['platform_family'].include?('rhel') 28 | 29 | elsif node['fmw_jdk']['source_file'].include?('tar.gz') 30 | node.default['fmw_jdk']['install_type'] = 'tar.gz' 31 | 32 | else 33 | fail 'Unknown source_file extension for linux, please use a rpm or tar.gz file' 34 | end 35 | # solaris 36 | elsif node['os'].include?('solaris2') 37 | 38 | if node['fmw_jdk']['source_file'].include?('tar.Z') 39 | node.default['fmw_jdk']['install_type'] = 'tar.Z' 40 | 41 | elsif node['fmw_jdk']['source_file'].include?('tar.gz') 42 | node.default['fmw_jdk']['install_type'] = 'tar.gz' 43 | 44 | else 45 | fail 'Unknown source_file extension for solaris, please use a tar.gz or tar.Z SVR4 file' 46 | end 47 | end 48 | 49 | fmw_jdk_jdk node['fmw']['java_home_dir'] do 50 | action :install 51 | java_home_dir node['fmw']['java_home_dir'] 52 | source_file node['fmw_jdk']['source_file'] 53 | source_x64_file node['fmw_jdk']['source_x64_file'] if node['os'].include?('solaris2') 54 | end 55 | 56 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 57 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 58 | -------------------------------------------------------------------------------- /fmw_jdk/recipes/rng_service.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Recipe:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | unless ['linux'].include?(node['os']) 10 | # only necessary for linux VM 11 | return 12 | end 13 | 14 | if (node['platform_family'] == 'rhel' and node['platform_version'] < '6.0') 15 | return 16 | end 17 | 18 | package 'rng-tools' 19 | 20 | fmw_jdk_rng_service 'rng service' 21 | 22 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 23 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 24 | -------------------------------------------------------------------------------- /fmw_jdk/resources/jdk_linux.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_jdk, os: 'linux' do |node| 8 | node['fmw_jdk']['install_type'] == 'tar.gz' 9 | end 10 | 11 | # Installs an Oracle JDK 7 or 8 on a Linux host 12 | actions :install 13 | 14 | # Make create the default action 15 | default_action :install 16 | 17 | # Java home folder, this is the folder where the jdk will be installed 18 | attribute :java_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Linux JDK source file, it should be a file with .tar.gz as extension. 20 | attribute :source_file, kind_of: String, required: true, callbacks: 21 | { 22 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_linux).validate_source_file(extensions) } 23 | } 24 | 25 | state_attrs :java_home_dir 26 | 27 | attr_accessor :exists 28 | 29 | VALID_JDK_EXTENSIONS = 30 | ['.tar.gz'] 31 | 32 | private 33 | 34 | def self.validate_source_file(extensions) 35 | VALID_JDK_EXTENSIONS.any? { |word| extensions.end_with?(word) } 36 | end 37 | -------------------------------------------------------------------------------- /fmw_jdk/resources/jdk_linux_rpm.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_jdk, os: 'linux', platform_family: 'rhel' do |node| 8 | node['fmw_jdk']['install_type'] == 'rpm' 9 | end 10 | 11 | # Installs an Oracle JDK 7 or 8 rpm on a Linux host 12 | actions :install 13 | 14 | # Make create the default action 15 | default_action :install 16 | 17 | # Java home folder, this is the folder where the jdk will be installed 18 | attribute :java_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Linux JDK source file, it should be a file with .rpm as extension. 20 | attribute :source_file, kind_of: String, required: true, callbacks: 21 | { 22 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_linux_rpm).validate_source_file(extensions) } 23 | } 24 | 25 | state_attrs :java_home_dir 26 | 27 | attr_accessor :exists 28 | 29 | VALID_JDK_EXTENSIONS = 30 | ['.rpm'] 31 | 32 | private 33 | 34 | def self.validate_source_file(extensions) 35 | VALID_JDK_EXTENSIONS.any? { |word| extensions.end_with?(word) } 36 | end 37 | -------------------------------------------------------------------------------- /fmw_jdk/resources/jdk_solaris.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_jdk, os: 'solaris2' do |node| 8 | node['fmw_jdk']['install_type'] == 'tar.gz' 9 | end 10 | 11 | # Installs an Oracle JDK 7 or 8 on a Solaris host 12 | actions :install 13 | 14 | # Make create the default action 15 | default_action :install 16 | 17 | # Java home folder, this is the folder where the jdk will be installed 18 | attribute :java_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Solaris JDK source file, it should be a file with .tar.gz as extension. 20 | attribute :source_file, kind_of: String, required: true, callbacks: 21 | { 22 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_solaris).validate_source_file(extensions) } 23 | } 24 | # Solaris JDK source x64 file, it should be a file with .tar.gz as extension. 25 | attribute :source_x64_file, kind_of: String, required: false, callbacks: 26 | { 27 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_solaris).validate_source_file(extensions) } 28 | } 29 | 30 | state_attrs :java_home_dir 31 | 32 | attr_accessor :exists 33 | 34 | VALID_JDK_EXTENSIONS = 35 | ['.tar.gz'] 36 | 37 | private 38 | 39 | def self.validate_source_file(extensions) 40 | VALID_JDK_EXTENSIONS.any? { |word| extensions.end_with?(word) } 41 | end 42 | -------------------------------------------------------------------------------- /fmw_jdk/resources/jdk_solaris_z.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_jdk, os: 'solaris2' do |node| 8 | node['fmw_jdk']['install_type'] == 'tar.Z' 9 | end 10 | 11 | # Installs an Oracle JDK 7 or 8 SVR4 package on a Solaris host 12 | actions :install 13 | 14 | # Make create the default action 15 | default_action :install 16 | 17 | # Java home folder, this is the folder where the jdk will be installed 18 | attribute :java_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Solaris tar.Z JDK source file, it should be a SVR4 package file. 20 | attribute :source_file, kind_of: String, required: true, callbacks: 21 | { 22 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_solaris_z).validate_source_file(extensions) } 23 | } 24 | # Solaris tar.Z JDK source x64 file, it should be a SVR4 package file. 25 | attribute :source_x64_file, kind_of: String, required: false, callbacks: 26 | { 27 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_solaris_z).validate_source_file(extensions) } 28 | } 29 | 30 | state_attrs :java_home_dir 31 | 32 | attr_accessor :exists 33 | 34 | VALID_JDK_EXTENSIONS = 35 | ['.tar.Z'] 36 | 37 | private 38 | 39 | def self.validate_source_file(extensions) 40 | VALID_JDK_EXTENSIONS.any? { |word| extensions.end_with?(word) } 41 | end 42 | -------------------------------------------------------------------------------- /fmw_jdk/resources/jdk_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: jdk 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_jdk, os: 'windows' 8 | 9 | # Installs an Oracle JDK 7 or 8 executable on a Windows host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # Java home folder, this is the folder where the jdk will be installed 16 | attribute :java_home_dir, kind_of: String, required: true, name_attribute: true 17 | # Windows JDK source executable, it should be a file with .exe as extension. 18 | attribute :source_file, kind_of: String, required: true, callbacks: 19 | { 20 | 'source should have a valid JDK extension' => ->(extensions) { Chef::ResourceResolver.resolve(:fmw_jdk_jdk_windows).validate_source_file(extensions) } 21 | } 22 | 23 | state_attrs :java_home_dir 24 | 25 | attr_accessor :exists 26 | 27 | VALID_JDK_EXTENSIONS = 28 | ['.exe'] 29 | 30 | private 31 | 32 | def self.validate_source_file(extensions) 33 | VALID_JDK_EXTENSIONS.any? { |word| extensions.end_with?(word) } 34 | end 35 | -------------------------------------------------------------------------------- /fmw_jdk/resources/rng_service_debian.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'debian' 8 | 9 | # Configure the rng service on a Debian family host 10 | actions :configure 11 | 12 | # Make create the default action 13 | default_action :configure 14 | -------------------------------------------------------------------------------- /fmw_jdk/resources/rng_service_redhat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'rhel' do |node| 8 | node['platform_version'] < '7.0' 9 | end 10 | 11 | # Configure the rng service on a RedHat family host 12 | actions :configure 13 | 14 | # Make create the default action 15 | default_action :configure 16 | -------------------------------------------------------------------------------- /fmw_jdk/resources/rng_service_redhat_7.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Resource:: rng_service 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_jdk_rng_service, os: 'linux', platform_family: 'rhel' do |node| 8 | node['platform_version'] >= '7.0' 9 | end 10 | 11 | # Configure the rng service on a RedHat 7 family host 12 | actions :configure 13 | 14 | # Make create the default action 15 | default_action :configure 16 | -------------------------------------------------------------------------------- /fmw_jdk/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_jdk/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_jdk 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_jdk::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_jdk/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_jdk 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/exe/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/exe/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('C:/java/jdk1.8.0_131') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('C:/java/jdk1.8.0_131/bin/java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/exe/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/java/jdk1.8.0_131') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/java/jdk1.8.0_131/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm/serverspec/rng_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::rng_service' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | if ['redhat'].include?(os[:family]) and os[:release] >= '6.0' 9 | 10 | describe service('rngd') do 11 | it { should be_enabled } 12 | it { should be_running } 13 | end 14 | 15 | elsif ['debian'].include?(os[:family]) 16 | 17 | describe service('rng-tools') do 18 | it { should be_enabled } 19 | end 20 | 21 | describe service('rngd') do 22 | it { should be_running } 23 | end 24 | 25 | end 26 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm_7/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm_7/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/java/jdk1.7.0_79') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/java/jdk1.7.0_79/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm_7/serverspec/rng_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::rng_service' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | if ['redhat'].include?(os[:family]) and os[:release] >= '6.0' 9 | 10 | describe service('rngd') do 11 | it { should be_enabled } 12 | it { should be_running } 13 | end 14 | 15 | elsif ['debian'].include?(os[:family]) 16 | 17 | describe service('rng-tools') do 18 | it { should be_enabled } 19 | end 20 | 21 | describe service('rngd') do 22 | it { should be_running } 23 | end 24 | 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/rpm_7/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/java/jdk1.8.0_131') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/java/jdk1.8.0_131/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | describe file('/usr/bin/java') do 20 | it { should be_symlink } 21 | it { should be_linked_to '/etc/alternatives/java' } 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar/serverspec/rng_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::rng_service' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | if ['redhat'].include?(os[:family]) and os[:release] >= '6.0' 9 | 10 | describe service('rngd') do 11 | it { should be_enabled } 12 | it { should be_running } 13 | end 14 | 15 | elsif ['debian'].include?(os[:family]) 16 | 17 | describe service('rng-tools') do 18 | it { should be_enabled } 19 | end 20 | 21 | describe service('rngd') do 22 | it { should be_running } 23 | end 24 | 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/java/jdk1.7.0_79') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/java/jdk1.7.0_79/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | describe file('/usr/bin/java') do 20 | it { should be_symlink } 21 | it { should be_linked_to '/etc/alternatives/java' } 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7/serverspec/rng_service_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::rng_service' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | if ['redhat'].include?(os[:family]) and os[:release] >= '6.0' 9 | 10 | describe service('rngd') do 11 | it { should be_enabled } 12 | it { should be_running } 13 | end 14 | 15 | elsif ['debian'].include?(os[:family]) 16 | 17 | describe service('rng-tools') do 18 | it { should be_enabled } 19 | end 20 | 21 | describe service('rngd') do 22 | it { should be_running } 23 | end 24 | 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7_sol/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/jdk/instances/jdk1.7.0_79') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/jdk/instances/jdk1.7.0_79/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | describe file('/usr/bin/java') do 20 | it { should be_symlink } 21 | it { should be_linked_to '/usr/jdk/instances/jdk1.7.0_79/bin/java' } 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_7_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_sol/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_jdk::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/jdk/instances/jdk1.8.0_131') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/jdk/instances/jdk1.8.0_131/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | describe file('/usr/bin/java') do 20 | it { should be_symlink } 21 | it { should be_linked_to '/usr/jdk/instances/jdk1.8.0_131/bin/java' } 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /fmw_jdk/test/integration/tar_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_opatch/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | .yardoc -------------------------------------------------------------------------------- /fmw_opatch/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_opatch/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | cookbook 'fmw_wls', path: '../fmw_wls' 8 | cookbook 'fmw_inst', path: '../fmw_inst' 9 | end -------------------------------------------------------------------------------- /fmw_opatch/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_opatch/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_opatch/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_opatch/attributes/default.rb: -------------------------------------------------------------------------------- 1 | include_attribute 'fmw_wls' -------------------------------------------------------------------------------- /fmw_opatch/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_opatch/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def extract_fmw_opatch_fmw_extract(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_opatch_fmw_extract, :extract, message) 4 | end 5 | 6 | def apply_fmw_opatch_opatch(message) 7 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_opatch_opatch, :apply, message) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /fmw_opatch/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_opatch' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Patch Oracle WebLogic 12c or any FMW 11g or 12c product' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_opatch", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_opatch::weblogic", 12 | "This will apply the WebLogic patch on a Middleware home" 13 | recipe "fmw_opatch::service_bus", 14 | "This will apply the Service Bus patch on an Oracle Service Bus home" 15 | recipe "fmw_opatch::soa_suite", 16 | "This will apply the SOA Suite patch on an Oracle SOA Suite home" 17 | 18 | depends 'fmw_wls' 19 | depends 'fmw_inst' 20 | 21 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 22 | supports os 23 | end 24 | 25 | -------------------------------------------------------------------------------- /fmw_opatch/providers/fmw_extract.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_opatch 3 | # Provider:: fmw_extract 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # fmw_extract provider for unix 8 | provides :fmw_opatch_fmw_extract, os: [ 'linux', 'solaris2'] if respond_to?(:provides) 9 | 10 | def whyrun_supported? 11 | true 12 | end 13 | 14 | def load_current_resource 15 | Chef::Log.info('fmw extract provider, fmw_extract load current resource') 16 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_opatch_fmw_extract').new(new_resource.name) 17 | @current_resource.source_file(@new_resource.source_file) 18 | @current_resource.os_user(@new_resource.os_user) 19 | @current_resource.os_group(@new_resource.os_group) 20 | @current_resource.tmp_dir(@new_resource.tmp_dir) 21 | 22 | @current_resource.exists = true if ::File.exist?("#{@new_resource.tmp_dir}/#{@new_resource.name}") 23 | @current_resource 24 | end 25 | 26 | # extract opatch zip on a unix host 27 | action :extract do 28 | Chef::Log.info("#{@new_resource} fired the extract action") 29 | if @current_resource.exists 30 | Chef::Log.info("#{@new_resource} already extracted") 31 | else 32 | converge_by("Create resource #{@new_resource}") do 33 | package 'unzip' do 34 | action :install 35 | end 36 | 37 | execute "extract #{new_resource.name} file" do 38 | command "unzip -o #{new_resource.source_file} -d #{new_resource.tmp_dir}" 39 | cwd new_resource.tmp_dir 40 | user new_resource.os_user 41 | group new_resource.os_group 42 | end 43 | new_resource.updated_by_last_action(true) 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /fmw_opatch/providers/fmw_extract_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_opatch 3 | # Provider:: fmw_extract 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # fmw_extract provider for windows 8 | 9 | provides :fmw_opatch_fmw_extract, os: 'windows' if respond_to?(:provides) 10 | 11 | def whyrun_supported? 12 | true 13 | end 14 | 15 | def load_current_resource 16 | Chef::Log.info('fmw extract provider, fmw_extract load current resource') 17 | @current_resource ||= Chef::ResourceResolver.resolve('fmw_opatch_fmw_extract_windows').new(new_resource.name) 18 | @current_resource.source_file(@new_resource.source_file) 19 | @current_resource.tmp_dir(@new_resource.tmp_dir) 20 | @current_resource.version(@new_resource.version) 21 | @current_resource.middleware_home_dir(@new_resource.middleware_home_dir) 22 | 23 | @current_resource.exists = true if ::File.exist?("#{@new_resource.tmp_dir}/#{@new_resource.name}") 24 | 25 | @current_resource 26 | end 27 | 28 | # extract opatch zip on a windows host 29 | action :extract do 30 | Chef::Log.info("#{@new_resource} fired the extract action") 31 | if @current_resource.exists 32 | Chef::Log.info("#{@new_resource} already extracted") 33 | else 34 | converge_by("Create resource #{ @new_resource }") do 35 | 36 | if @new_resource.version == '10.3.6' 37 | path = "#{@new_resource.middleware_home_dir}\\wlserver_10.3\\server\\adr" 38 | elsif new_resource.version == '12.1.1' 39 | path = "#{@new_resource.middleware_home_dir}\\wlserver_12.1\\server\\adr" 40 | else 41 | path = "#{@new_resource.middleware_home_dir}\\oracle_common\\adr" 42 | end 43 | 44 | execute "extract #{new_resource.name} file" do 45 | command "#{path}\\unzip.exe -o #{new_resource.source_file} -d #{new_resource.tmp_dir}" 46 | cwd new_resource.tmp_dir 47 | end 48 | 49 | new_resource.updated_by_last_action(true) 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /fmw_opatch/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_opatch 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | 10 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 11 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 12 | -------------------------------------------------------------------------------- /fmw_opatch/recipes/weblogic.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_opatch 3 | # Recipe:: weblogic 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 8 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 9 | 10 | include_recipe 'fmw_wls::install' 11 | 12 | fail 'fmw_opatch attributes cannot be empty' unless node.attribute?('fmw_opatch') 13 | fail 'source_file parameter cannot be empty' unless node['fmw_opatch'].attribute?('weblogic_source_file') 14 | fail 'patch_id parameter cannot be empty' unless node['fmw_opatch'].attribute?('weblogic_patch_id') 15 | 16 | if ['10.3.6', '12.1.1'].include?(node['fmw']['version']) 17 | return 18 | else 19 | fmw_oracle_home = node['fmw']['middleware_home_dir'] 20 | end 21 | 22 | fmw_opatch_fmw_extract node['fmw_opatch']['weblogic_patch_id'] do 23 | action :extract 24 | source_file node['fmw_opatch']['weblogic_source_file'] 25 | os_user node['fmw']['os_user'] if ['solaris2', 'linux'].include?(node['os']) 26 | os_group node['fmw']['os_group'] if ['solaris2', 'linux'].include?(node['os']) 27 | tmp_dir node['fmw']['tmp_dir'] 28 | middleware_home_dir node['fmw']['middleware_home_dir'] if node['os'].include?('windows') 29 | version node['fmw']['version'] if node['os'].include?('windows') 30 | end 31 | 32 | fmw_opatch_opatch node['fmw_opatch']['weblogic_patch_id'] do 33 | action :apply 34 | patch_id node['fmw_opatch']['weblogic_patch_id'] 35 | oracle_home_dir fmw_oracle_home 36 | java_home_dir node['fmw']['java_home_dir'] 37 | orainst_dir node['fmw']['orainst_dir'] if ['solaris2', 'linux'].include?(node['os']) 38 | os_user node['fmw']['os_user'] if ['solaris2', 'linux'].include?(node['os']) 39 | os_group node['fmw']['os_group'] if ['solaris2', 'linux'].include?(node['os']) 40 | tmp_dir node['fmw']['tmp_dir'] 41 | end 42 | 43 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 44 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 45 | -------------------------------------------------------------------------------- /fmw_opatch/resources/fmw_extract.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_opatch 5 | # Resource:: fmw_extract 6 | # 7 | provides :fmw_opatch_fmw_extract, os: [ 'linux', 'solaris2'] 8 | 9 | # extracts opatch zip file 10 | actions :extract 11 | 12 | # Make create the default action 13 | default_action :extract 14 | 15 | # Opatch source file 16 | attribute :source_file, kind_of: String, required: true 17 | # WebLogic Operating system user 18 | attribute :os_user, kind_of: String, required: true 19 | # WebLogic Operating system group 20 | attribute :os_group, kind_of: String, required: true 21 | # tmp folder 22 | attribute :tmp_dir, kind_of: String, required: true 23 | 24 | state_attrs :source_file, :os_user, :os_group, :tmp_dir 25 | 26 | attr_accessor :exists 27 | -------------------------------------------------------------------------------- /fmw_opatch/resources/fmw_extract_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_opatch 5 | # Resource:: fmw_extract 6 | # 7 | provides :fmw_opatch_fmw_extract, os: 'windows' 8 | 9 | # extracts opatch zip file 10 | actions :extract 11 | 12 | # Make create the default action 13 | default_action :extract 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # middleware home path 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | # Opatch source file 20 | attribute :source_file, kind_of: String, required: true 21 | # tmp folder 22 | attribute :tmp_dir, kind_of: String, required: true 23 | 24 | state_attrs :source_file, :tmp_dir 25 | 26 | attr_accessor :exists 27 | -------------------------------------------------------------------------------- /fmw_opatch/resources/opatch.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_opatch 5 | # Resource:: opatch 6 | # 7 | provides :fmw_opatch_opatch, os: [ 'linux', 'solaris2'] 8 | 9 | # apply or rollback the patch 10 | actions :apply, :rollback 11 | 12 | # Make create the default action 13 | default_action :apply 14 | 15 | # Opatch patch id 16 | attribute :patch_id, kind_of: String, required: true, name_attribute: true 17 | # Oracle home folder 18 | attribute :oracle_home_dir, kind_of: String, required: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Parent folder of the OraInst.loc 22 | attribute :orainst_dir, kind_of: String, required: true 23 | # WebLogic Operating system user 24 | attribute :os_user, kind_of: String, required: true 25 | # WebLogic Operating system group 26 | attribute :os_group, kind_of: String, required: true 27 | # tmp folder 28 | attribute :tmp_dir, kind_of: String, required: true 29 | 30 | state_attrs :patch_id, :oracle_home_dir, :java_home_dir, :orainst_dir, :os_user, :os_group, :tmp_dir 31 | 32 | attr_accessor :exists 33 | -------------------------------------------------------------------------------- /fmw_opatch/resources/opatch_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_opatch 5 | # Resource:: opatch 6 | # 7 | provides :fmw_opatch_opatch, os: 'windows' 8 | 9 | # apply or rollback the patch 10 | actions :apply, :rollback 11 | 12 | # Make create the default action 13 | default_action :apply 14 | 15 | # Opatch patch id 16 | attribute :patch_id, kind_of: String, required: true, name_attribute: true 17 | # Oracle home folder 18 | attribute :oracle_home_dir, kind_of: String, required: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # tmp folder 22 | attribute :tmp_dir, kind_of: String, required: true 23 | 24 | state_attrs :patch_id, :oracle_home_dir, :java_home_dir, :tmp_dir 25 | 26 | attr_accessor :exists 27 | -------------------------------------------------------------------------------- /fmw_opatch/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_opatch/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_domain 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_opatch::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_opatch/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_opatch 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_11g.rsp') do 17 | it { should be_file } 18 | end 19 | 20 | describe file('C:\\Program Files\\Oracle\\Inventory') do 21 | it { should be_directory } 22 | end 23 | 24 | describe file('C:/oracle/middleware_1036') do 25 | it { should be_directory } 26 | end 27 | 28 | describe file('C:/oracle/middleware_1036/wlserver_10.3/common/bin/wlst.cmd') do 29 | it { should be_file } 30 | end 31 | 32 | describe file('C:/oracle/middleware_1036/Oracle_OSB1') do 33 | it { should be_directory } 34 | end 35 | 36 | describe file('C:/oracle/middleware_1036/Oracle_SOA1') do 37 | it { should be_directory } 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1036_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=Fusion Middleware Infrastructure' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | describe file('C:/oracle/middleware_1213/oracle_common/bin/rcu.bat') do 34 | it { should be_file } 35 | end 36 | 37 | describe file('C:/oracle/middleware_1213/soa/bin') do 38 | it { should be_directory } 39 | end 40 | 41 | 42 | end -------------------------------------------------------------------------------- /fmw_opatch/test/integration/wls1213_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_rcu/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | 18 | .yardoc -------------------------------------------------------------------------------- /fmw_rcu/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_rcu/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | cookbook 'fmw_wls', path: '../fmw_wls' 8 | cookbook 'fmw_inst', path: '../fmw_inst' 9 | end -------------------------------------------------------------------------------- /fmw_rcu/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_rcu/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_rcu/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_rcu/attributes/default.rb: -------------------------------------------------------------------------------- 1 | include_attribute 'fmw_wls' 2 | 3 | default['fmw_rcu']['db_sys_user'] = 'sys' 4 | default['fmw_rcu']['rcu_prefix'] = 'DEV1' 5 | -------------------------------------------------------------------------------- /fmw_rcu/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_rcu/files/default/checkrcu.py: -------------------------------------------------------------------------------- 1 | from java.sql import DriverManager 2 | 3 | jdbcurl = sys.argv[1] 4 | password = sys.argv[2] 5 | prefix = sys.argv[3] 6 | sysuser = sys.argv[4] 7 | 8 | conn = DriverManager.getConnection(jdbcurl, sysuser + " as sysdba", password) 9 | stmt = conn.createStatement() 10 | try: 11 | rs = stmt.executeQuery("select distinct 'found' from system.schema_version_registry where mrc_name ='"+prefix+"'") 12 | 13 | emp = {} 14 | while rs.next(): 15 | print rs.getString(1) 16 | 17 | rs.close() 18 | stmt.close() 19 | conn.close() 20 | 21 | except: 22 | print "rcu table does not exists" 23 | stmt.close() 24 | conn.close() 25 | -------------------------------------------------------------------------------- /fmw_rcu/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def create_fmw_rcu_repository(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_rcu_repository, :create, message) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /fmw_rcu/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_rcu' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Installs Oracle WebLogic 11g,12c on any Windows, Linux or Solaris host' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_rcu", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_rcu::common", 12 | "This will create a basic FMW repository with OPSS, UMS etc on an Oracle Database" 13 | recipe "fmw_rcu::soa_suite", 14 | "This will create a FMW SOA Suite repository on an Oracle Database" 15 | 16 | depends 'fmw_inst' 17 | depends 'fmw_wls' 18 | 19 | %w{ windows debian ubuntu redhat centos oracle sles }.each do |os| 20 | supports os 21 | end 22 | -------------------------------------------------------------------------------- /fmw_rcu/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_rcu 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | 10 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 11 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 12 | -------------------------------------------------------------------------------- /fmw_rcu/resources/repository.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_rcu 5 | # Resource:: repository 6 | # 7 | provides :fmw_rcu_repository, os: [ 'linux', 'solaris2'] 8 | 9 | # create or drop a FMW RCU repository on Oracle Database 10 | actions :create, :drop 11 | 12 | # Make create the default action 13 | default_action :create 14 | 15 | # Java home folder 16 | attribute :java_home_dir, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | # WebLogic version 20 | attribute :version, kind_of: String, required: true 21 | # Oracle home directory 22 | attribute :oracle_home_dir, kind_of: String, required: true 23 | # Oracle JDBC connect url 24 | attribute :jdbc_connect_url, kind_of: String, required: true 25 | # Oracle database connect url 26 | attribute :db_connect_url, kind_of: String, required: true 27 | # Oracle database RCU sys user 28 | attribute :db_connect_user, kind_of: String, required: true 29 | # Oracle database RCU sys password 30 | attribute :db_connect_password, kind_of: String, required: true 31 | # RCU repository schema prefix 32 | attribute :rcu_prefix, kind_of: String, required: true 33 | # RCU repository components 34 | attribute :rcu_components, kind_of: Array, required: true 35 | # RCU component password 36 | attribute :rcu_component_password, kind_of: String, required: true 37 | # WebLogic Operating system user 38 | attribute :os_user, kind_of: String, required: true 39 | # WebLogic Operating system group 40 | attribute :os_group, kind_of: String, required: true 41 | # tmp folder 42 | attribute :tmp_dir, kind_of: String, required: true 43 | 44 | state_attrs :java_home_dir, :middleware_home_dir, :db_connect_url, :jdbc_connect_url, :db_connect_user, :rcu_prefix, :rcu_components, :os_user, :os_group, :tmp_dir 45 | 46 | attr_accessor :exists 47 | -------------------------------------------------------------------------------- /fmw_rcu/resources/repository_windows.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Oracle Corporation 2 | # All Rights Reserved 3 | # 4 | # Cookbook Name:: fmw_rcu 5 | # Resource:: repository 6 | # 7 | provides :fmw_rcu_repository, os: 'windows' 8 | 9 | # create or drop a FMW RCU repository on Oracle Database 10 | actions :create, :drop 11 | 12 | # Make create the default action 13 | default_action :create 14 | 15 | # Java home folder 16 | attribute :java_home_dir, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true 19 | # WebLogic version 20 | attribute :version, kind_of: String, required: true 21 | # Oracle home directory 22 | attribute :oracle_home_dir, kind_of: String, required: true 23 | # Oracle JDBC connect url 24 | attribute :jdbc_connect_url, kind_of: String, required: true 25 | # Oracle database connect url 26 | attribute :db_connect_url, kind_of: String, required: true 27 | # Oracle database RCU sys user 28 | attribute :db_connect_user, kind_of: String, required: true 29 | # Oracle database RCU sys password 30 | attribute :db_connect_password, kind_of: String, required: true 31 | # RCU repository schema prefix 32 | attribute :rcu_prefix, kind_of: String, required: true 33 | # RCU repository components 34 | attribute :rcu_components, kind_of: Array, required: true 35 | # RCU component password 36 | attribute :rcu_component_password, kind_of: String, required: true 37 | # tmp folder 38 | attribute :tmp_dir, kind_of: String, required: true 39 | 40 | state_attrs :java_home_dir, :middleware_home_dir, :jdbc_connect_url, :db_connect_url, :db_connect_user, :rcu_prefix, :rcu_components, :tmp_dir 41 | 42 | attr_accessor :exists 43 | -------------------------------------------------------------------------------- /fmw_rcu/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_rcu/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_rcu 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_rcu::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_rcu/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/fmwplatform-samples/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_rcu 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_rcu/test/integration/data_bags/fmw_databases/entry10.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "entry10", 3 | "db_sys_password": "Welcome01", 4 | "rcu_component_password": "Welcome02" 5 | } -------------------------------------------------------------------------------- /fmw_rcu/test/integration/data_bags/fmw_databases/entry11.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "entry11", 3 | "db_sys_password": "Welcome01", 4 | "rcu_component_password": "Welcome02" 5 | } -------------------------------------------------------------------------------- /fmw_rcu/test/integration/data_bags/fmw_databases/entry12.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "entry12", 3 | "db_sys_password": "Welcome01", 4 | "rcu_component_password": "Welcome02" 5 | } -------------------------------------------------------------------------------- /fmw_rcu/test/integration/data_bags/fmw_databases/entry13.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "entry13", 3 | "db_sys_password": "Welcome01", 4 | "rcu_component_password": "Welcome02" 5 | } -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_rcu::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1036_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1036_win/serverspec/soa_suite_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_rcu::soa_suite' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_11g.rsp') do 17 | it { should be_file } 18 | it { should contain " 'windows' -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1213/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_rcu::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1213/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1213_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_rcu::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1213_win/serverspec/soa_suite_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_rcu::soa_suite' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=Fusion Middleware Infrastructure' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | describe file('C:/oracle/middleware_1213/oracle_common/bin/rcu.bat') do 34 | it { should be_file } 35 | end 36 | 37 | describe file('C:/oracle/middleware_1213/soa/bin') do 38 | it { should be_directory } 39 | end 40 | 41 | end -------------------------------------------------------------------------------- /fmw_rcu/test/integration/wls1213_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_wls/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | 10 | # Bundler 11 | Gemfile.lock 12 | bin/* 13 | .bundle/* 14 | 15 | .kitchen/ 16 | .kitchen.local.yml 17 | 18 | .yardoc/* -------------------------------------------------------------------------------- /fmw_wls/.rubocop.yml: -------------------------------------------------------------------------------- 1 | Style/Blocks: 2 | Description: >- 3 | Avoid using {...} for multi-line blocks (multiline chaining is 4 | always ugly). 5 | Prefer {...} over do...end for single-line blocks. 6 | Enabled: false 7 | 8 | Style/AccessorMethodName: 9 | Description: Check the naming of accessor methods for get_/set_. 10 | Enabled: false 11 | 12 | Style/Next: 13 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 14 | Enabled: false 15 | 16 | AllCops: 17 | Exclude: 18 | - 'spec/**/*' 19 | - 'files/**/*' 20 | - 'recipes/**/*' 21 | - 'attributes/**/*' 22 | - 'templates/**/*' 23 | - 'test/**/*' 24 | - 'Rakefile' 25 | - 'Gemfile' 26 | - '*.markdown' 27 | - '*.md' 28 | - 'metadata.rb' 29 | 30 | LineLength: 31 | Enabled: false 32 | 33 | MethodLength: 34 | Enabled: false 35 | 36 | Lint/UnusedMethodArgument: 37 | Description: 'Checks for unused method arguments.' 38 | Enabled: false 39 | 40 | # avoid parameter lists longer than 8 parameters. 41 | ParameterLists: 42 | Max: 8 43 | CountKeywordArgs: true 44 | Enabled: true 45 | 46 | EndOfLine: 47 | Enabled: false -------------------------------------------------------------------------------- /fmw_wls/Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'fmw_jdk', path: '../fmw_jdk' 7 | end -------------------------------------------------------------------------------- /fmw_wls/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'berkshelf' 3 | gem 'rake', '>= 10.3' 4 | gem 'rubocop', '= 0.23' 5 | gem 'guard', '>= 2.6' 6 | gem 'guard-rubocop', '>= 1.1' 7 | gem 'foodcritic' 8 | gem 'chefspec', '= 4.2.0' 9 | gem 'yard-chef' 10 | 11 | gem 'rspec', :require => false 12 | -------------------------------------------------------------------------------- /fmw_wls/License: -------------------------------------------------------------------------------- 1 | "The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE." -------------------------------------------------------------------------------- /fmw_wls/Rakefile: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "chef" 3 | require "yard" 4 | YARD::Config.load_plugin 'chef' 5 | YARD::Rake::YardocTask.new do |t| 6 | t.files = ['*.rb','libraries/**.rb', 'providers/*.rb','resources/*.rb','recipes/*.rb'] 7 | #t.options = ['--debug'] 8 | end -------------------------------------------------------------------------------- /fmw_wls/attributes/default.rb: -------------------------------------------------------------------------------- 1 | 2 | default['fmw']['version'] = '12.1.3' # 10.3.6|12.1.1|12.1.2|12.1.3|12.2.1|12.2.1.1|12.2.1.2|12.2.1.3 3 | default['fmw_wls']['install_type'] = 'wls' # infra or wls 4 | default['fmw']['prod_name'] = nil 5 | 6 | if platform_family?('windows') 7 | default['fmw']['middleware_home_dir'] = 'C:/oracle/middleware' 8 | default['fmw']['ora_inventory_dir'] = 'C:\\Program Files\\Oracle\\Inventory' 9 | default['fmw']['tmp_dir'] = 'C:/temp' 10 | else 11 | default['fmw']['middleware_home_dir'] = '/opt/oracle/middleware' 12 | default['fmw']['os_user'] = 'oracle' 13 | default['fmw']['os_group'] = 'oinstall' 14 | default['fmw']['os_shell'] = '/bin/bash' 15 | end 16 | 17 | if platform_family?('debian') or platform_family?('rhel') 18 | default['fmw']['orainst_dir'] = '/etc' 19 | default['fmw']['user_home_dir'] = '/home' 20 | default['fmw']['ora_inventory_dir'] = '/home/oracle/oraInventory' 21 | default['fmw']['tmp_dir'] = '/tmp' 22 | elsif platform_family?('solaris2') 23 | default['fmw']['orainst_dir'] = '/var/opt/oracle' 24 | default['fmw']['user_home_dir'] = '/export/home' 25 | default['fmw']['ora_inventory_dir'] = '/export/home/oracle/oraInventory' 26 | default['fmw']['tmp_dir'] = '/var/tmp' 27 | end 28 | -------------------------------------------------------------------------------- /fmw_wls/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | 81 | # Strainer # 82 | ############ 83 | Colanderfile 84 | Strainerfile 85 | .colander 86 | .strainer 87 | 88 | # Vagrant # 89 | ########### 90 | .vagrant 91 | Vagrantfile 92 | 93 | # Travis # 94 | ########## 95 | .travis.yml 96 | -------------------------------------------------------------------------------- /fmw_wls/definitions/ora_inst.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Definition:: ora_inst 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | define :ora_inst, :orainst_dir => nil, :ora_inventory_dir => nil, :os_group => nil, :os_user => nil do 8 | 9 | # add oraInst.loc to /etc for the oracle inventory location 10 | template "#{params[:orainst_dir]}/oraInst.loc" do 11 | cookbook 'fmw_wls' 12 | source 'oraInst.loc' 13 | mode 0755 14 | variables(ora_inventory_dir: params[:ora_inventory_dir], 15 | os_group: params[:os_group]) 16 | action :create 17 | end 18 | 19 | # create the oracle inventory location under the WebLogic OS user 20 | directory params[:ora_inventory_dir] do 21 | owner params[:os_user] 22 | group params[:os_group] 23 | mode 0775 24 | action :create 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /fmw_wls/definitions/wls_template.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Definition:: wls_template 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | define :wls_template, :unix => true, :middleware_home_dir => nil, :tmp_dir => nil, :template => nil, :install_type => nil, :os_group => nil, :os_user => nil do 8 | 9 | if params[:install_type] == 'wls' 10 | install_type = 'WebLogic Server' 11 | elsif params[:install_type] == 'infra' 12 | install_type = 'Fusion Middleware Infrastructure' 13 | else 14 | install_type = 'WebLogic Server' 15 | end 16 | 17 | # add the webLogic silent response 18 | template "#{params[:tmp_dir]}/#{params[:template]}" do 19 | cookbook 'fmw_wls' 20 | source params[:template] 21 | mode 0755 if params[:unix] 22 | owner params[:os_user] if params[:unix] 23 | group params[:os_group] if params[:unix] 24 | variables(middleware_home_dir: params[:middleware_home_dir], 25 | install_type: install_type) 26 | end 27 | 28 | end -------------------------------------------------------------------------------- /fmw_wls/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def install_fmw_wls_wls(message) 3 | ChefSpec::Matchers::ResourceMatcher.new(:fmw_wls_wls, :install, message) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /fmw_wls/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'fmw_wls' 2 | maintainer 'Oracle' 3 | maintainer_email 'fmw-chef-and-puppet_ww@oracle.com' 4 | license 'MIT' 5 | description 'Installs Oracle WebLogic 11g, 12c on any Windows, Linux or Solaris host' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.1.5' 8 | 9 | recipe "fmw_wls", 10 | "This is an empty recipe and does not do anything" 11 | recipe "fmw_wls::install", 12 | "This will install WebLogic on a host" 13 | recipe "fmw_wls::setup", 14 | "Optional creates the WebLogic operating user and group on a any linux or solaris host" 15 | 16 | depends 'fmw_jdk' 17 | 18 | %w{ windows solaris debian ubuntu redhat centos oracle sles }.each do |os| 19 | supports os 20 | end -------------------------------------------------------------------------------- /fmw_wls/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Recipe:: default 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | 10 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 11 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 12 | -------------------------------------------------------------------------------- /fmw_wls/recipes/install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Recipe:: install 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | include_recipe 'fmw_jdk::install' 10 | 11 | if node['os'].include?('windows') 12 | unix = false 13 | else 14 | unix = true 15 | end 16 | 17 | fmw_wls_wls node['fmw']['middleware_home_dir'] do 18 | action :install 19 | java_home_dir node['fmw']['java_home_dir'] 20 | source_file node['fmw_wls']['source_file'] 21 | version node['fmw']['version'] 22 | install_type node['fmw_wls']['install_type'] 23 | middleware_home_dir node['fmw']['middleware_home_dir'] 24 | ora_inventory_dir node['fmw']['ora_inventory_dir'] 25 | orainst_dir node['fmw']['orainst_dir'] if unix 26 | os_user node['fmw']['os_user'] if unix 27 | os_group node['fmw']['os_group'] if unix 28 | tmp_dir node['fmw']['tmp_dir'] 29 | end 30 | 31 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 32 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 33 | -------------------------------------------------------------------------------- /fmw_wls/recipes/setup.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Recipe:: setup 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting execution phase" 7 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Starting compile phase" 8 | 9 | if platform_family?('windows') 10 | return 11 | end 12 | 13 | group node['fmw']['os_group'] do 14 | action :create 15 | end 16 | 17 | user node['fmw']['os_user'] do 18 | comment 'created by chef for WebLogic installation' 19 | gid node['fmw']['os_group'] 20 | shell node['fmw']['os_shell'] 21 | home node['fmw']['user_home_dir'] + '/' + node['fmw']['os_user'] 22 | manage_home true 23 | action :create 24 | end 25 | 26 | # log "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished execution phase" 27 | puts "####{cookbook_name}::#{recipe_name} #{Time.now.inspect}: Finished compile phase" 28 | -------------------------------------------------------------------------------- /fmw_wls/resources/wls_linux.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Resource:: wls 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_wls_wls, os: 'linux' 8 | 9 | # Installs WebLogic 11g,12c on a Linux host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Linux WebLogic source file, it should be a file with .jar as extension. 22 | attribute :source_file, kind_of: String, required: true, callbacks: 23 | { 24 | 'source should have a valid WebLogic extension' => ->(extensions) { Chef::ResourceResolver.resolve('fmw_wls_wls_linux').validate_source_file(extensions) } 25 | } 26 | # WebLogic Operating system user 27 | attribute :os_user, kind_of: String, required: true 28 | # WebLogic Operating system group 29 | attribute :os_group, kind_of: String, required: true 30 | # Full path of OraInventory directory 31 | attribute :ora_inventory_dir, kind_of: String, required: true 32 | # Parent folder of the OraInst.loc 33 | attribute :orainst_dir, kind_of: String, required: true 34 | # tmp folder 35 | attribute :tmp_dir, kind_of: String, required: true 36 | # infra|wls WebLogic or WebLogic Infra installation 37 | attribute :install_type, kind_of: String, required: true 38 | 39 | state_attrs :java_home_dir, :middleware_home_dir, :version, :os_user, :os_group, :ora_inventory_dir, :orainst_dir, :tmp_dir 40 | 41 | attr_accessor :exists 42 | 43 | VALID_WLS_EXTENSIONS = 44 | ['.jar'] 45 | 46 | private 47 | 48 | def self.validate_source_file(extensions) 49 | VALID_WLS_EXTENSIONS.any? { |word| extensions.end_with?(word) } 50 | end 51 | -------------------------------------------------------------------------------- /fmw_wls/resources/wls_solaris.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmwwls 3 | # Resource:: wls 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_wls_wls, os: 'solaris2' 8 | 9 | # Installs WebLogic 11g,12c on a Solaris host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Solaris WebLogic source file, it should be a file with .jar as extension. 22 | attribute :source_file, kind_of: String, required: true, callbacks: 23 | { 24 | 'source should have a valid WebLogic extension' => ->(extensions) { Chef::ResourceResolver.resolve('fmw_wls_wls_solaris').validate_source_file(extensions) } 25 | } 26 | # WebLogic Operating system user 27 | attribute :os_user, kind_of: String, required: true 28 | # WebLogic Operating system group 29 | attribute :os_group, kind_of: String, required: true 30 | # Full path of OraInventory directory 31 | attribute :ora_inventory_dir, kind_of: String, required: true 32 | # Parent folder of the OraInst.loc 33 | attribute :orainst_dir, kind_of: String, required: true 34 | # tmp folder 35 | attribute :tmp_dir, kind_of: String, required: true 36 | # infra|wls WebLogic or WebLogic Infra installation 37 | attribute :install_type, kind_of: String, required: true 38 | 39 | state_attrs :java_home_dir, :middleware_home_dir, :version, :os_user, :os_group, :ora_inventory_dir, :orainst_dir, :tmp_dir 40 | 41 | attr_accessor :exists 42 | 43 | VALID_WLS_EXTENSIONS = 44 | ['.jar'] 45 | 46 | private 47 | 48 | def self.validate_source_file(extensions) 49 | VALID_WLS_EXTENSIONS.any? { |word| extensions.end_with?(word) } 50 | end 51 | -------------------------------------------------------------------------------- /fmw_wls/resources/wls_windows.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Resource:: wls 4 | # 5 | # Copyright 2015 Oracle. All Rights Reserved 6 | # 7 | provides :fmw_wls_wls, os: 'windows' 8 | 9 | # Installs WebLogic 11g,12c on a Linux host 10 | actions :install 11 | 12 | # Make create the default action 13 | default_action :install 14 | 15 | # WebLogic Version 16 | attribute :version, kind_of: String, required: true 17 | # Middleware home folder 18 | attribute :middleware_home_dir, kind_of: String, required: true, name_attribute: true 19 | # Java home folder 20 | attribute :java_home_dir, kind_of: String, required: true 21 | # Linux WebLogic source file, it should be a file with .jar as extension. 22 | attribute :source_file, kind_of: String, required: true, callbacks: 23 | { 24 | 'source should have a valid WebLogic extension' => ->(extensions) { Chef::ResourceResolver.resolve('fmw_wls_wls_windows').validate_source_file(extensions) } 25 | } 26 | # Full path of OraInventory directory 27 | attribute :ora_inventory_dir, kind_of: String, required: true 28 | # tmp folder 29 | attribute :tmp_dir, kind_of: String, required: true 30 | # infra|wls WebLogic or WebLogic Infra installation 31 | attribute :install_type, kind_of: String, required: true 32 | 33 | state_attrs :java_home_dir, :middleware_home_dir, :version, :ora_inventory_dir, :tmp_dir 34 | 35 | attr_accessor :exists 36 | 37 | VALID_WLS_EXTENSIONS = 38 | ['.jar'] 39 | 40 | private 41 | 42 | def self.validate_source_file(extensions) 43 | VALID_WLS_EXTENSIONS.any? { |word| extensions.end_with?(word) } 44 | end 45 | -------------------------------------------------------------------------------- /fmw_wls/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.log_level = :error 6 | config.expect_with :rspec do |c| 7 | c.syntax = :expect 8 | end 9 | config.color = true 10 | config.tty = true 11 | 12 | end 13 | 14 | at_exit { ChefSpec::Coverage.report! } -------------------------------------------------------------------------------- /fmw_wls/spec/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: fmw_wls 3 | # Spec:: default 4 | # 5 | # Copyright (c) 2015 The Authors, All Rights Reserved. 6 | 7 | require 'spec_helper' 8 | 9 | describe 'fmw_wls::default' do 10 | 11 | context 'When all attributes are default, on an unspecified platform' do 12 | 13 | let(:chef_run) do 14 | runner = ChefSpec::ServerRunner.new 15 | runner.converge(described_recipe) 16 | end 17 | 18 | it 'converges successfully' do 19 | chef_run # This should not raise an error 20 | end 21 | 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /fmw_wls/templates/default/oraInst.loc: -------------------------------------------------------------------------------- 1 | inventory_loc=<%= @ora_inventory_dir %> 2 | inst_group=<%= @os_group %> -------------------------------------------------------------------------------- /fmw_wls/templates/default/wls_11g.rsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fmw_wls/templates/default/wls_12c.rsp: -------------------------------------------------------------------------------- 1 | [ENGINE] 2 | Response File Version=1.0.0.0.0 3 | [GENERIC] 4 | 5 | #The oracle home location. This can be an existing Oracle Home or a new Oracle Home 6 | ORACLE_HOME=<%= @middleware_home_dir %> 7 | #Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples. 8 | INSTALL_TYPE=<%= @install_type %> 9 | 10 | #Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name. 11 | MYORACLESUPPORT_USERNAME= 12 | #Provide the My Oracle Support Password 13 | MYORACLESUPPORT_PASSWORD= 14 | #Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration 15 | DECLINE_SECURITY_UPDATES=true 16 | #Set this to true if My Oracle Support Password is specified 17 | SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 18 | -------------------------------------------------------------------------------- /fmw_wls/test.md: -------------------------------------------------------------------------------- 1 | # Chef tests 2 | 3 | ## Chef 4 | - optional update /vagrant/chef/node.json or /vagrant/chef/solo.rb 5 | 6 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json 7 | - sudo chef-solo --config /vagrant/chef/solo.rb --json-attributes /vagrant/chef/node.json --why-run 8 | 9 | Windows, open cmd as administrator 10 | - chef-solo --config C:/projects/vagrant_chef_puppet_linux7.0/chef/solo_win.rb --json-attributes C:/projects/vagrant_chef_puppet_linux7.0/chef/node_win.json 11 | 12 | ## Ruby 13 | 14 | - vagrant ssh 15 | - sudo su - 16 | - ruby -v 17 | - gem --version 18 | - yum install -y libxml2-devel libxslt-devel 19 | 20 | ## Bundler 21 | 22 | - disconnect vpn 23 | - gem install bundler --no-rdoc --no-ri 24 | - cd /vagrant/chef/cookbooks/fmw_wls 25 | - bundle -v 26 | - bundle install --without development 27 | 28 | ## Test 29 | 30 | - bundle exec foodcritic . 31 | - bundle exec rspec 32 | - bundle exec rubocop 33 | - bundle exec rake yard 34 | 35 | ## Test Kitchen 36 | 37 | - kitchen list 38 | - kitchen create xxx 39 | 40 | - kitchen setup xxx 41 | - kitchen converge xxx 42 | - kitchen verify xxx 43 | 44 | - kitchen login xxx 45 | - kitchen destroy xx 46 | 47 | 48 | -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1036/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1036/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1036_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1036_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_11g.rsp') do 17 | it { should be_file } 18 | end 19 | 20 | describe file('C:/oracle/middleware_1036') do 21 | it { should be_directory } 22 | end 23 | 24 | describe file('C:/oracle/middleware_1036/wlserver_10.3/common/bin/wlst.cmd') do 25 | it { should be_file } 26 | end 27 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1036_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_infra/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_infra/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_infra_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_infra_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=Fusion Middleware Infrastructure' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_infra_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_sol/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_sol/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('/usr/jdk/instances/jdk1.8.0_131') do 9 | it { should be_directory } 10 | it { should be_owned_by 'root' } 11 | end 12 | 13 | describe file('/usr/jdk/instances/jdk1.8.0_131/bin/java') do 14 | it { should be_file } 15 | it { should be_owned_by 'root' } 16 | it { should be_executable } 17 | end 18 | 19 | describe file('/usr/bin/java') do 20 | it { should be_symlink } 21 | it { should be_linked_to '/usr/jdk/instances/jdk1.8.0_131/bin/java' } 22 | end 23 | 24 | describe group('oinstall') do 25 | it { should exist } 26 | end 27 | 28 | describe user('oracle') do 29 | it { should belong_to_group 'oinstall' } 30 | it { should have_home_directory '/export/home/oracle' } 31 | it { should have_login_shell '/bin/bash' } 32 | end 33 | 34 | describe file('/var/opt/oracle/oraInst.loc') do 35 | it { should be_file } 36 | it { should be_owned_by 'root' } 37 | it { should be_readable.by('others') } 38 | # it { should contain 'inventory_loc=/export/home/oracle/oraInventory' } 39 | # it { should contain 'inst_group=oinstall' } 40 | end 41 | 42 | describe file('/var/tmp/wls_12c.rsp') do 43 | it { should be_file } 44 | # it { should contain 'ORACLE_HOME=/opt/oracle/middleware_1213' } 45 | # it { should contain 'INSTALL_TYPE=Fusion Middleware Infrastructure' } 46 | end 47 | 48 | describe file('/export/home/oracle/oraInventory') do 49 | it { should be_directory } 50 | it { should be_owned_by 'oracle' } 51 | it { should be_grouped_into 'oinstall' } 52 | end 53 | 54 | describe file('/opt/oracle/middleware_1213') do 55 | it { should be_directory } 56 | it { should be_owned_by 'oracle' } 57 | it { should be_grouped_into 'oinstall' } 58 | end 59 | 60 | describe file('/opt/oracle/middleware_1213/oracle_common/common/bin/wlst.sh') do 61 | it { should be_file } 62 | it { should be_owned_by 'oracle' } 63 | it { should be_grouped_into 'oinstall' } 64 | it { should be_executable } 65 | end 66 | 67 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_sol/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_win/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_inst::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_win/serverspec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::install' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | describe file('c:\\java\\jdk1.7.0_79') do 9 | it { should be_directory } 10 | end 11 | 12 | describe file('c:\\java\\jdk1.7.0_79\\bin\\java.exe') do 13 | it { should be_file } 14 | end 15 | 16 | describe file('C:/Users/vagrant/AppData/Local/temp/wls_12c.rsp') do 17 | it { should be_file } 18 | it { should contain 'INSTALL_TYPE=WebLogic Server' } 19 | end 20 | 21 | describe file('C:\\Program Files\\Oracle\\Inventory') do 22 | it { should be_directory } 23 | end 24 | 25 | describe file('C:/oracle/middleware_1213') do 26 | it { should be_directory } 27 | end 28 | 29 | describe file('C:/oracle/middleware_1213/oracle_common/common/bin/wlst.cmd') do 30 | it { should be_file } 31 | end 32 | 33 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1213_win/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :cmd 4 | set :os, :family => 'windows' -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1221/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'fmw_wls::default' do 4 | 5 | # Serverspec examples can be found at 6 | # http://serverspec.org/resource_types.html 7 | 8 | # it 'does something' do 9 | # skip 'Replace this with meaningful tests' 10 | # end 11 | 12 | end -------------------------------------------------------------------------------- /fmw_wls/test/integration/wls1221/serverspec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | --------------------------------------------------------------------------------