md测试2

 1 ---
 2 - hosts: node4
 3   tasks:
 4 
 5 #   配置SSH无密钥登录
 6   - name: mkdir /root/.ssh
 7     file:
 8       path=/root/.ssh
 9       state=directory
10       mode=700
11       owner=root
12       group=root
13   - name: copy id_rsa.pub
14     copy:
15       src=/root/.ssh/id_rsa.pub
16       dest=/root/.ssh/authorized_keys
17       mode=600
18       owner=root
19       group=root
20 
21 #   优化SSH连接速度--Server端
22   - name: config ssh sever
23     lineinfile:
24       dest=/etc/ssh/sshd_config
25       line='UseDNS no'
26     notify:
27       restart sshd service
28 
29 #   优化SSH连接速度--Client端
30   - name: config ssh client
31     lineinfile:
32       dest=/etc/ssh/ssh_config
33       line='StrictHostKeyChecking no'
34 
35 #   配置阿里云YUM源
36   - name: config aliyun yum repo
37     get_url:
38       url=http://mirrors.aliyun.com/repo/Centos-7.repo
39       dest=/etc/yum.repos.d/CentOS-Base.repo
40       force=yes
41 
42 #   安装EPEL
43   - name: install epel
44     yum:
45       name=epel-release
46       state=latest
47 
48 #   配置阿里云EPEL源
49   - name: config aliyun epel repo
50     get_url:
51       url=http://mirrors.aliyun.com/repo/epel-7.repo
52       dest=/etc/yum.repos.d/epel.repo
53       force=yes
54 
55 #   安装常用软件
56   - name: install basic software
57     yum:
58       name='vim,wget,lftp,net-tools,bash-completion,jq,git,sysstat,lrzsz'
59       state=latest
60 
61 #   禁用防火墙
62   - name: disable firewall
63     service:
64       name=firewalld
65       state=stopped
66       enabled=no
67 
68 #   关闭SELinux
69   - name: disable selinux
70     selinux:
71       state=disabled
72 
73 #   触发器调用tasks
74   handlers:
75   - name: restart sshd service
76     service:
77       name=sshd.service
78       state=restarted

猜你喜欢

转载自www.cnblogs.com/www1707/p/12674908.html