Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ansible - deploy remote Linux based NetBackup client bp.conf change (add DB_SCRIPT_PATH directive).
- Starting with NetBackup version 8.1, NetBackup clients running databases to be backed up must either house the database backup script under /usr/openv/netbackup/ext/db_ext/ or append the clienside bp.conf file with the authorized location. This can be accomplished via NetBackup nbsetconfig from the NetBackup master server (see KB https://www.veritas.com/content/support/en_US/article.100039639.html).
- But in environments with many master servers, a better solution is to update all at once from an Ansible management node.
- The following:
- - assumes all the Linux (RHEL 7.x) remote NetBackup clients have passwordless SSH configured with Ansible server.
- - assumes Ansible server /etc/ansible/hosts 'nbrhelclnts' group contains the list of remote Linux (RHEL 7.x) NetBackup client hostnames
- - *hopefully* all RHEL NB clients have been using a standard DB script location, in this example over 300 DB clients were in /u/home/infx/scrips/infx.sh. So we will append this to the client bp.conf file:
- DB_SCRIPT_PATH = /u/home/infx/scrips/infx.sh
- If the script name differs but the location is uniformly the same for all, just specify the directory, like:
- DB_SCRIPT_PATH = /u/home/infx/scrips
- On the Ansible management node, create a Ansible playbook .yaml file with that includes:
- - 'hosts' points to 'nbrhelclnts' (list of NB RHEL client hostnames in /etc/ansible/hosts)
- - 'tasks' 1) backs up client bp.conf; 2) appends DB_SCRIPT_PATH variable to bp.conf; 3) validates the bp.conf change and if in error, reverts to the original backed up copy of bp.conf
- - Ansible playbook /etc/ansible/plybks/bpdotconfupdate.yaml contents:
- ---
- - hosts: nbrhelclnts
- remote_user: root
- #vars:
- #backup_server: <server>
- tasks:
- - name: Backup existing bp.conf file
- command: cp -f /usr/openv/netbackup/bp.conf /usr/openv/netbackup/bp.conf.bak
- - name: Append new entry to bottom of bp.conf file
- command: sed -i '$ a DB_SCRIPT_PATH = /u/home/infx/scrips/infx.sh' /usr/openv/netbackup/bp.conf
- args:
- warn: false # set warn=false to prevent warning
- - name: Validate changes
- shell: tail -n 1 /usr/openv/netbackup/bp.conf | grep DB_SCRIPT_PATH
- register: status
- ignore_errors: yes
- - name: revert changes if previous command fails
- command: cp -f /usr/openv/netbackup/bp.conf.bak /usr/openv/netbackup/bp.conf
- when: status == 1
- To execute, from the Ansible management node, run:
- # ansible-playbook bpdotconfupdate.yaml
Add Comment
Please, Sign In to add comment