From 37f5b7a78785f045ba6dbfb14655661027639530 Mon Sep 17 00:00:00 2001 From: support Date: Sat, 27 Jun 2026 10:42:03 +0200 Subject: [PATCH] 2026-06-27 08:42:02 --- ansible/swgalaxy/ansible.cfg | 9 ++ .../swgalaxy/inventories/production/hosts.yml | 8 ++ .../playbooks/ora_standalone_patch.yml | 99 +++++++++++++++++++ ansible/swgalaxy/requirements.yml | 3 + ansible/swgalaxy/resume.txt | 2 + bash/corellia_backup_VM.sh | 4 +- 6 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 ansible/swgalaxy/ansible.cfg create mode 100644 ansible/swgalaxy/inventories/production/hosts.yml create mode 100644 ansible/swgalaxy/playbooks/ora_standalone_patch.yml create mode 100644 ansible/swgalaxy/requirements.yml create mode 100644 ansible/swgalaxy/resume.txt diff --git a/ansible/swgalaxy/ansible.cfg b/ansible/swgalaxy/ansible.cfg new file mode 100644 index 0000000..6b04b6a --- /dev/null +++ b/ansible/swgalaxy/ansible.cfg @@ -0,0 +1,9 @@ +[defaults] +inventory = inventories +roles_path = ./roles +host_key_checking = False +retry_files_enabled = False +nocows = 1 + +[ssh_connection] +ssh_args = -o ControlMaster=auto -o ControlPersist=60s diff --git a/ansible/swgalaxy/inventories/production/hosts.yml b/ansible/swgalaxy/inventories/production/hosts.yml new file mode 100644 index 0000000..19f1709 --- /dev/null +++ b/ansible/swgalaxy/inventories/production/hosts.yml @@ -0,0 +1,8 @@ +all: + children: + oracle_standalone_fs: + hosts: + togoria: + ansible_host: togoria.swgalaxy + ansible_user: root + ansible_python_interpreter: /usr/bin/python3.9 diff --git a/ansible/swgalaxy/playbooks/ora_standalone_patch.yml b/ansible/swgalaxy/playbooks/ora_standalone_patch.yml new file mode 100644 index 0000000..7a3bde5 --- /dev/null +++ b/ansible/swgalaxy/playbooks/ora_standalone_patch.yml @@ -0,0 +1,99 @@ +--- +# Playbook: ora_standalone_patch.yml +# Usage: ansible-playbook playbooks/ora_standalone_patch.yml -e "server=togoria oracle_sid=NABOOPRD opatch_zip=/mnt/yavin4/kit/Oracle/opatch/p6880880_190000_Linux-x86-64.zip dbru_zip=/mnt/yavin4/kit/Oracle/Oracle_Database_19/patch/GIRU_19.29/p38298204_190000_Linux-x86-64.zip" + +- name: Gather facts for a specific inventory host + hosts: "{{ server }}" + gather_facts: yes + become: true + become_user: oracle + become_method: su + + pre_tasks: + - name: Ensure 'server' variable is provided + assert: + that: server is defined + fail_msg: "Please provide the server via -e 'server='" + + - name: Ensure 'oracle_sid' variable is provided + assert: + that: oracle_sid is defined + fail_msg: "Please provide the oracle_sid via -e 'oracle_sid='" + + - name: Ensure 'opatch_zip' variable is provided + assert: + that: opatch_zip is defined + fail_msg: "Please provide the opatch_zip via -e 'opatch_zip='" + + - name: Ensure 'dbru_zip' variable is provided + assert: + that: dbru_zip is defined + fail_msg: "Please provide the dbru_zip via -e 'dbru_zip='" + + tasks: + - name: Show selected system facts + debug: + msg: + hostname: "{{ (ansible_facts.nodename | default(ansible_facts.hostname)) | default('unknown') }}" + os_family: "{{ ansible_facts.os_family | default(ansible_facts.distribution | default('unknown')) }}" + operating_system: "{{ ansible_facts.distribution | default('unknown') }} {{ ansible_facts.distribution_version | default('') }}" + ip_address: "{{ ansible_default_ipv4.address | default('unknown') }}" + hardware_model: "{{ ansible_facts['machine'] | default('unknown') }}" + cpu_count: "{{ ansible_facts['processor_vcpus'] | default(ansible_facts['processor_count'] | default('unknown')) }}" + ram_gb: "{{ (ansible_facts['memtotal_mb'] / 1024) | int | default('unknown') }}" + + - name: Source oraenv and display OPatch informations + shell: | + . oraenv <<< {{ oracle_sid }} && $ORACLE_HOME/OPatch/opatch version && echo && echo && $ORACLE_HOME/OPatch/opatch lspatches + register: opatch_output + when: oracle_sid is defined + + - name: Display OPatch directory contents + debug: + var: opatch_output.stdout_lines + when: oracle_sid is defined + + # - name: Remove /app/oracle/staging_area if present + # file: + # path: /app/oracle/staging_area + # state: absent + + # - name: Recreate /app/oracle/staging_area + # file: + # path: /app/oracle/staging_area + # state: directory + # mode: '0755' + + # - name: Check local zip path exists on controller (only if provided) + # stat: + # path: "{{ dbru_zip }}" + # delegate_to: localhost + # run_once: true + # register: local_zip_stat + # when: dbru_zip is defined + + # - name: Fail if local zip file not found on controller + # fail: + # msg: "Local zip file {{ dbru_zip }} not found on controller" + # when: dbru_zip is defined and (local_zip_stat.stat is not defined or not local_zip_stat.stat.exists) + # run_once: true + + # - name: Copy local zip file to remote staging_area + # copy: + # src: "{{ dbru_zip }}" + # dest: "/app/oracle/staging_area/{{ dbru_zip | basename }}" + # mode: '0644' + # when: dbru_zip is defined + + # - name: Unarchive uploaded zip into staging_area + # unarchive: + # src: "/app/oracle/staging_area/{{ dbru_zip | basename }}" + # dest: /app/oracle/staging_area + # remote_src: yes + # when: dbru_zip is defined + + # - name: Remove uploaded zip from remote staging_area + # file: + # path: "/app/oracle/staging_area/{{ dbru_zip | basename }}" + # state: absent + # when: dbru_zip is defined diff --git a/ansible/swgalaxy/requirements.yml b/ansible/swgalaxy/requirements.yml new file mode 100644 index 0000000..c85aa88 --- /dev/null +++ b/ansible/swgalaxy/requirements.yml @@ -0,0 +1,3 @@ +# Add role requirements for ansible-galaxy here, e.g. +# - src: geerlingguy.nginx +# version: "~=3.0" diff --git a/ansible/swgalaxy/resume.txt b/ansible/swgalaxy/resume.txt new file mode 100644 index 0000000..787b4f0 --- /dev/null +++ b/ansible/swgalaxy/resume.txt @@ -0,0 +1,2 @@ +copilot --resume=30d6cbea-6a36-4abd-b647-c46e990a842d + diff --git a/bash/corellia_backup_VM.sh b/bash/corellia_backup_VM.sh index 3a543f7..b568fd8 100644 --- a/bash/corellia_backup_VM.sh +++ b/bash/corellia_backup_VM.sh @@ -5,10 +5,10 @@ set -u # no unset vars # Configuration ######################## -SECONDS_WAIT=60 +SECONDS_WAIT=180 DESTINATION_DIR="/mnt/unprotected/tmp/VM/backup/corellia" VMHOME="/vm/ssd0/" # base dir for VM data; adapt as needed -DAYS_TO_KEEP_VM_BACKUP=60 +DAYS_TO_KEEP_VM_BACKUP=45 MAIL_TO="vplesnila@gmail.com" MAIL_FROM="plesnila.valeriu@orange.fr" MAIL_SUBJECT_OK="VM backup success"