-
Notifications
You must be signed in to change notification settings - Fork 38
Ansible task to query and output Oracle DBID after creation #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
014445c
Ansible task to query and output Oracle DBID after creation
sahsagar-google 4d80f21
Adding version dependent variables provisioning pre task
sahsagar-google 616fe26
Adding a dbid logger role and using it in config db role to log DBID …
sahsagar-google 9de8a18
Moving config variables to higher precedence group_vars and moving lo…
sahsagar-google ef17338
Adding a when condition as task is only relevant for GCE
sahsagar-google 4f38e94
Moving the business logic to a new role and calling from config-db.yml
sahsagar-google 2b08abc
Replacing underscore with hyphen in tag to be more consistent
sahsagar-google fd0a215
Adding oracle_home and oracle_sid as facts so the're available for re…
sahsagar-google 2e0da06
Moving vars to group_vars so they are available for config-db.yml
sahsagar-google 6c0455f
Removing unnecessary set facts variables
sahsagar-google c69da52
Removing unecessary environment definition from config db
sahsagar-google 2e9bbf0
Undoing variable move changes since after removing env from config, t…
sahsagar-google 2ee617c
Validating if presence of vars in group_vars succeeds the task
sahsagar-google b712ba4
Removing when conditions from config under the assumption that its RC…
sahsagar-google 20e376e
Adding dbid logging call from RAC config as well
sahsagar-google 0d3d8d7
fixing nit naming comments
sahsagar-google File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
dependencies: | ||
- role: common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
- name: Execute SQL query to get DBID | ||
ansible.builtin.shell: | | ||
set -o pipefail | ||
sqlplus -s / as sysdba <<EOF | ||
SELECT dbid FROM v\$database; | ||
EXIT; | ||
EOF | ||
environment: | ||
ORACLE_HOME: "{{ oracle_home }}" | ||
ORACLE_SID: "{{ oracle_sid }}" | ||
PATH: "{{ oracle_home }}/bin:{{ ansible_env.PATH }}" | ||
register: dbid_query_result | ||
changed_when: false | ||
failed_when: "'ORA-' in dbid_query_result.stderr" | ||
|
||
- name: Extract DBID from query result | ||
ansible.builtin.set_fact: | ||
oracle_dbid: "{{ dbid_query_result.stdout_lines | select('match', '^\\d+$') | first | default('') | trim }}" | ||
|
||
- name: Output DBID | ||
ansible.builtin.debug: | ||
msg: "ORACLE_DBID: {{ oracle_dbid }}" | ||
when: oracle_dbid is defined and oracle_dbid | length > 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.