Ansible常用操作

hosts

[mysqlserver]
192.168.33.50 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass="ShUnicom"
192.168.33.51 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass="ShUnicom"
192.168.33.52 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass="ShUnicom"

常用命令

ansible mysqlserver --list
ansible webserver -m shell -a 'uptime' -o
ansible all -m ping

ansible ADD_COMPUTE -m ini_file -a "dest=/etc/nova/nova.conf section=DEFAULT option=xx value=true
ansible ADD_COMPUTE -m ini_file -a "dest=/etc/nova/nova.conf section=DEFAULT option=scheduler_default_filters value=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter"

ansible ADD_COMPUTE -m shell -a "systemctl restart xxxx"
systemctl -l |grep -i openstack-nova|awk -F" " '{ print $1 }'|xargs systemctl restart

posted @ 2020-12-02 14:52  8年扛枪梦  阅读(92)  评论(0编辑  收藏  举报