Ansible 自动化运维利器
【原创】为什么我一定要流程化和自动化
你不可能事情既要办得对,又要快速及时,还要一直投入人力,时间和精力。
《极客与团队》中也提到“人就是一个间歇性发生变化的bug”,人有悲欢离合,喜怒哀乐,也有七情六欲,不能指望一个人可以持续专一,准确无误的操作,所以只有机器+流程自动化,才能够保持可靠性。
安装python和pip
dnf -y install epel-release dnf makecache --refresh dnf install -y python3 python3-pip pip install ansible
ansible简易配置文件
[defaults] inventory = /root/list_hosts remote_tmp = $HOME/.ansible/tmp pattern = * forks = 5 poll_interval = 15 sudo_user = root transport = smart remote_port = 22 module_lang = C gathering = implicit host_key_checking = False sudo_exe = sudo timeout = 30 module_name = shell deprecation_warnings = False fact_caching = memory private_key_file = /root/.ssh/hzup.ssh [ssh_connection] ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [accelerate] accelerate_port = 5099 accelerate_timeout = 30 accelerate_connect_timeout = 5.0 accelerate_daemon_timeout = 30
ansible playbook
面对成千上万台服务器,如何使用开源工具做集群管理和升级,维护,如何打造自己的CMDB运维、资产管理平台?