news 2026/6/15 18:39:59

ansible的题目(3,4,5章节的作业题目)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ansible的题目(3,4,5章节的作业题目)

第三章作业

3.8.1

--- - name: 3.8.1zuoye hosts: all gather_facts: true tasks: - name: 输出DNS服务器IP debug: msg: "当前受管主机的DNS服务器IP:{{ansible_dns.nameservers}}"

3.8.2

--- - name: 3.8.2zuoye hosts: all become: yes tasks: - yum: name: httpd state: present - name: copy example.conf copy: src: example.conf dest: /etc/httpd/conf.d/example.conf notify: restart_httpd - name: copy index.html copy: dest: /var/www/html/index.html content: zuoye handlers: - name: restart_httpd service: name: httpd state: restarted

第四章作业

4.

--- - name: 3.8.3zuoye hosts: all become: yes gather_facts: true tasks: - name: copy /home/file copy: dest: /home/file content: | hostname= {{ inventory_hostname }} memory= {{ ansible_memtotal_mb }} BIOS version= {{ ansible_bios_version }} distribution= {{ ansible_distribution }} {{ ansible_distribution_version }} size of disk device is {{ ansible_devices["dm-0"].size }}

第五章作业

5.6.1

--- - name: 根分区大于1G时安装并启动服务 hosts: all gather_facts: yes become: yes tasks: - name: 安装httpd和mariadb-server(根分区大于1G时) ansible.builtin.yum: name: - httpd - mariadb-server state: present when: ansible_mounts | selectattr('mount', 'equalto', '/') | map(attribute='size_total') | first > 1073741824 - name: 确保httpd服务已启动并开机自启 ansible.builtin.service: name: httpd state: started enabled: yes when: ansible_mounts | selectattr('mount', 'equalto', '/') | map(attribute='size_total') | first > 1073741824 - name: 确保mariadb服务已启动并开机自启 ansible.builtin.service: name: mariadb state: started enabled: yes when: ansible_mounts | selectattr('mount', 'equalto', '/') | map(attribute='size_total') | first > 1073741824

5.6.2

--- - name: 5.6.2zuoye hosts: all become: true tasks: - name: copy Development copy: dest: /etc/message content: "Development\n" when: inventory_hostname in groups.get('dev', []) - name: copy test copy: dest: /etc/message content: "Test\n" when: inventory_hostname in groups.get('test', [])
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/15 18:38:19

【原创唯一】基于微信小程序+uni-app+vue的新闻管理系统小程序 课程设计/大作业/期末作业(源码+MySQL数据库+实验报告+PPT+远程部署)

系统摘要 随着移动互联网与微信生态的快速发展,传统 Web 新闻浏览方式已难以满足用户随时随地获取资讯的需求。本文以新闻管理系统为业务背景,按照软件工程生命周期方法,完成用户端微信小程序的设计与实现。系统后端采用 Spring Boot 3、MyBa…

作者头像 李华
网站建设 2026/6/15 18:37:53

项目实训——大数据租房推荐智能体(爬虫部分7)

FastAPI与异步爬虫的完美融合:构建高性能房源搜索API在之前的文章中,我们实现了基于asyncio的多源竞速爬虫核心逻辑。本文将重点讲解如何将这套爬虫系统与FastAPI框架深度融合,打造一个生产级的房源搜索API服务。一、 为什么选择FastAPI&…

作者头像 李华
网站建设 2026/6/15 18:35:15

5分钟自动化配置:OpCore Simplify让黑苹果EFI创建变得简单

5分钟自动化配置:OpCore Simplify让黑苹果EFI创建变得简单 【免费下载链接】OpCore-Simplify A tool designed to simplify the creation of OpenCore EFI 项目地址: https://gitcode.com/GitHub_Trending/op/OpCore-Simplify 在PC上运行macOS(通…

作者头像 李华
网站建设 2026/6/15 18:32:53

AutoCAD许可总是不够?试试“许可复用“,一份钱当两份花

许可不够用?别急着掏钱买新的。2026年最新数据摆在这儿:68%的企业,AutoCAD许可证利用率连40%都不到。 你花大价钱买的许可,一半以上在睡觉。这不是软件的问题,是你没管好。我去年接手一个建筑设计公司的项目&#xff0…

作者头像 李华
网站建设 2026/6/15 18:31:01

RUST Arc

Arc 是 Atomically Reference Counted 的缩写,即"原子引用计数"。 它的作用是:让多个所有者同时持有同一份堆上数据,且可以安全地跨线程使用。 Rust 里 Arc::new(value) 内部就是把数据分配到堆上,然后返回一个指向它的…

作者头像 李华
网站建设 2026/6/15 18:30:23

手把手 教你,ClaudeCode + CC-Switch 安装使用!!

【请多多关注,后面会继续UP!!!】 Claude Code 👾👾👾 Claude Code 是 Anthropic 公司推出的 AI 编程助手, 专为开发者设计的 CLI 工具。它不仅能够理解代码、生成代码&#xff0c…

作者头像 李华