CentOS7.5装机必备

C7.5修改主机名

/etc/hostname

 

Chkcofig中只有两个服务

C7.5的服务管理是systemctl

启动systemctl start

关闭systemctl stop

Systemctl disable 关闭服务的开机自启动

Systemctl enable 开启服务的开机自启动

C7.5的防火墙不叫iptables

systemctl stop firewalld关闭防火墙

systemtcl disable firewalld 关闭防火墙开机自启

systemtcl stop NetworkManager

systemctl disable NetworkManager

 

/etc/rc.d/rc.local默认是没有执行权限的,需要手动加755权限

 

需要开机装的:

 

 

Vim /etc/ssh/sshd—config{,.bak}

17行 修改到1w以上即可

38行 是否开启超级用户远程登录,工作中使用普通用户登录

47行 秘钥文件路径

65行 是否开启密码验证

79行 no

115行 no

 

/etc/ansible/hosts

[nginx]

Web01 ansible_ssh_host=192.168.200.127

Web02 ansible_ssh_host=192.168.200.128 ansible_ssh_passwd=308926

 

 

 

Ansible Web01 -m ping 查看与下属服务器的连接情况

Ansible web01 -m shell -a

Ansible all -m shell -a ‘crontab -l’ 查看定时任务

Ansible all -m copy -a ‘src=/mnt/test222 dest=/mnt/’

(src是源,dest是目标)

Ansible all -m copy -a ‘src=/mnt/test222 dest=/mnt/’ backup=yes(遇到同名文件时做备份)

Ansible Web02 -m shell -a ‘chmod +x /mnt/test’

远程给文件加权限

Ansible Web02 -m shell -a ‘/mnt/test’

远程执行脚本

Ansible all -m script -a ‘/mnt/test.sh’

远程执行脚本,但不在对方电脑上留下任何信息

posted @ 2018-11-13 11:00  Lassiter  阅读(378)  评论(0编辑  收藏  举报