TVD in einer Rolle - Restkonfiguration Server begonnen

This commit is contained in:
aschwarz 2022-11-23 11:18:36 +01:00
parent b48ef40e6a
commit 958ce2c41e
25 changed files with 492 additions and 2 deletions

View File

@ -17,7 +17,8 @@
# - filesystem
# - ora_inst_ahf
# - db1913
- tvd
# - tvd
- restconfig
#handlers:
#- name: stopALL

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,10 @@
---
# defaults file for ora_inst_ahf
# variables
os_distrib: RedHat # Actually, not only RH, but also OEL, SuSE, Solaris ...
ahf_archive_repo: /sw/oracle/DB/linux
ahf_archive_dir: AHF-LINUX_v22.2.4
ahf_archive_name: AHF-LINUX_v22.2.4.zip # Downloadable on MOS note 30166242
ahf_archive_version: "{{ (ahf_archive_name | regex_replace('v|.zip', '_')).split('_')[2] }}"
ahf_install_dir: /opt

View File

@ -0,0 +1,2 @@
---
# handlers file for ora_inst_ahf

View File

@ -0,0 +1,53 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

Binary file not shown.

View File

@ -0,0 +1,112 @@
---
# tasks file restconfig
- name: Create directory for network files
file:
path: /opt/oracle/network
state: directory
owner: oracle
group: dba
mode: '0755'
############################
# copy Basis tnsnames.ora und sqlnet.ora
###########################
- name: copy tnsnames.ora
copy:
src: roles/restconfig/templates/tnsnames.ora
dest: "/opt/oracle/network"
owner: oracle
group: dba
- name: copy sqlnet.ora
copy:
src: roles/restconfig/templates/sqlnet.ora
dest: "/opt/oracle/network"
owner: oracle
group: dba
###################################
# Vorhandene ORACLE_HOMEs einlesen
###################################
- name: Find oracle_homes
find:
paths: /opt/oracle/db
file_type: directory
recurse: no
register: files_matched
############################
# Verlinkung der tnsnnames etc. nach /opt/oracle/network
###########################
- name: linking tnsnames.ora
file:
src: /opt/oracle/network/tnsnames.ora
dest: "{{ item.path }}/network/admin/tnsnames.ora"
force: yes
owner: oracle
group: dba
follow: no
state: link
loop: "{{ files_matched.files|flatten(levels=1) }}"
loop_control:
label: "{{ item.path }}"
- name: linking sqlnet.ora
file:
src: /opt/oracle/network/sqlnet.ora
dest: "{{ item.path }}/network/admin/sqlnet.ora"
force: yes
owner: oracle
group: dba
follow: no
state: link
loop: "{{ files_matched.files|flatten(levels=1) }}"
loop_control:
label: "{{ item.path }}"
- name: linking listener.ora
file:
src: /opt/oracle/network/listener.ora
dest: "{{ item.path }}/network/admin/listener.ora"
force: yes
owner: oracle
group: dba
follow: no
state: link
loop: "{{ files_matched.files|flatten(levels=1) }}"
loop_control:
label: "{{ item.path }}"
############################
# softlinks für Networker anlegen
###########################
- name: Softlink libobk.so im lib der ORACLE_HOMEs anlegen
file:
src: /usr/lib/libnsrora.so
dest: "{{ item.path }}/lib/libobk.so"
force: yes
owner: oracle
group: dba
follow: no
state: link
loop: "{{ files_matched.files|flatten(levels=1) }}"
loop_control:
label: "{{ item.path }}"
##############################
# linking emagent with latest oracle_home
##############################
- name: Find out latest oracle_home
find:
paths: /opt/oracle/db
file_type: directory
recurse: no
register: files
- debug: msg="{{ files.files[1] | sort(attribute='path', reverse=True) | map(attribute='path') | join(',') }}"
- debug: msg="{{ files }}"

View File

@ -0,0 +1,11 @@
# sqlnet.ora Network Configuration File: /opt/oracle/db/12.2.0.1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8
SQLNET.EXPIRE_TIME = 10

View File

@ -0,0 +1,13 @@
# tnsnames.ora Network Configuration File: /opt/oracle/db/19.3/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
RMANDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip-rmandb.polizei-bw.net)(PORT = 1562))
# (ADDRESS = (PROTOCOL = TCP)(HOST = polsq5701bit03.polizei-bw.net)(PORT = 1562))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMANDB)
)
)

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- ora_inst_ahf

View File

@ -0,0 +1,3 @@
---
# vars file for restconfig

38
roles/test/README.md Normal file
View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,10 @@
---
# defaults file for ora_inst_ahf
# variables
os_distrib: RedHat # Actually, not only RH, but also OEL, SuSE, Solaris ...
ahf_archive_repo: /sw/oracle/DB/linux
ahf_archive_dir: AHF-LINUX_v22.2.4
ahf_archive_name: AHF-LINUX_v22.2.4.zip # Downloadable on MOS note 30166242
ahf_archive_version: "{{ (ahf_archive_name | regex_replace('v|.zip', '_')).split('_')[2] }}"
ahf_install_dir: /opt

View File

@ -0,0 +1,2 @@
---
# handlers file for ora_inst_ahf

