lftp可以免密登录ftp
搭建nfs步骤:
1.准备2台主机c,s
2.在服务器端安装rpcbind,nfs-utils
1.创建共享目录
2.配置文件 /etc/exports
3.启动nfs,rpcbind
3.在客户端安装nfs-utils
1.创建挂载目录
2.挂载文件
剧本格式
---
- hosts: 组名/别名/ip/域名
remote_user: root
tasks:
- name: 任务说明
模块: key0=value0
service: name=vsftpd state=started enabled=yes
- name: 修改配置文件
command: sed........
notify:
- abcdefg
handlers:
- name: abcdefg
service: name=httpd state=restarted
...
playbook(剧本)
playbook(剧本): 是ansible⽤于配置,部署,和管理被控节点的剧本。⽤于ansible操作的编排。
使⽤的格式为yaml格式
yaml格式:
以.yaml或.yml结尾
⽂件的第⼀⾏以 "---"开始,表明YMAL⽂件的开始(可选的)
以#号开头为注释
列表中的所有成员都开始于相同的缩进级别, 并且使⽤⼀个 "- " 作为开头(⼀个横杠和⼀个空格)
⼀个字典是由⼀个简单的 键: 值 的形式组成(这个冒号后⾯必须是⼀个空格)
用剧本安装vsftpd:不允许匿名访问
将httpd的端口号80改为8080:
使用剧本在不同主机上同时创建不同的文件:
使用剧本搭建nfs服务:
---
- hosts: mysql1
remote_user: root
tasks:
- name: 安装nfs-utils
yum: name=nfs-utils state=present
- name: 安装rpcbind
yum: name=rpcbind state=present
- name: 创建共享目录
file: path=/static state=directory
- name: 配置文件
shell: echo '/static *(ro,sync)' > /etc/exports
notify:
- rstss
- name: 启动服务nfs
service: name=nfs state=started enabled=yes
- name: 启动服务rpcbind
service: name=rpcbind state=started enabled=yes
handlers:
- name: rstss
service: name=nfs state=restarted
- hosts: mysql2
remote_user: root
tasks:
- name: 安装nfs-utils
yum: name=nfs-utils state=latest
- name: 创建挂载目录
file: path=/nfs state=directory
- name: 挂载nfs文件
command: mount -t nfs 192.168.118.20:/static /nfs