Renew ansible

Posted on 2025-09-05 09:54  k98091518  阅读(6)  评论(0)    收藏  举报

 

-------------------------CHECKING:----------------------------------


ansible -i in/ocb_inventory all -m shell -a "hostname;uptime;"

ansible -i in/ocb_inventory all -m shell -a "df -Th /opt; df -Th /var; df -Th /usr; vgs"

ansible -i in/ocb_inventory all -m shell -a "cat /etc/fstab | grep cdrom"
ansible -i in/ocb_inventory all -m shell -a "ls -l /etc/yum.repos.d/ "


------------------------Edit---------------------------------------
ansible -i in/ocb_inventory all -m shell -a "lvextend -L 6.0G /dev/mapper/vg0-opt"
ansible -i in/ocb_inventory all -m shell -a "resize2fs /dev/mapper/vg0-opt"
ansible -i in/ocb_inventory 10.10.203.86 -m shell -a "lvextend -L +2G /dev/mapper/vg0-var"
ansible -i in/ocb_inventory 10.10.203.86 -m shell -a "resize2fs /dev/mapper/vg0-var"
ansible -i in/ocb_inventory 10.10.203.88 -m shell -a "lvextend -L +2G /dev/mapper/vg0-var"
ansible -i in/ocb_inventory 10.10.203.88 -m shell -a "resize2fs /dev/mapper/vg0-var"
----------------
ansible -i in/ocb_inventory all -m shell -a "mkdir /etc/yum.repos.d/tmp "
----------------
ansible -i in/ocb_inventory all -m shell -a "subscription-manager unregister"
ansible -i in/ocb_inventory all -m shell -a "subscription-manager clean"
----------------
ansible -i in/ocb_inventory all -m shell -a "cat /etc/environment "
ansible -i in/ocb_inventory all -m shell -a "cp /etc/environment /etc/environment.20250903"
ansible -i in/ocb_inventory all -m shell -a "sed -i '/http_proxy/d' /etc/environment"
ansible -i in/ocb_inventory all -m shell -a "sed -i '/https_proxy/d' /etc/environment"
ansible -i in/ocb_inventory all -m shell -a "sed -i '/no_proxy/d' /etc/environment"
ansible -i in/ocb_inventory all -m shell -a "cat /etc/environment "

ansible -i in/ocb_inventory all -m shell -a "export no_proxy="10.10.243.250,localhost,$HOSTNAME""
ansible -i in/ocb_inventory all -m shell -a "systemctl daemon-reload"

ansible-playbook --ask-vault-pass -i in/ocb_inventory 2.5-rhel_yum_clean.yml
ansible-playbook --ask-vault-pass -i in/ocb_inventory 2.6-rhel_yum_makecache.yml

--------------------Mailx-----------------------
ansible -i in/ocb_inventory all -m yum -a "name=mailx state=latest" --check
ansible -i in/ocb_inventory all -m shell -a "echo 'set from=truesight@shacombank.com.hk' >> /etc/mail.rc"
ansible -i in/ocb_inventory all -m shell -a "echo 'set smtp=smtp://10.10.114.238:25' >> /etc/mail.rc"
ansible -i in/ocb_inventory all -m shell -a "cat /etc/mail.rc "

TSSA Test Inventory Job

ansible-playbook --ask-vault-pass -i in/ocb_inventory 3.0-bash-completion_install.yml
ansible-playbook --ask-vault-pass -i in/ocb_inventory 4.0-Patch_Update.yml --check
ansible-playbook --ask-vault-pass -i in/ocb_inventory 4.0-Patch_Update.yml

ansible -i in/ocb_inventory all -m shell -a "sync; sync; sync; reboot"

ansible-playbook -i in/ocb_inventory 1.1-os_release-check.yml

------------------Mailx----------------------
cd /root

ansible -i in/ocb_inventory all -m yum -a "name=mailx state=latest" --check
ansible -i in/ocb_inventory all -m shell -a "echo 'set from=truesight@shacombank.com.hk' >> /etc/mail.rc"
ansible -i in/ocb_inventory all -m shell -a "echo 'set smtp=smtp://10.10.114.238:25' >> /etc/mail.rc"
ansible -i in/ocb_inventory all -m shell -a "cat /etc/mail.rc "

mailx -v -s "MailxInstall_report_`hostname`_`date '+%Y%m%d %H%M%S'`" kevin.fan@shacombank.com.hk

mailx -v -s "Mailx" kevin.fan@shacombank.com.hk


telnet 10.10.114.238 25