This article includes some useful Ansible commands. I will try to write blogs by English. You may want to add my wechat public account or add my technical blogs's rss feed

How ansible works

Ansible works by connecting to your nodes and pushing out small programs, called "Ansible Modules" to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules (over SSH by default), and removes them when finished.

your library of modules can reside on any machine, and there are no servers, daemons, or databases required.

Passwords are supported, but SSH keys with ssh-agent are one of the best ways use Ansible.

Useful commands, options and variables

Auto create all of the ansible directory structure for you

ansible-galaxy init roles/myrole

Become user joe and ask connection password

--become-user joe -k

Allow Ansible replace the interpreter used when executing python modules

Setting of an inventory variable ansible_python_interpreter=/some/special/python on host

Use specific port when connecting to host

Setting of an inventory variable ansible_port=9750 on host

Destination host is local host

If you are deploying for localhost, use the command option --connection=localhost to avoid SSH authentication

Locate the python module's directory

python -v
import ansible # then you can see the module path

Obtain the module python script for debug

Set the ANSIBLE_KEEP_REMOTE_FILES environment variable

useful Ansible commands的更多相关文章

  1. 使用Ansible实现数据中心自动化运维管理

    长久以来,IT 运维在企业内部一直是个耗人耗力的事情.随着虚拟化的大量应用.私有云.容器的不断普及,数据中心内部的压力愈发增加.传统的自动化工具,往往是面向于数据中心特定的一类对象,例如操作系统.虚拟 ...

  2. 【转】使用 Ansible 实现数据中心自动化管理

    长久以来,IT 运维在企业内部一直是个耗人耗力的事情.随着虚拟化的大量应用.私有云.容器的不断普及,数据中心内部的压力愈发增加.传统的自动化工具,往往是面向于数据中心特定的一类对象,例如操作系统.虚拟 ...

  3. cloudera-scm-server启动时出现Caused by: java.io.FileNotFoundException: /var/lib/cloudera-scm-server/.keystore (No such file or directory)问题解决方法(图文详解)

    不多说,直接上干货! 问题详情 查看/var/log/cloudera-scm-server.log的启动日志 问题来源 我在用cloudermanager安装好之后,然后,在对如下. 配置kerbe ...

  4. ansible for devops 读书笔记第二章Ad-Hoc Commands

    参数 参数 说明 -a ‘Arguments’, —args=’Arguments’ 命令行参数 -m NAME, —module-name=NAME 执行模块的名字,默认使用 command 模块, ...

  5. Install Ansible on Mac OSX

    from: https://devopsu.com/guides/ansible-mac-osx.html and : https://devopsu.com/guides/ansible-post- ...

  6. Ansible简介

    概述 Ansible是一种自动化运维管理工具,无需安装客户端,通过SSH协议与节点通信. 架构 由上图可以看出Ansible由5个部分组成 Ansible:核心 Inventory:定义管理主机的清单 ...

  7. Ansible@一个有效的配置管理工具--Ansible configure management--翻译(十)

    未经书面许可,.请勿转载 Custom Modules Until now we have been working solely with the tools provided to us by A ...

  8. Ansible系列(二):选项和常用模块

    html { font-family: sans-serif } body { margin: 0 } article,aside,details,figcaption,figure,footer,h ...

  9. Ansible(二) - 配置及命令简介

    Ⅰ. Ansible Inventory Hosts文件配置 # mkdir /etc/ansible # touch /etc/ansible/hosts # cat /etc/hosts 127. ...

随机推荐

  1. .NetCore中的日志(2)集成第三方日志工具

    .NetCore中的日志(2)集成第三方日志工具 0x00 在.NetCore的Logging组件中集成NLog 上一篇讨论了.NetCore中日志框架的结构,这一篇讨论一下.NetCore的Logg ...

  2. 来,给Entity Framework热热身

    先来看一下Entity Framework缓慢的初始化速度给我们更新程序带来的一种痛苦. 我们手动更新程序时通常的操作步骤如下: 1)把Web服务器从负载均衡中摘下来 2)更新程序 3)预热(发出一个 ...

  3. Hello Web API系列教程——Web API与国际化

    软件国际化是在软件设计和文档开发过程中,使得功能和代码设计能处理多种语言和文化习俗,在创建不同语言版本时,不需要重新设计源程序代码的软件工程方法.这在很多成熟的软件开发平台中非常常见.对于.net开发 ...

  4. 异常处理汇总 ~ 修正果带着你的Net飞奔吧!

    经验库开源地址:https://github.com/dunitian/LoTDotNet 异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983 ...

  5. 3.Windows Server 2012 R2数据库部署

    很多人竟然不会安装数据库....好吧,来个图文教程,其实和windows里面一样安装,和安装2008一样的 先安装3.5:http://www.cnblogs.com/dunitian/p/53487 ...

  6. 【WCF】自定义错误处理(IErrorHandler接口的用法)

    当被调用的服务操作发生异常时,可以直接把异常的原始内容传回给客户端.在WCF中,服务器传回客户端的异常,通常会使用 FaultException,该异常由这么几个东东组成: 1.Action:在服务调 ...

  7. AES加密

    package com.edu.hpu; import java.math.BigInteger; import java.security.MessageDigest; import java.se ...

  8. 基于AOP的MVC拦截异常让代码更优美

    与asp.net 打交道很多年,如今天微软的优秀框架越来越多,其中微软在基于mvc的思想架构,也推出了自己的一套asp.net mvc 框架,如果你亲身体验过它,会情不自禁的说‘漂亮’.回过头来,‘漂 ...

  9. SDWebImage源码解读 之 NSData+ImageContentType

    第一篇 前言 从今天开始,我将开启一段源码解读的旅途了.在这里先暂时不透露具体解读的源码到底是哪些?因为也可能随着解读的进行会更改计划.但能够肯定的是,这一系列之中肯定会有Swift版本的代码. 说说 ...

  10. 看图理解JWT如何用于单点登录

    单点登录是我比较喜欢的一个技术解决方案,一方面他能够提高产品使用的便利性,另一方面他分离了各个应用都需要的登录服务,对性能以及工作量都有好处.自从上次研究过JWT如何应用于会话管理,加之以前的项目中也 ...