53
roles/test/meta/main.yml Normal file
View File

@ -0,0 +1,53 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,6 @@
---
- name: Ansible replace orahometab Version
replace:
path: /opt/oracle/trivadis/local/dba/etc/orahometab
regexp: 'rdbms19'
replace: "rdbms1913"

View File

@ -0,0 +1,11 @@
# sqlnet.ora Network Configuration File: /opt/oracle/db/12.2.0.1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8
SQLNET.EXPIRE_TIME = 10

View File

@ -0,0 +1,13 @@
# tnsnames.ora Network Configuration File: /opt/oracle/db/19.3/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
RMANDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip-rmandb.polizei-bw.net)(PORT = 1562))
# (ADDRESS = (PROTOCOL = TCP)(HOST = polsq5701bit03.polizei-bw.net)(PORT = 1562))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMANDB)
)
)

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- ora_inst_ahf

5
roles/test/vars/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
# vars file for TVD
agent_pwd: tibagent
agent_mail: MailAddress="STUTTGART.PTLS.ABT2.REF24.UNIX.DB-ADMIN@polizei.bwl.de"

View File

@ -85,3 +85,94 @@
owner: oracle
group: dba
############################
# "/opt/oracle/trivadis/local/dba/etc/basenv.conf" erweitern
############################
- name: Extents the basenv.conf
blockinfile:
path: /opt/oracle/trivadis/local/dba/etc/basenv.conf
block: |
BE_INITIALSID=
TS_MAILHOST={{ var_mailhost }}
TS_MAILPORT={{ var_mailport }}
TS_MAILUSER="{{ var_mailadress }}"
TS_MAILFROM="{{ var_mailadress }}"
alias vih='vi ${ETC_BASE}/housekeep_work.conf'
- name: Replace Mailadress
replace:
path: /opt/oracle/trivadis/local/dba/etc/basenv.conf
regexp: '^TNS_ADMIN.*'
replace: "TNS_ADMIN=/opt/oracle/network"
###########################
# TibAgent anpassen
###########################
- name: copy tibagent.conf
copy:
src: /opt/oracle/trivadis/local/tvdbackup/etc/tibagent.conf.example
dest: /opt/oracle/trivadis/local/tvdbackup/etc/tibagent.conf
owner: oracle
group: dba
remote_src: yes
- name: Replace Agent Login
replace:
path: /opt/oracle/trivadis/local/tvdbackup/etc/tibagent.conf
regexp: '^BackupSchedulerCred.*'
replace: 'BackupSchedulerCred="TIBAGENT/{{ agent_pwd }}@RMANDB"'
- name: Replace Mailadress
replace:
path: /opt/oracle/trivadis/local/tvdbackup/etc/tibagent.conf
regexp: '^# MailAddress=.*'
replace: "{{ agent_mail }}"
- name: Tibagent starten
become: yes
become_user: oracle
shell: "/opt/oracle/trivadis/local/tvdbackup/bin/tibagent.ksh start"
###########################
# orahometab Version anpassen
###########################
- name: Ansible replace orahometab Version
replace:
path: /opt/oracle/trivadis/local/dba/etc/orahometab
regexp: 'rdbms19;'
replace: "rdbms1913;"
- name: Ansible replace orahometab Version
replace:
path: /opt/oracle/trivadis/local/dba/etc/orahometab
regexp: 'rdbms19$'
replace: "rdbms1913"
###########################
# Watchdog for TVD Agent
###########################
- name: Get current version of RDBMS
shell: "set -o pipefail && cat /opt/oracle/trivadis/local/dba/etc/orahometab | cut -d';' -f7 | tail -n 1"
register: rdbms_current_version
#- debug:
# var: rdbms_current_version.stdout
# copy anstelle touch und Text anfuegen
- name: Creates watchdog for TVD Agent
copy:
dest: "/opt/oracle/trivadis/local/dba/etc/run_watchdog.ksh"
content: |
#!/bin/ksh
. /opt/oracle/trivadis/local/dba/bin/basenv.ksh
. oraenv.ksh {{ rdbms_current_version.stdout }}
/opt/oracle/trivadis/local/tvdbackup/bin/tibagent.ksh watchdog
- name: Creates watchdog cronjob
cron:
name: "Watchdog alles 2 Minuten pruefen"
minute: "*/2"
job: "/opt/oracle/trivadis/local/dba/etc/run_watchdog.ksh"

View File

@ -5,4 +5,8 @@ oracle_home: /opt/oracle/db/19.13
install_dir: /sw/TVD/2205/dbstar_basenv_22.05.final.a
backup_install_dir: /sw/TVD/2205/dbstar_backup_22.05.final.a/tvdbackup-ee-22.05.final.a.tar.gz
backup_target_Dir: /opt/oracle/trivadis/local
var_mailhost: 80.155.155.90
var_mailport: 25
var_mailadress: STUTTGART.PTLS.ABT2.REF24.UNIX.DB-ADMIN@polizei.bwl.de
agent_pwd: tibagent
agent_mail: MailAddress="STUTTGART.PTLS.ABT2.REF24.UNIX.DB-ADMIN@polizei.bwl.de"