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

相关推荐
vvilkim1 小时前
Java主流框架全解析:从企业级开发到云原生
java·运维·云原生
Wy_编程5 小时前
Linux-文本搜索工具grep
linux·运维·服务器
qq998995 小时前
AAA服务器技术
运维·服务器
xujiangyan_5 小时前
linux的sysctl系统以及systemd系统。
linux·服务器·网络
Lovyk5 小时前
Linux Shell 常用操作与脚本示例详解
linux·运维·服务器
iCan_qi6 小时前
【Mac】【Minecraft】关于如何在Mac上搭建基岩版MC服务器的方法
运维·服务器·macos·minecraft
ezreal_pan8 小时前
Kubernetes 负载均衡现象解析:为何同一批次请求集中于单个 Pod
运维·云原生·k8s·traefik
朱皮皮呀8 小时前
Spring Cloud——服务注册与服务发现原理与实现
运维·spring cloud·eureka·服务发现·php
吱吱企业安全通讯软件9 小时前
吱吱企业通讯软件保证内部通讯安全,搭建数字安全体系
大数据·网络·人工智能·安全·信息与通信·吱吱办公通讯
yuanpan9 小时前
ubuntu系统上的conda虚拟环境导出方便下次安装
linux·ubuntu·conda