ansible的清单文件

【清单文件】

student@workstation \~\]$ lab start playbook-inventory \[student@workstation \~\]$ cd playbook-inventory/ \[student@workstation playbook-inventory\]$ ll total 4 -rw-r--r--. 1 student student 43 Jul 12 19:08 ansible.cfg \[student@workstation playbook-inventory\]$ cat inventory \[webservers

server[a:d].lab.example.com

raleigh

servera.lab.example.com

serverb.lab.example.com

mountainview

serverc.lab.example.com

london

serverd.lab.example.com

development

servera.lab.example.com

testing

serverb.lab/example.com

production

serverc.lab.example.com

serverd.lab.example.com

us:children

raleigh

mountainview

student@workstation playbook-inventory\]$ ansible-navigator inventory -i inventory -m stdout --list (可以跟组名例:us) (-i 指定当前目录下 -m 指定输出 --list 列出) \[student@workstation playbook-inventory\]$ lab finish playbook-inventory 【playbook】 { --- - name: install and start apache httpd hosts: web tasks: - name: ensure httpd packages is present (安装httpd) ansible.builtin.dnf: name: httpd state: present (状态:present 让软件包存在 absent 让软件包不存在 latest 安装最新的) - name: correct index.html is present(将文件。。放到、、) ansible.builtin.copy: src:files/index.html。。 dest:/var/www/html/index.html、、 - name: ensure httpd is started(启动服务) ansible.builtin.service: name:httpd state:started enabled: true --- - name: enable intranet services hosts: servera.lab.example.com become: true tasks: - name: ansible.builtin.dnf: name: - httpd - firewalld state: latest } \[student@workstation \~\]$ lab start playbook-review \[student@workstation \~\]$ cd playbook-review \[student@workstation playbook-review\]$ vim internet.yml 写清单文件 \[student@workstation playbook-review\]$ ansible-navigator run -m stdout internet.yml --syntax-check playbook: /home/student/playbook-review/internet.yml \[student@workstation playbook-review\]$ ansible-navigator run -m stdout internet.yml PLAY \[enable internet web service\] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* TASK \[Gathering Facts\] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ok: \[serverb.lab.example.com

相关推荐
君穆南1 小时前
基于 NFS 与 Rsync 实现跨服务器 Seafile 数据平滑迁移实战
linux·运维·git
bloglin999991 小时前
scp、rsync远程文件同步
linux·运维·服务器
克莱因3581 小时前
思科 Cisco 标准ACL
网络·路由
迦南的迦 亚索的索1 小时前
LINUX环境
linux·运维·服务器
yuanjj881 小时前
linux下调试域格CLM920 NC5等9x07平台模块 QMI拨号
linux·运维·服务器
IMPYLH2 小时前
Linux 的 printenv 命令
linux·运维·服务器·bash
SilentSamsara2 小时前
SSH 远程管理:密钥登录 + 隧道转发,一次性配置好
linux·运维·服务器·ubuntu·centos·ssh
LN花开富贵2 小时前
【ROS】鱼香ROS2学习笔记一
linux·笔记·python·学习·嵌入式·ros·agv
疏星浅月2 小时前
数据对齐的底层原理与性能优化
linux
Jurio.2 小时前
本机开发 + 多机执行的极简远端运行工具
linux·git·python·github·远程工作