随笔分类 - 自动化ansible
摘要:(1)hosts文件 [task]IP地址1 hostname=主机名1IP地址2 hostname=主机名2IP地址3 hostname=主机名3 [task:vars]ansible_become=yesansible_become_method=sudoansible_become_user=
阅读全文
摘要:# vim ~/.vimrc ==>autocmd FileType yaml setlocal ai ts=2 sw=2 et (建议手敲)
阅读全文
摘要:问题: 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
阅读全文
摘要:- 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 }
阅读全文
摘要:[root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | for i in `awk -F':' '{if( 1 }' /etc/passwd |
阅读全文
摘要:[root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | for i in `awk -F':' '{if( 1 }' /etc/passwd `;d
阅读全文
摘要: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
阅读全文
摘要:创建用户配置密码通过哈希加密的方式 [libin@libin ansible]$ vim rhca447-26.yaml - name: create user and set hosts: web tasks: - name: create user user: name: alex01 pass
阅读全文
摘要:Asible最佳实践-进阶版-RHCA447 定义角组变量/主机变量/变量文件 6.1 所有受管节点设置sudo免密 [root@libin libin]# vim /etc/sudoers.d/devops libin ALL=(ALL) NOPASSWD:ALL [root@libin sudo
阅读全文
摘要:Ansible 自动化最佳实践 版本标识 V1 编制单位 李斌 编制日期 2022年9月23日 Ansible官网 https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ 简介: Ansible 作为目前使用最广的自动
阅读全文
摘要:第一章 Linux pssh安装与使用 说明:我这是没有在密钥认证的情况下操作 1、安装pssh [root@libin ansible]# yum install -y pssh [root@libin ansible]# rpm -ql pssh/usr/bin/pnuke/usr/bin/pr
阅读全文
摘要:1、定义剧本(我这里只输出序列号) [root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | awk -F ":" '{ print 7 }' /etc/passwd |
阅读全文
摘要:[root@libin 2022-08-16-ChagePasswd]# cat chagepasswd.yml - hosts: task remote_user: root gather_facts: no tasks: - name: chage passwd1 user: name: 用户名
阅读全文
摘要:ansible -i hosts task -m script -a '脚本' 例如:ansible task -m script -a ./tj.sh -i hosts 在hosts 里面要定义用户密码
阅读全文
摘要:1、定义剧本(我这里只输出序列号) [root@libin3]# cat libin.yml - hosts: task gather_facts: no tasks: - name: fetch shell: | dmidecode -t 1 | grep "Serial Number" | aw
阅读全文