摘要: - name: set public key on remote hosts & set reomte hosts sudoers file hosts: all # 此脚本要求所有的主机 root 用户密码相同 become: no remote_user: root vars: - remote 阅读全文
posted @ 2022-08-03 22:52 Demon丶安梓 阅读(30) 评论(0) 推荐(0)
摘要: - hosts: serverf vars: my_name: demOn stUdent tasks: - name: print message debug: msg: - "This is my name {{ my_name }}" # 输出原始信息 - "This is my name { 阅读全文
posted @ 2022-08-03 22:52 Demon丶安梓 阅读(24) 评论(0) 推荐(0)
摘要: - hosts: serverf vars: - password: key1: redhat key2: rhceforserver key3: demonzwl tasks: - name: Useradd rhce for remote host user: name: rhce shell: 阅读全文
posted @ 2022-07-31 22:24 Demon丶安梓 阅读(170) 评论(0) 推荐(0)
摘要: 获取模块的地址: https://github.com/ansible/ansible-modules-extras/blob/576f5813a2ab1b604d1f04e7230be5010e9a60e1/system/authorized_key 报错: [root@Workstation m 阅读全文
posted @ 2022-07-31 22:10 Demon丶安梓 阅读(154) 评论(0) 推荐(0)
摘要: 环境搭建 由于是自建环境,使用时需要安装环境 ansible-galaxy collection install ansible.posix 通过此命令便可以只用 authorized_key 模块了 在未执行上述命令时是没有 authorized_key 的手册的 执行 ansible-doc - 阅读全文
posted @ 2022-07-31 22:08 Demon丶安梓 阅读(618) 评论(0) 推荐(0)
摘要: 5.0_Loop循环-列表-字典-register注册变量 实施任务的控制 利用循环迭代任务 利用 loop (if/while)关键字对一组项目迭代任务 简单循环对 一组项目(对象、数组)迭代任务。loop关键字添加到任务中,将对应其 迭代任务的项目列表取为值 循环变量 item 保存每个迭代过程 阅读全文
posted @ 2022-07-10 12:04 Demon丶安梓 阅读(82) 评论(0) 推荐(0)
摘要: 软件帮助文本 [rhce@Servera var]$ ln --help Usage: ln [OPTION]... [-T] TARGET LINK_NAME or: ln [OPTION]... TARGET or: ln [OPTION]... TARGET... DIRECTORY or: 阅读全文
posted @ 2022-07-06 15:09 Demon丶安梓 阅读(673) 评论(0) 推荐(0)
摘要: 本次实验的用户都是用student普通用户并配置sudo权限,受控主机使用rhce并配置sudo权限 编辑参考 https://www.cnblogs.com/lvzhenjiang/p/14385777.html 进行了实验部分的细化 1.变量的优先级 extra vars——命令行中使用-e参数 阅读全文
posted @ 2022-06-28 16:03 Demon丶安梓 阅读(166) 评论(0) 推荐(0)
摘要: 定义 清单文件——可以理解为是Ansible的hosts解析配置文件,其中包含了受控主机的配置信息 文件的位置: · /etc/ansible/hosts · 默认的清单配置文件 · /home/rhce/ansible/inventory · 自建的清单配置文件 相关代码 点击查看代码 #表示单个 阅读全文
posted @ 2022-06-21 14:12 Demon丶安梓 阅读(134) 评论(0) 推荐(0)
摘要: 监听端口 · 进入etc/httpd/conf/httpd.conf修改监听端口 添加82端口 修改防火墙规则 查看当前防火墙规则 firewall-cmd --list-all [root@node1 ~]# firewall-cmd --list-all public (active) targ 阅读全文
posted @ 2022-06-19 16:57 Demon丶安梓 阅读(92) 评论(0) 推荐(0)