From 860b29a1620de09d00673abbd4bfb42c4b741067 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Wed, 17 Jan 2024 21:38:52 +0000 Subject: [PATCH] pre-commit: Multiple changes for pre-commit run --all --- CHANGELOG.md | 1 - README-ansible.adoc | 2 +- changelogs/fragments/pre-commit.yml | 3 ++ clean.sh | 1 + doc/guides/advanced.adoc | 2 +- doc/guides/beginner.adoc | 2 +- .../inventory/group_vars/all/db-homes.yml | 0 .../inventory/group_vars/all/software_src.yml | 0 .../databases.yml | 0 example/beginner/ansible/inventory/hosts.yml | 0 plugins/modules/README.md | 2 - plugins/modules/oracle_gi_facts.py | 2 +- plugins/modules/test-modules.yml | 50 +++++++++---------- roles/common/templates/motd.j2 | 2 +- roles/oradb_manage_db/LISTENER.md | 2 +- roles/oradb_manage_db/templates/pdb.sql.j2 | 2 +- .../templates/parameter_fra_disk.rman.j2 | 1 - .../templates/parameter_rac.rman.j2 | 1 - roles/orahost/templates/motd.j2 | 2 +- .../templates/oracle_cleanup.j2 | 2 - roles/oraswdb_install/templates/dbora.j2 | 1 - .../templates/dotprofile-home.j2 | 2 +- tools/ansible/install_ansible.sh | 2 +- tools/dev/install_collection.sh | 4 +- vagrant/dbfs/Vagrantfile | 2 +- vagrant/has/Vagrantfile | 4 +- 26 files changed, 43 insertions(+), 49 deletions(-) create mode 100644 changelogs/fragments/pre-commit.yml mode change 100755 => 100644 example/beginner/ansible/inventory/group_vars/all/db-homes.yml mode change 100755 => 100644 example/beginner/ansible/inventory/group_vars/all/software_src.yml mode change 100755 => 100644 example/beginner/ansible/inventory/host_vars/beginner-dbfs-151-192-168-56-161.nip.io/databases.yml mode change 100755 => 100644 example/beginner/ansible/inventory/hosts.yml mode change 100755 => 100644 plugins/modules/test-modules.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d4f0618..e3c8bc366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,4 +31,3 @@ 2014-09-25 - Added support for 11.2.0.4 - diff --git a/README-ansible.adoc b/README-ansible.adoc index f80b0c2de..4a3266823 100644 --- a/README-ansible.adoc +++ b/README-ansible.adoc @@ -40,4 +40,4 @@ IMPORTANT: `ansible-oracle` is designed to run as a container. cd docker docker-compose run --rm ansible bash ansible-galaxy collection install -r requirements.yml ----- \ No newline at end of file +---- diff --git a/changelogs/fragments/pre-commit.yml b/changelogs/fragments/pre-commit.yml new file mode 100644 index 000000000..6a9692fa8 --- /dev/null +++ b/changelogs/fragments/pre-commit.yml @@ -0,0 +1,3 @@ +--- +trivial: + - "pre-commit: Multiple changes for pre-commit run --all (oravirt#399)" diff --git a/clean.sh b/clean.sh index 9bcfe7499..caa21cbf1 100755 --- a/clean.sh +++ b/clean.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash ansible orarac02 -a "/u01/app/12.1.0.2/grid/crs/install/rootcrs.pl -deconfig -force" -u root ansible orarac01 -a "/u01/app/12.1.0.2/grid/crs/install/rootcrs.pl -deconfig -force -lastnode" -u root ansible orarac02 -a "/u01/app/12.1.0.1/grid/crs/install/rootcrs.pl -deconfig -force" -u root diff --git a/doc/guides/advanced.adoc b/doc/guides/advanced.adoc index 5c5c877cf..a20f9b3a7 100644 --- a/doc/guides/advanced.adoc +++ b/doc/guides/advanced.adoc @@ -171,7 +171,7 @@ ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-gal .Example [auote, output] ---- -ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml +ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml Starting galaxy collection install process Process install dependency map Starting collection install process diff --git a/doc/guides/beginner.adoc b/doc/guides/beginner.adoc index e784c95cf..d51642f2e 100644 --- a/doc/guides/beginner.adoc +++ b/doc/guides/beginner.adoc @@ -145,7 +145,7 @@ ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-gal .Example [auote, output] ---- -ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml +ansible@ansible-oracle:/git/ansible-oracle/example/beginner/ansible$ ansible-galaxy collection install -r requirements.yml Starting galaxy collection install process Process install dependency map Starting collection install process diff --git a/example/beginner/ansible/inventory/group_vars/all/db-homes.yml b/example/beginner/ansible/inventory/group_vars/all/db-homes.yml old mode 100755 new mode 100644 diff --git a/example/beginner/ansible/inventory/group_vars/all/software_src.yml b/example/beginner/ansible/inventory/group_vars/all/software_src.yml old mode 100755 new mode 100644 diff --git a/example/beginner/ansible/inventory/host_vars/beginner-dbfs-151-192-168-56-161.nip.io/databases.yml b/example/beginner/ansible/inventory/host_vars/beginner-dbfs-151-192-168-56-161.nip.io/databases.yml old mode 100755 new mode 100644 diff --git a/example/beginner/ansible/inventory/hosts.yml b/example/beginner/ansible/inventory/hosts.yml old mode 100755 new mode 100644 diff --git a/plugins/modules/README.md b/plugins/modules/README.md index aedf0fc2d..92812a7d8 100644 --- a/plugins/modules/README.md +++ b/plugins/modules/README.md @@ -190,5 +190,3 @@ pre-rec: cx_Oracle - Create/remove databases (cdb/non-cdb) - Can be created by passing in a responsefile or just by using parameters - - diff --git a/plugins/modules/oracle_gi_facts.py b/plugins/modules/oracle_gi_facts.py index 9f93d8f28..a8146238d 100644 --- a/plugins/modules/oracle_gi_facts.py +++ b/plugins/modules/oracle_gi_facts.py @@ -53,7 +53,7 @@ except ImportError: # pragma: no cover # python 2.6 doesn't include check_output # monkey patch it in! - import subprocess + # import subprocess STDOUT = subprocess.STDOUT diff --git a/plugins/modules/test-modules.yml b/plugins/modules/test-modules.yml old mode 100755 new mode 100644 index 822bab188..0c4ec378d --- a/plugins/modules/test-modules.yml +++ b/plugins/modules/test-modules.yml @@ -4,8 +4,8 @@ user: vagrant sudo: yes sudo_user: oracle - gather_facts: false - + gather_facts: false + vars: oracle_home: /u01/app/oracle/11.2.0.4/home1 @@ -22,46 +22,46 @@ set_init: False restart_db: False init_parameters: - - { name: db_recovery_file_dest_size, value: 4G, state: present, scope: both } - - { name: db_recovery_file_dest, value: '+FRA', state: present, scope: both } - - { name: pga_aggregate_target, value: 300M, state: present, scope: both } - - { name: _parallel_statement_queuing, value: true, state: present, scope: both } - - { name: sga_target, value: 900M, state: present, scope: spfile } - - { name: sga_max_size, value: 900M, state: present, scope: spfile } - - { name: open_cursors, value: 400, state: present, scope: both } - - { name: processes, value: 700, state: present, scope: spfile } - - { name: log_archive_dest_2, value: 'service=hippie2, LGWR ASYNC NOAFFIRM db_unique_name=hippie2 valid_for=(online_logfile,primary_role)', state: present, scope: both } + - { name: db_recovery_file_dest_size, value: 4G, state: present, scope: both } + - { name: db_recovery_file_dest, value: '+FRA', state: present, scope: both } + - { name: pga_aggregate_target, value: 300M, state: present, scope: both } + - { name: _parallel_statement_queuing, value: true, state: present, scope: both } + - { name: sga_target, value: 900M, state: present, scope: spfile } + - { name: sga_max_size, value: 900M, state: present, scope: spfile } + - { name: open_cursors, value: 400, state: present, scope: both } + - { name: processes, value: 700, state: present, scope: spfile } + - { name: log_archive_dest_2, value: 'service=hippie2, LGWR ASYNC NOAFFIRM db_unique_name=hippie2 valid_for=(online_logfile,primary_role)', state: present, scope: both } tablespaces: - - { name: newtbs, datafile: '+DATA', size: 5M, bigfile: True, autoextend: false , next: 5M, maxsize: 500M, content: permanent, state: present } - - { name: newundo, datafile: '+DATA', size: 5M, bigfile: false, autoextend: true, next: 5M, maxsize: 500M, content: undo, state: present } - - { name: newtemp, datafile: '+DATA', size: 5M, bigfile: false, autoextend: on, next: 5M, maxsize: 500M, content: temp, state: present } + - { name: newtbs, datafile: '+DATA', size: 5M, bigfile: True, autoextend: false , next: 5M, maxsize: 500M, content: permanent, state: present } + - { name: newundo, datafile: '+DATA', size: 5M, bigfile: false, autoextend: true, next: 5M, maxsize: 500M, content: undo, state: present } + - { name: newtemp, datafile: '+DATA', size: 5M, bigfile: false, autoextend: on, next: 5M, maxsize: 500M, content: temp, state: present } dba_user: - schema: dbauser schema_password_hash: B7C930D09B3AF263 # passwd = dbauser state: present default_tablespace: users - grants: + grants: - "dba" passw_user: - - schema: userpw + - schema: userpw schema_password: userpw state: present default_tablespace: newtbs - grants: + grants: - "approle1" roles: - name: approle1 - role_grants: + role_grants: - 'create session' - 'select any table' state: present - + tasks: @@ -72,7 +72,7 @@ with_items: tablespaces - name: Create application role - oracle_role: hostname={{ hostname }} service_name={{ service_name }} user={{ user }} password={{ password }} role={{ item.name }} state={{ item.state }} + oracle_role: hostname={{ hostname }} service_name={{ service_name }} user={{ user }} password={{ password }} role={{ item.name }} state={{ item.state }} environment: oracle_env with_items: roles @@ -80,14 +80,14 @@ - name: Add grants to role oracle_grants: hostname={{ hostname }} service_name={{ service_name }} user={{ user }} password={{ password }} role={{ item.0.name }} grants="{{ item.1 }}" state={{ item.0.state }} environment: oracle_env - with_subelements: + with_subelements: - roles - role_grants - name: Create DBA user oracle_user: hostname={{ hostname }} service_name={{ service_name }} mode=normal user={{ user }} password={{ password }} schema={{ item.0.schema }} schema_password_hash={{ item.0.schema_password_hash }} state={{ item.0.state }} default_tablespace={{ item.0.default_tablespace }} grants={{ item.1 }} environment: oracle_env - with_subelements: + with_subelements: - dba_user - grants @@ -95,7 +95,7 @@ - name: Create Application user oracle_user: hostname={{ hostname }} service_name={{ service_name }} mode=normal user={{ user }} password={{ password }} schema={{ item.0.schema }} schema_password={{ item.0.schema_password }} state={{ item.0.state }} default_tablespace={{ item.0.default_tablespace }} grants={{ item.1 }} environment: oracle_env - with_subelements: + with_subelements: - passw_user - grants @@ -128,7 +128,3 @@ with_items: check_db_up.stdout_lines when: restart_db tags: check - - - - diff --git a/roles/common/templates/motd.j2 b/roles/common/templates/motd.j2 index 3b7c5ab78..22405f35b 100644 --- a/roles/common/templates/motd.j2 +++ b/roles/common/templates/motd.j2 @@ -7,7 +7,7 @@ FQDN: {{ ansible_fqdn }} IP's: {% for a in ansible_interfaces %} {% if a != 'lo' %} -{{a}}: {{ hostvars[inventory_hostname]['ansible_'~a]['ipv4']['address'] }} +{{a}}: {{ hostvars[inventory_hostname]['ansible_'~a]['ipv4']['address'] }} {% endif %} {% endfor %} diff --git a/roles/oradb_manage_db/LISTENER.md b/roles/oradb_manage_db/LISTENER.md index ca9084948..afe2224a3 100644 --- a/roles/oradb_manage_db/LISTENER.md +++ b/roles/oradb_manage_db/LISTENER.md @@ -47,7 +47,7 @@ listener_installed: listener_name: LISTENER1523 state: present -oracle_databases: +oracle_databases: - home: 18300-base oracle_db_name: cdb183 listener_name: LISTENER diff --git a/roles/oradb_manage_db/templates/pdb.sql.j2 b/roles/oradb_manage_db/templates/pdb.sql.j2 index 31b3d774d..ae74b3bf1 100644 --- a/roles/oradb_manage_db/templates/pdb.sql.j2 +++ b/roles/oradb_manage_db/templates/pdb.sql.j2 @@ -7,4 +7,4 @@ col global_name noprint select upper(sys_context ('userenv', 'session_user') || ' @ ' ||sys_context ('userenv', 'instance_name') || ':' || sys_context('userenv', 'con_name')) global_name from dual; set sqlprompt '&gname:> ' set heading on -set termout on \ No newline at end of file +set termout on diff --git a/roles/oradb_rman/templates/parameter_fra_disk.rman.j2 b/roles/oradb_rman/templates/parameter_fra_disk.rman.j2 index 3832acdf5..f1164d162 100644 --- a/roles/oradb_rman/templates/parameter_fra_disk.rman.j2 +++ b/roles/oradb_rman/templates/parameter_fra_disk.rman.j2 @@ -10,4 +10,3 @@ CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO {{rman_controlfi CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET; CONFIGURE CHANNEL DEVICE TYPE DISK clear; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+{{oracle_dbf_dir_asm}}/{{ item.0.oracle_db_name }}/snapcf_{{ item.0.oracle_db_name }}.f'; - diff --git a/roles/oradb_rman/templates/parameter_rac.rman.j2 b/roles/oradb_rman/templates/parameter_rac.rman.j2 index 58fceacb6..e412d97bc 100644 --- a/roles/oradb_rman/templates/parameter_rac.rman.j2 +++ b/roles/oradb_rman/templates/parameter_rac.rman.j2 @@ -10,4 +10,3 @@ CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO {{rman_controlfi CONFIGURE DEVICE TYPE DISK {{rman_device_type_disk}}; CONFIGURE CHANNEL DEVICE TYPE DISK {{ rman_channel_disk }}; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '{{oracle_dbf_dir_asm}}/%d/snapcf_PLANETP1.f'; # default - diff --git a/roles/orahost/templates/motd.j2 b/roles/orahost/templates/motd.j2 index e468acc12..b47cace91 100644 --- a/roles/orahost/templates/motd.j2 +++ b/roles/orahost/templates/motd.j2 @@ -11,7 +11,7 @@ IP: {{ hostvars[host]['ansible_default_ipv4']['address'] }} Kernel: {{ ansible_kernel }} -#cpu's: {{ ansible_processor_vcpus }} +#cpu's: {{ ansible_processor_vcpus }} mem: {{ ansible_memtotal_mb }} MB diff --git a/roles/orahost_logrotate/templates/oracle_cleanup.j2 b/roles/orahost_logrotate/templates/oracle_cleanup.j2 index 53c7b2980..3b2448b44 100644 --- a/roles/orahost_logrotate/templates/oracle_cleanup.j2 +++ b/roles/orahost_logrotate/templates/oracle_cleanup.j2 @@ -27,5 +27,3 @@ find {{oracle_base}}/diag/asm/*/*/trace -name "*.tr?" -type f -mtime +{{oracle_ # find {{oracle_base}}/diag/tnslsnr/*/*/alert -name "*.xml" -type f -mtime +{{oracle_cleanup_days}} -delete 2>/dev/null - - diff --git a/roles/oraswdb_install/templates/dbora.j2 b/roles/oraswdb_install/templates/dbora.j2 index 3f32aa6af..f6c4ea9d4 100755 --- a/roles/oraswdb_install/templates/dbora.j2 +++ b/roles/oraswdb_install/templates/dbora.j2 @@ -42,4 +42,3 @@ case $1 in esac exit - diff --git a/roles/oraswdb_install/templates/dotprofile-home.j2 b/roles/oraswdb_install/templates/dotprofile-home.j2 index 8285a8bb0..1365b128c 100644 --- a/roles/oraswdb_install/templates/dotprofile-home.j2 +++ b/roles/oraswdb_install/templates/dotprofile-home.j2 @@ -38,4 +38,4 @@ export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH:$SQLPATH:$GG_HOME/ alias sqlp='. oraenv; rlwrap sqlplus' alias dbh='cd $ORACLE_HOME' alias dbb='cd $ORACLE_BASE' - alias c='clear' \ No newline at end of file + alias c='clear' diff --git a/tools/ansible/install_ansible.sh b/tools/ansible/install_ansible.sh index a3f6cd426..646afb959 100755 --- a/tools/ansible/install_ansible.sh +++ b/tools/ansible/install_ansible.sh @@ -30,7 +30,7 @@ setup_venv() setup_ansible() { echo "Install Ansible with pip3" - echo $workdir + echo "$workdir" pip3 install -r "$workdir/requirements_ansible.txt" } diff --git a/tools/dev/install_collection.sh b/tools/dev/install_collection.sh index 61bcc7d1c..cbb4e5fee 100755 --- a/tools/dev/install_collection.sh +++ b/tools/dev/install_collection.sh @@ -3,6 +3,8 @@ # Install the ansible-oracle collection from current source # set -eu + +# shellcheck disable=SC2086 WORKTDIR="$(dirname ${BASH_SOURCE[0]})/../.." COLLECTION_OUTDIR=/tmp/ansible-oracle-collection @@ -10,7 +12,7 @@ cd "${WORKTDIR}" echo "Working in $(pwd)" test -s "${COLLECTION_OUTDIR}" || mkdir "${COLLECTION_OUTDIR}" -COLLECTION_VERSION=$(cat galaxy.yml | grep "^version: " | cut -d" " -f2) +COLLECTION_VERSION=$(grep "^version: " galaxy.yml | cut -d" " -f2) COLLECTION_ARCHIVE="${COLLECTION_OUTDIR}/opitzconsulting-ansible_oracle-${COLLECTION_VERSION}.tar.gz" echo "COLLECTION_ARCHIVE: ${COLLECTION_ARCHIVE}" diff --git a/vagrant/dbfs/Vagrantfile b/vagrant/dbfs/Vagrantfile index 075155c71..9b2e22844 100644 --- a/vagrant/dbfs/Vagrantfile +++ b/vagrant/dbfs/Vagrantfile @@ -75,7 +75,7 @@ Vagrant.configure("2") do |config| set -e # configure local Nexus-Server when running - # + # os_release=$(grep '^VERSION_ID' /etc/os-release | awk -F'=' ' gsub(/"/,"") { print $2}' | cut -b1) if curl -f -s -q -m 3 http://192.168.56.12:8081/repository/ol${os_release}os-yum-group/ > /dev/null ; then echo "Local Nexus3 Server for yum proxy found!" diff --git a/vagrant/has/Vagrantfile b/vagrant/has/Vagrantfile index 05a121038..344cd7c65 100644 --- a/vagrant/has/Vagrantfile +++ b/vagrant/has/Vagrantfile @@ -18,7 +18,7 @@ Vagrant.configure("2") do |config| config.vm.disk :disk, size: "150GB", name: "#{vm_name}_oracle" config.vm.disk :disk, size: "30GB", name: "#{vm_name}_asmdata1" config.vm.disk :disk, size: "30GB", name: "#{vm_name}_asmfra1" - + # config.disksize.size = '50GB' config.vm.box = "Rendanic/oraclelinux-7.x" @@ -71,7 +71,7 @@ Vagrant.configure("2") do |config| set -e # configure local Nexus-Server when running - # + # os_release=$(grep '^VERSION_ID' /etc/os-release | awk -F'=' ' gsub(/"/,"") { print $2}' | cut -b1) if curl -f -s -q -m 3 http://192.168.56.12:8081/repository/ol${os_release}os-yum-group/ > /dev/null ; then echo "Local Nexus3 Server for yum proxy found!"