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

相关推荐
IT成长日记3 小时前
【Docker基础】Docker数据持久化与卷(Volume)介绍
运维·docker·容器·数据持久化·volume·
一只栖枝4 小时前
网络安全 vs 信息安全的本质解析:数据盾牌与网络防线的辩证关系关系
网络·网络安全·信息安全·it·信息安全认证
物联网老王5 小时前
Ubuntu Linux Cursor 安装与使用一
linux·运维·ubuntu
CertiK5 小时前
CertiK《Hack3d:2025年第二季度及上半年Web3.0安全报告》(附报告全文链接)
网络
艾伦_耶格宇6 小时前
【ACP】阿里云云计算高级运维工程师--ACP
运维·阿里云·云计算
一只小鱼儿吖7 小时前
进程代理单窗口单IP技术:原理、应用与实现
网络·网络协议·tcp/ip
稳联技术7 小时前
Ethernet IP与Profinet共舞:网关驱动绿色工业的智慧脉动
网络·网络协议·tcp/ip
一位摩羯座DBA7 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组7 小时前
CentOS配置网络
linux·网络·centos
weixin_307779137 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习