随笔分类 -  自动化ansible

摘要:(1)hosts文件 [task]IP地址1 hostname=主机名1IP地址2 hostname=主机名2IP地址3 hostname=主机名3 [task:vars]ansible_become=yesansible_become_method=sudoansible_become_user= 阅读全文
posted @ 2024-09-12 15:00 LB_运维技术 阅读(60) 评论(0) 推荐(0) 编辑
摘要:# vim ~/.vimrc ==>autocmd FileType yaml setlocal ai ts=2 sw=2 et (建议手敲) 阅读全文
posted @ 2024-09-12 14:47 LB_运维技术 阅读(11) 评论(0) 推荐(0) 编辑
摘要:问题: Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host 阅读全文
posted @ 2024-09-12 10:35 LB_运维技术 阅读(193) 评论(0) 推荐(0) 编辑
摘要:- name: add libin sudo config hosts: task gather_facts: no tasks: - name: jiesuo shell: pam_tally2 -u libin -r - name: one user: name: "{{ item.user } 阅读全文
posted @ 2023-03-24 17:58 LB_运维技术 阅读(19) 评论(0) 推荐(0) 编辑
摘要:[root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | for i in `awk -F':' '{if( 3>=500)print1 }' /etc/passwd | 阅读全文
posted @ 2023-03-20 15:07 LB_运维技术 阅读(24) 评论(0) 推荐(0) 编辑
摘要:[root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | for i in `awk -F':' '{if( 3>=0)print1 }' /etc/passwd `;d 阅读全文
posted @ 2023-03-20 15:05 LB_运维技术 阅读(57) 评论(0) 推荐(0) 编辑
摘要:iptables防火墙配置 # 方法一: 相当于命令iptables -A 4A -s 10.159.17.177/32 -j ACCEPT - name: hosts: 10.154.145.139 tasks: - name: iptables: chain: 4A source: 10.159 阅读全文
posted @ 2022-11-17 22:01 LB_运维技术 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-11-12 00:54 LB_运维技术 阅读(64) 评论(0) 推荐(0) 编辑
摘要:创建用户配置密码通过哈希加密的方式 [libin@libin ansible]$ vim rhca447-26.yaml - name: create user and set hosts: web tasks: - name: create user user: name: alex01 pass 阅读全文
posted @ 2022-10-16 15:11 LB_运维技术 阅读(442) 评论(0) 推荐(0) 编辑
摘要:Asible最佳实践-进阶版-RHCA447 定义角组变量/主机变量/变量文件 6.1 所有受管节点设置sudo免密 [root@libin libin]# vim /etc/sudoers.d/devops libin ALL=(ALL) NOPASSWD:ALL [root@libin sudo 阅读全文
posted @ 2022-10-12 20:36 LB_运维技术 阅读(123) 评论(0) 推荐(0) 编辑
摘要:Ansible 自动化最佳实践 版本标识 V1 编制单位 李斌 编制日期 2022年9月23日 Ansible官网 https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ 简介: Ansible 作为目前使用最广的自动 阅读全文
posted @ 2022-10-08 23:38 LB_运维技术 阅读(612) 评论(0) 推荐(0) 编辑
摘要:第一章 Linux pssh安装与使用 说明:我这是没有在密钥认证的情况下操作 1、安装pssh [root@libin ansible]# yum install -y pssh [root@libin ansible]# rpm -ql pssh/usr/bin/pnuke/usr/bin/pr 阅读全文
posted @ 2022-09-25 20:23 LB_运维技术 阅读(376) 评论(0) 推荐(0) 编辑
摘要:1、定义剧本(我这里只输出序列号) [root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | awk -F ":" '{ print 1,7 }' /etc/passwd | 阅读全文
posted @ 2022-08-21 01:24 LB_运维技术 阅读(22) 评论(0) 推荐(0) 编辑
摘要:[root@libin 2022-08-16-ChagePasswd]# cat chagepasswd.yml - hosts: task remote_user: root gather_facts: no tasks: - name: chage passwd1 user: name: 用户名 阅读全文
posted @ 2022-08-17 11:07 LB_运维技术 阅读(27) 评论(0) 推荐(0) 编辑
摘要:ansible -i hosts task -m script -a '脚本' 例如:ansible task -m script -a ./tj.sh -i hosts 在hosts 里面要定义用户密码 阅读全文
posted @ 2022-07-09 14:36 LB_运维技术 阅读(28) 评论(0) 推荐(0) 编辑
摘要:1、定义剧本(我这里只输出序列号) [root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | dmidecode -t 1 | grep "Serial Number" | aw 阅读全文
posted @ 2022-07-09 14:29 LB_运维技术 阅读(53) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示