diff --git a/playbook.yml b/playbook.yml index b664354..0acce66 100644 --- a/playbook.yml +++ b/playbook.yml @@ -17,7 +17,8 @@ # - filesystem # - ora_inst_ahf # - db1913 - - tvd +# - tvd + - restconfig #handlers: #- name: stopALL diff --git a/roles/restconfig/README.md b/roles/restconfig/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/restconfig/README.md @@ -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). diff --git a/roles/restconfig/defaults/main.yml b/roles/restconfig/defaults/main.yml new file mode 100644 index 0000000..e14d778 --- /dev/null +++ b/roles/restconfig/defaults/main.yml @@ -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 diff --git a/roles/restconfig/handlers/main.yml b/roles/restconfig/handlers/main.yml new file mode 100644 index 0000000..720b1aa --- /dev/null +++ b/roles/restconfig/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ora_inst_ahf \ No newline at end of file diff --git a/roles/restconfig/meta/main.yml b/roles/restconfig/meta/main.yml new file mode 100644 index 0000000..3a212a9 --- /dev/null +++ b/roles/restconfig/meta/main.yml @@ -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. + \ No newline at end of file diff --git a/roles/restconfig/tasks/.main.yml.swp b/roles/restconfig/tasks/.main.yml.swp new file mode 100644 index 0000000..75484fa Binary files /dev/null and b/roles/restconfig/tasks/.main.yml.swp differ diff --git a/roles/restconfig/tasks/main.yml b/roles/restconfig/tasks/main.yml new file mode 100644 index 0000000..3ae05eb --- /dev/null +++ b/roles/restconfig/tasks/main.yml @@ -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 }}" diff --git a/roles/restconfig/templates/sqlnet.ora b/roles/restconfig/templates/sqlnet.ora new file mode 100644 index 0000000..5fe3b80 --- /dev/null +++ b/roles/restconfig/templates/sqlnet.ora @@ -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 diff --git a/roles/restconfig/templates/tnsnames.ora b/roles/restconfig/templates/tnsnames.ora new file mode 100644 index 0000000..cd47b1b --- /dev/null +++ b/roles/restconfig/templates/tnsnames.ora @@ -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) + ) + ) + diff --git a/roles/restconfig/tests/inventory b/roles/restconfig/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/restconfig/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/restconfig/tests/test.yml b/roles/restconfig/tests/test.yml new file mode 100644 index 0000000..bda287c --- /dev/null +++ b/roles/restconfig/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ora_inst_ahf \ No newline at end of file diff --git a/roles/restconfig/vars/main.yml b/roles/restconfig/vars/main.yml new file mode 100644 index 0000000..2698ce9 --- /dev/null +++ b/roles/restconfig/vars/main.yml @@ -0,0 +1,3 @@ +--- +# vars file for restconfig + diff --git a/roles/test/README.md b/roles/test/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/test/README.md @@ -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). diff --git a/roles/test/defaults/main.yml b/roles/test/defaults/main.yml new file mode 100644 index 0000000..e14d778 --- /dev/null +++ b/roles/test/defaults/main.yml @@ -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 diff --git a/roles/test/handlers/main.yml b/roles/test/handlers/main.yml new file mode 100644 index 0000000..720b1aa --- /dev/null +++ b/roles/test/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ora_inst_ahf \ No newline at end of file diff --git a/roles/test/meta/main.yml b/roles/test/meta/main.yml new file mode 100644 index 0000000..3a212a9 --- /dev/null +++ b/roles/test/meta/main.yml @@ -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. + \ No newline at end of file diff --git a/roles/test/tasks/main.yml b/roles/test/tasks/main.yml new file mode 100644 index 0000000..fdff395 --- /dev/null +++ b/roles/test/tasks/main.yml @@ -0,0 +1,6 @@ +--- + - name: Ansible replace orahometab Version + replace: + path: /opt/oracle/trivadis/local/dba/etc/orahometab + regexp: 'rdbms19' + replace: "rdbms1913" diff --git a/roles/test/templates/sqlnet.ora b/roles/test/templates/sqlnet.ora new file mode 100644 index 0000000..5fe3b80 --- /dev/null +++ b/roles/test/templates/sqlnet.ora @@ -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 diff --git a/roles/test/templates/tnsnames.ora b/roles/test/templates/tnsnames.ora new file mode 100644 index 0000000..cd47b1b --- /dev/null +++ b/roles/test/templates/tnsnames.ora @@ -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) + ) + ) + diff --git a/roles/test/tests/inventory b/roles/test/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/test/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/test/tests/test.yml b/roles/test/tests/test.yml new file mode 100644 index 0000000..bda287c --- /dev/null +++ b/roles/test/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ora_inst_ahf \ No newline at end of file diff --git a/roles/tvd/tasks/.main.yml.swp b/roles/test/vars/.main.yml.swp similarity index 76% rename from roles/tvd/tasks/.main.yml.swp rename to roles/test/vars/.main.yml.swp index dcd7901..a5eb37f 100644 Binary files a/roles/tvd/tasks/.main.yml.swp and b/roles/test/vars/.main.yml.swp differ diff --git a/roles/test/vars/main.yml b/roles/test/vars/main.yml new file mode 100644 index 0000000..26e41f2 --- /dev/null +++ b/roles/test/vars/main.yml @@ -0,0 +1,5 @@ +--- +# vars file for TVD +agent_pwd: tibagent +agent_mail: MailAddress="STUTTGART.PTLS.ABT2.REF24.UNIX.DB-ADMIN@polizei.bwl.de" + diff --git a/roles/tvd/tasks/main.yml b/roles/tvd/tasks/main.yml index 07bb14e..436d4b6 100644 --- a/roles/tvd/tasks/main.yml +++ b/roles/tvd/tasks/main.yml @@ -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" + diff --git a/roles/tvd/vars/main.yml b/roles/tvd/vars/main.yml index 144e6b8..6888416 100644 --- a/roles/tvd/vars/main.yml +++ b/roles/tvd/vars/main.yml @@ -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"