首页 > 其他分享 >安装nfs之ansible-playbook

安装nfs之ansible-playbook

时间:2022-10-09 22:00:24浏览次数:46  
标签:www name server state ansible nfs playbook

---
- name: install nfs
hosts: all
tasks:
- name: yum nfs
yum:
name: nfs-utils
state: present
when: ansible_distribution == "CentOS" or ansible_distribution == "Rocky"
- name: apt nfs
apt:
name:
- nfs-kernel-server
- nfs-common
update_cache: yes
state: present
when: ansible_distribution == "Ubuntu"
- name: copy config
copy:
src: /data/ansible/templates/exports.j2
dest: /etc/exports
notify: restart nfs server
- name: create group
group:
name: www
gid: 666
system: yes
state: present
- name: create user
user:
name: www
uid: 666
system: yes
create_home: no
shell: /sbin/nologin
state: present
- name: create dir
file:
path: /data/nfs-test
state: directory
owner: www
group: www
mode: '0755'
- name: start nfs server
systemd:
name: nfs-server
state: started
enabled: yes
handlers:
- name: restart nfs server
systemd:
name: nfs-server
state: restarted

标签:www,name,server,state,ansible,nfs,playbook
From: https://blog.51cto.com/dayu/5741720

相关文章

  • NFS服务介绍
    (1)NFS简介NFS网络文件系统提供了一种在类UNIX系统上共享文件的方法。目前NFS有3个版本:NFSv2、NFSv3、NFSv4。CentOS7默认使用NFSv4提供服务,优点是提供了有状态的连接,更容易......
  • Ansible
    自动化运维(1)环境准备关闭防火墙和SELinux,并修改/etc/hosts文件systemctlstopfirewalldsystemctldisablefirewalldsetenforce0getenforce0cat/etc/selinux/co......
  • 关于Centos6、selinux和ansible
    简单说,一般来说,ansible想通过证书访问其他主机,需要关闭selinux。或者(也可能是并且),安装libselinux-python。而centos6已经停止维护了,需要更新yum源,或者挂载系统安装包。否......
  • Ansible 自动化最佳实践
    Ansible自动化最佳实践                         版本标识V1编制单位李斌编制日期2022年......
  • ansible学习笔记03(最佳实践)
    1、控制提权Ansibleplaybook能实现多种不同方式的提权操作,提权的级别取决于你打算控制的级别,ansible使用命令或连接参数,在play、role、block和tasks中,都可以设置提权,设......
  • ansible基础 命令
    ansible基础命令:1.远程执行命令ansible组名-mcommand-a"命令"  2.文件拷贝ansibleip-mcopy-a"src=/etc/passwddest=/tmp/123" 3.ansible远程......
  • 安装Mysql之Playbook
    ----name:installmysqlhosts:allvars:mysql:mysql-8.0.28-linux-glibc2.12-x86_64tasks:-name:installpackageyum:name:-l......
  • 14.ansible模块之 selinux firewalld iptables
    1.1selinux官方示例EXAMPLES:-name:EnableSELinuxselinux:policy:targetedstate:enforcing-name:PutSELinuxinpermissivemode,loggingact......
  • ZenFS tutorial
    ZenFSgitclonehttps://github.com/facebook/rocksdb.gitcdrocksdbgitclonehttps://github.com/westerndigitalcorporation/zenfsplugin/zenfssudoDEBUG_LEVEL=......
  • 0565-6.1.0-NFS异常导致Host Monitor及Agent服务错误
    温馨提示:如果使用电脑查看图片不清晰,可以使用手机打开文章单击文中的图片放大查看高清原图。Fayson的github:​​https://github.com/fayson/cdhproject​​提示:代码块部分可......