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

and : https://devopsu.com/guides/ansible-post-install.html

Install Ansible on Mac OSX

Ansible uses Python and fortunately Python is already installed on modern versions of OSX.

Quick summary:

  • Install Xcode
  • sudo easy_install pip
  • sudo pip install ansible --quiet

Then, if you would like to update Ansible later, just do:

  • sudo pip install ansible --upgrade

Full explanation...

Ensure Xcode is installed first

Some of Ansible's dependencies need to be compiled, so you'll need the developer tools that come with Xcode.

You can check if you already have the developer tools by running this:

> pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

(note: Before OSX Mavericks, the package to check for was "com.apple.pkg.DeveloperToolsCLI")

If the tools are not installed, you will see this output:

> pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

In that case, download and install Xcode from here.

If the tools are installed, you should see output similar to this:

> pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1396320587
volume: /
location: /
install-time: 1397415256
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group

Install pip

pip is Python's package manager. It isn't installed on OSX by default, but you can use Python's other package manager easy_install to install it:

> sudo easy_install pip
Password:
Searching for pip
Reading http://pypi.python.org/simple/pip/
Best match: pip 1.4.1
Downloading https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714
Processing pip-1.4.1.tar.gz
Running pip-1.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-hVr8Pt/pip-1.4.1/egg-dist-tmp-BY70iY
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.4.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

Install Ansible

> sudo pip install ansible
...lots of output and warnings you can ignore...
Successfully installed ansible paramiko jinja2 PyYAML pycrypto ecdsa markupsafe
Cleaning up...

Upgrade Ansible

When a new release of Ansible comes out, you can easily upgrade to the new version like this:

> sudo pip install ansible --upgrade

Post-Install Setup

Next, see the post-install steps...

Ansible: Post-Install Setup

Inventory hosts file

After you've installed Ansible, then you'll want Ansible to know which servers to connect to and manage.

Ansible's inventory hosts file is used to list and group your servers. Its default location is /etc/ansible/hosts.

If you want to have your Ansible hosts file in another location, then you can set this environment variable:

> export ANSIBLE_HOSTS=/root/ansible_hosts

Or you can specify the Ansible hosts location when running commands with the --inventory-file= (or -i) flag:

> ansible all --inventory-file=/root/ansible_hosts -m ping

For more on the inventory hosts file, see: http://docs.ansible.com/intro_inventory.html

Set up connectivity to the servers

For this example, I'll assume you have servers with the hostnames child1.dev and child2.dev. When doing your own install, replace those hostnames with your own.

Your /etc/ansible/hosts file would look like this:

child1.dev
child2.dev

You want to be able to connect to your servers without having to enter a password every time. If you don't already have ssh key authentication set up to your children nodes, then do the following...

Generate the ssh key on the master node:

root@master:~# ssh-keygen -t rsa -C "name@example.org"

Then copy your public key to the servers with ssh-copy-id:

root@master:~# ssh-copy-id user@child1.dev
root@master:~# ssh-copy-id user@child2.dev

Now you can test the connectivity:

root@master:~# ansible all -m ping
child1.dev | success >> {
"changed": false,
"ping": "pong"
} child2.dev | success >> {
"changed": false,
"ping": "pong"
}

Next...

Now you're ready to actually manage your servers with Ansible's playbooks: http://docs.ansible.com/playbooks_intro.html

Install Ansible on Mac OSX的更多相关文章

  1. 在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)

    这篇文章简述了在Mac OSX狮子(Lion)上安装MySQL Community Server最新版本v10.6.7的过程. MySQL是最流行的开源数据库管理系统.首先,从MySQL的下载页面上下 ...

  2. 【转】Install libimobiledevice on Mac OSX

    About the App App name: libimobiledevice App description: Library to communicate with iOS devices na ...

  3. Install MongoDB driver for PHP on XAMPP for Mac OSX

    试了不少方法,最后还是这个最有效. [转自:http://thatsimplecode.com/install-mongodb-driver-for-php-on-xampp-for-mac-osx] ...

  4. mac osx 系统 brew install hadoop 安装指南

    mac osx 系统 brew  install hadoop 安装指南   brew install hadoop 配置 core-site.xml:配置hdfs文件地址(记得chmod 对应文件夹 ...

  5. mac osx 上面部署Django项目 apache+mysql+mod_wsgi

    1.安装Xcode command line tools 首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tool ...

  6. Mac OSX上的软件包管理工具,brew 即 Homebrew

    brew 即 Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便. brew类似ubuntu系统下的apt-get的功能. 安装 ...

  7. Installing Hadoop on Mac OSX Yosemite Tutorial Part 1.

    Installing Hadoop on Mac OSX Yosemite Tutorial Part 1. September 23, 2014 Marek 68 Comments Install ...

  8. 在Mac OSX 10.10 上安装opencv

    http://blog.csdn.net/wdkirchhoff/article/details/41910553 在Mac OSX上如果想使用OpenCV,可以通过自己手动编译源码的方式,但比较繁琐 ...

  9. XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装Xcode4.6.3(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 在安装Xcode前, ...

随机推荐

  1. Windows Internal Database Service Pack 4 x64 Edition (KB2463332)安装失败

    系统是Windows Server 2008 R2,补丁Windows Internal Database Service Pack 4 x64 Edition (KB2463332)总是安装失败,W ...

  2. js时间格式化

    const formatDate = timestamp => { const date = new Date(timestamp); const m = date.getMonth() + 1 ...

  3. JS限制input输入的为数字并且有小数的时候最多保留两位小数

    JS限制input用户输入的为数字并且有小数的时候最多保留两位小数,代码如下: html部分: <input type="number" onkeypress="r ...

  4. .NET client connection Limit

    调试出了一个诡异的问题,使用多个进程没问题,单进程出现了. fix: //默认限制为2个连接 //public const int DefaultPersistentConnectionLimit = ...

  5. HBA相关知识

    HBA使用详解: 一般的AIX客户端支持的HBA为Emulex HBA卡和交换机硬件确保连接成功的标志: A. 如果是 Emulex卡,卡上的绿灯常亮,黄灯闪烁. B. 如果是 QLogic卡,卡上的 ...

  6. 三分之一的程序猿之社交类app踩过的那些坑

    三分之一的程序猿之社交类app踩过的那些坑 万众创新,全民创业.哪怕去年陌生人社交不管融资与否都倒闭了不知道多少家,但是依然有很多陌生人社交应用层出不穷的冒出来.各种脑洞大开,让人拍案叫起. 下面我们 ...

  7. 什么是JAVAbean

    JavaBean 是一种JAVA语言写成的可重用组件.为写成JavaBean,类必须是具体的和公共的,并且具有无参数的构造器.JavaBean 通过提供符合一致性设计模式的公共方法将内部域暴露成员属性 ...

  8. 家教O2O维护“老师”的逼格,算不尊重市场吗

    既然做O2O,本身就是把这当服务业的.出钱的人才是老大.老师受到尊重是因为你传授的东西他人认可,而不该是因为“老师”两个字.另外,成年人会去请家教的,往往是自己有一些长处的.你只是一方面的老师,人家可 ...

  9. Java中的回调函数

    本例拿apache commons dbutils举例 回调函数: 回调是指在执行时,具体的封装处理工用由第三方的类来实现. 回调一般由两部分组成 1:调用类 - QueryRunner.实例类 2: ...

  10. 在Ubuntu上安装有道词典

    4月20日,由有道词典和Deepin团队共同完成的有道词典Linux版终于上线了,首先 推出Deepin和Ubuntu两个系统版本及其他版本的二进制包,估计以后还会有RPM 等版本.有道Linux版界 ...