ansible 配置linux主机SSH无密码访问

摘要:  在主服务端:[root@node110 .ssh]# ssh-keygen -t rsa Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists.Overwrite (y/n)? yEnter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ss

 ansible 出现检查 keys 的提示处理方法

摘要:1.在首次连接或者重装系统之后会出现检查 keys 的提示The authenticity of host '192.168.0.5 (192.168.0.5)'can't be established.ECDSA key fingerprint is05:51:e5:c4:d4:66:9b:af:5b:c9:ba:e9:e6:a4:2b:fe.Are you sure you want to continue connecting (yes/no)?解决办法:vim /etc/ansible/ansible.cfg 或者 ~/.ansible.cfg[defaults]host_key_checking = False也可以通过

 ansible 安装

摘要:rpm -ql /etc/ansible/etc/ansible/ansible.cfg/etc/ansible/hosts/etc/ansible/roles/usr/bin/ansible/usr/bin/ansible-console/usr/bin/ansible-doc/usr/bin/ansible-galaxy/usr/bin/ansible-playbook/usr/bin/ansible-pull/usr/bin/ansible-vaultAnsible中文全威指南(网页版)http://www.ansible.com.cn/docs/playbooks_intro.html#about-playbooks1、Ansible基础安装(1)、py

 生产环境代码包发布管理

摘要:#!/usr/bin/env pythonfrom fabric.api import *from fabric.colors import *from fabric.context_managers import *from fabric.contrib.console import confirmimport timeenv.user='root'env.hosts=['192.168.1.21','192.168.1.22']env.password='SKJh935yft#'env.project_dev_source = '/data/dev/Lwebadmin/'env.project_tar_source = '/data/dev/releases/'env.project_p

 部署LAMP业务服务环境

摘要:[root@node110 fabric]# cat simple5.py #!/usr/bin/env pythonfrom fabric.colors import *from fabric.api import *env.user='root'env.roledefs = {    'webservers': ['192.168.1.21', '192.168.1.22'],    'dbservers': ['192.168.1.23']}env.passwords = {    'root@192.168.1.21:22': 'SKJh935yft#',    'root@192.168.1.

 文件打包,上传与校验

摘要:[root@node110 fabric]# cat simple4.py#!/usr/bin/env pythonfrom fabric.api import *from fabric.context_managers import *from fabric.contrib.console import confirmenv.user='root'#env.hosts=['192.168.1.21','192.168.1.22','192.168.1.23']env.hosts=['192.168.2.110','192.168.2.120']env.password='123456'@task@runs_oncedef tar_task():    with lcd(

 网关模式文件上传与执行

摘要:[root@node110 fabric]# cat simple3.py#!/usr/bin/env pythonfrom fabric.api import *from fabric.context_managers import *from fabric.contrib.console import confirmenv.user='root'#env.gateway='192.168.1.23'env.gateway='192.168.2.120'#env.hosts=['192.168.1.21','192.168.1.22']env.hosts=['192.168.2.121']env.passwords = {   # 'root@192.168.1.21:

 动态获取远程目录列表

摘要:[root@node110 fabric]# cat simple2.py#!/usr/bin/env pythonfrom fabric.api import * env.user='root'env.hosts=['192.168.2.110','192.168.2.120']env.password="123456"@runs_oncedef input_raw():    return prompt("please input directory name:",default="/home")def worktask(dirname):    run("ls -l

 查看本地与远程主机信息

摘要:[root@node110 fabric]# cat simple1.py#!/usr/bin/env pythonfrom fabric.api import *env.user='root'env.hosts=['192.168.2.110','192.168.2.120']env.password='123456'@runs_once #只有第一台主机触发此函数(192.168.2.110)def local_task():    local("uname -a")def remote_task():    with cd("/tmp"):      &

 直接在命令行上批量执行命令

摘要:[root@node110 fabric]# fab -p 123456 -H 192.168.2.120,192.168.2.121 -- 'uname -s'[192.168.2.120] Executing task '<remainder>'[192.168.2.120] run: uname -s[192.168.2.120] out: Linux[192.168.2.120] out: [root@node110 fabric]# fab -p 123456 -H 192.168.2.120,192.168.2.121 -- 'uname -a'[192.168.2.120] Executing task '<remainder>'[192.16
分页:« 1 2 3 4 5 6 7 8 »
Powered by AKCMS