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