当前位置: 首页 > news >正文

Ansible学习笔记14

实现多台的分离实现:

[root@localhost playbook]# cat example3.yaml
---
- hosts: 192.168.17.105remote_user: roottasks:- name: create test1 directoryfile: path=/test1/ state=directory- hosts: 192.168.17.106remote_user: roottasks:- name: create test2 directoryfile: path=/test2/ state=directory

剧本执行情况:

 在105的机器上创建了test1目录。

在106的机器上创建了test2目录。

搭建nfs系统,并在另外一台机器上进行挂载操作。

[root@localhost playbook]# cat example4.yaml
---
- hosts: 192.168.17.105remote_user: roottasks:- name: install nfs softwareyum: name=nfs-utils,rpcbind,setup state=latest- name: create share folderfile: path=/share/ state=directory- name: sync nfs configurecopy: src=/etc/exports dest=/etc/exportsnotify: restart nfs- name: start rpcbind and enabled in bootservice: name=rpcbind state=started enabled=yes- name: start nfs and enabled in bootservice: name=nfs state=started enabled=yeshandlers:- name: restart nfsservice: name=nfs state=restarted- hosts: 192.168.17.106remote_user: roottasks:- name: install nfs client packageyum: name=nfs-utils state=latest- name: mountshell: mount 192.168.17.105:/share /mnt

检查已经挂在成功:

http://www.lryc.cn/news/149228.html

相关文章:

  • docker 安装 mysql 并挂载 配置文件和数据目录
  • 代码随想录训练营 DP01
  • github+hexo 博客搭建
  • Spring Security bug记录:antMatchers找不到符号(已解决)
  • kaggle新赛:谷歌AI模型运行时间预测赛题解析【数据挖掘】
  • mysql性能测试工具选择 mysql软件测试
  • GPS全球卫星定位系统原理
  • Ubuntu学习---跟着绍发学linux课程记录(第一部分)
  • Ubuntu20.04下安装google输入法
  • Ros noetic 机器人坐标记录运动路径和发布 实战教程(A)
  • Java“牵手”1688淘口令转换API接口数据,1688API接口申请指南
  • Python实现自动关键词提取
  • java八股文面试[多线程]——sleep wait join yield
  • Vue/React 项目部署到服务器后,刷新页面出现404报错
  • 通信笔记:RSRP、RSRQ、RSNNR
  • 前端:html实现页面切换、顶部标签栏(可删、可切换,点击左侧超链接出现标签栏)
  • python print格式化输出
  • 钢筋水泥中的信仰--爱摸鱼的美工(16)
  • ViT论文Pytorch代码解读
  • Harbor查看密码
  • Boa服务器与Cgi简介
  • 入门vue——创建vue脚手架项目 以及 用tomcat和nginx分别部署vue项目(vue2)
  • oracle中的(+)
  • 五种永久免费 内网穿透傻瓜式使用
  • 【Java基础增强】Stream流
  • reduxreact-redux
  • go中的并发
  • 开启EMQX的SSL模式及SSL证书生成流程
  • 4 | Java Spark实现 WordCount
  • Redis7安装