2026-06-27 08:42:02
This commit is contained in:
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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=<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=<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=<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=<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
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Add role requirements for ansible-galaxy here, e.g.
|
||||||
|
# - src: geerlingguy.nginx
|
||||||
|
# version: "~=3.0"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
copilot --resume=30d6cbea-6a36-4abd-b647-c46e990a842d
|
||||||
|
|
||||||
@@ -5,10 +5,10 @@ set -u # no unset vars
|
|||||||
# Configuration
|
# Configuration
|
||||||
########################
|
########################
|
||||||
|
|
||||||
SECONDS_WAIT=60
|
SECONDS_WAIT=180
|
||||||
DESTINATION_DIR="/mnt/unprotected/tmp/VM/backup/corellia"
|
DESTINATION_DIR="/mnt/unprotected/tmp/VM/backup/corellia"
|
||||||
VMHOME="/vm/ssd0/" # base dir for VM data; adapt as needed
|
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_TO="vplesnila@gmail.com"
|
||||||
MAIL_FROM="plesnila.valeriu@orange.fr"
|
MAIL_FROM="plesnila.valeriu@orange.fr"
|
||||||
MAIL_SUBJECT_OK="VM backup success"
|
MAIL_SUBJECT_OK="VM backup success"
|
||||||
|
|||||||
Reference in New Issue
Block a user