bewleberkl

Ansible - deploy remote NetBackup client bp.conf changes

Aug 11th, 2019
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. Ansible - deploy remote Linux based NetBackup client bp.conf change (add DB_SCRIPT_PATH directive).
  2.  
  3. 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).
  4.  
  5. But in environments with many master servers, a better solution is to update all at once from an Ansible management node.
  6.  
  7. The following:
  8. - assumes all the Linux (RHEL 7.x) remote NetBackup clients have passwordless SSH configured with Ansible server.
  9. - assumes Ansible server /etc/ansible/hosts 'nbrhelclnts' group contains the list of remote Linux (RHEL 7.x) NetBackup client hostnames
  10. - *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:
  11. DB_SCRIPT_PATH = /u/home/infx/scrips/infx.sh
  12. If the script name differs but the location is uniformly the same for all, just specify the directory, like:
  13. DB_SCRIPT_PATH = /u/home/infx/scrips
  14.  
  15. On the Ansible management node, create a Ansible playbook .yaml file with that includes:
  16. - 'hosts' points to 'nbrhelclnts' (list of NB RHEL client hostnames in /etc/ansible/hosts)
  17. - '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
  18.  
  19. - Ansible playbook /etc/ansible/plybks/bpdotconfupdate.yaml contents:
  20.  
  21. ---
  22. - hosts: nbrhelclnts
  23. remote_user: root
  24. #vars:
  25. #backup_server: <server>
  26.  
  27. tasks:
  28. - name: Backup existing bp.conf file
  29. command: cp -f /usr/openv/netbackup/bp.conf /usr/openv/netbackup/bp.conf.bak
  30.  
  31. - name: Append new entry to bottom of bp.conf file
  32. command: sed -i '$ a DB_SCRIPT_PATH = /u/home/infx/scrips/infx.sh' /usr/openv/netbackup/bp.conf
  33. args:
  34. warn: false # set warn=false to prevent warning
  35.  
  36. - name: Validate changes
  37. shell: tail -n 1 /usr/openv/netbackup/bp.conf | grep DB_SCRIPT_PATH
  38. register: status
  39. ignore_errors: yes
  40.  
  41. - name: revert changes if previous command fails
  42. command: cp -f /usr/openv/netbackup/bp.conf.bak /usr/openv/netbackup/bp.conf
  43. when: status == 1
  44.  
  45.  
  46. To execute, from the Ansible management node, run:
  47. # ansible-playbook bpdotconfupdate.yaml
Add Comment
Please, Sign In to add comment