Ansible Download Mac Os X



Ansible is a great tool for config management on a set of remote machines. However, Ansible can be used to execute commands locally too. My uses for Ansible include writing a'playbook' (i.e. an Ansible script) to install software locally if I get a new laptop and provisioning virtual machines in amazon's EC2.
In the this post you will see how to execute a one liner on set of hosts. More fun stuff will be in later posts. :-)
1. Firstly, install Ansible. Assuming you use homebrew (and if you are on a mac you really should be!) execute the following:

  1. Red Hat Ansible. Ansible is an open source community project sponsored by Red Hat, it's the simplest way to automate IT. Ansible is the only automation language that can be used across entire IT teams from systems and network administrators to developers and managers. About Us Our Story Press Center Careers.
  2. Simply 3 steps to install ansible on mac os x 11. Pip3 install ansible sudo mkdir -p /etc/ansible sudo nano /etc/ansible/hosts add server ip's to the hosts file web 198.20.200.211 //Replace with your client’s ip address. Check the status of the connection. Ansible all -m ping.

Where Can I Download Mac Os X

Simply 3 steps to install ansible on mac os x 11. Pip3 install ansible sudo mkdir -p /etc/ansible sudo nano /etc/ansible/hosts add server ip's to the hosts file web 198.20.200.211 //Replace with your client’s ip address. Check the status of the connection. Ansible all -m ping.



brew update
brew install ansible
2. Create a working directory.
mkdir ansible_wd
cd ansible_wd

Ansible Download Mac Os X64


3. Within your current directory create a file called Ansiblehosts and open it with your favourite editor. This hosts file will contain a list of machine names/ip addresses etc.Mac
vim hosts
4. In hosts paste the following:
[group_name]10.10
localhost
This means you have a group called [group_name] (change this to something sensible!) with one host in the group - localhost.
5. Assuming you have an RSA key set up , you need to paste your public key in ~/.ssh/authorized keys.
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Mac6. Now you are ready to run your first Ansible command:
Make sure you have your sound on and execute the following:

ansible all -i hosts -a 'say hello ansible'
What does this do?
  • 'all' means execute on all hosts
  • '- i' option means inventory which is your hosts file
  • '-a' means you are executing an ad-hoc command on the relevant hosts.
  • 'say hello ansible' is the command to be executed on every hosts. Note that on Mac OS X, say should be installed by default.

Another example to install htop locally using homebrew:
ansible group_name -i hosts -a 'brew install htop'
So you might be wondering what is the point? Why would I bother setting up Ansible to execute local commands like 'brew install htop' in a more roundabout way than simply typing the command? As mentioned at the start of the post, one useful thing you can do is add commands to an Ansible script which you can execute on any machine to install software. This will save massive amounts of time when you get your new dev machine and you can magically install everything by running one script. For me, it's open-jdk, htop, wget among other things.
You might wonder why can't you simply write a shell script to execute a series of steps? Well you could, but Ansible is a bit cleverer than that - it can manage state and do all sorts of crazy stuff which we will see in coming posts.
In the next post we will learn how create an Ansible playbook to execute statements on remote or local machines.
upgrade ansible to 2.0.2.0 on mac os x using pip
gistfile1.txt
➜ ansible-tinc git:(master) ansible --version
ansible 1.8.2
configured module search path = None
➜ ansible-tinc git:(master) sudo pip install ansible --upgrade
Password:
The directory '/Users/mwang/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/mwang/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ansible
Downloading ansible-2.0.2.0.tar.gz (1.5MB)
100% |████████████████████████████████| 1.5MB 199kB/s
Collecting paramiko (from ansible)
Downloading paramiko-2.0.0-py2.py3-none-any.whl (170kB)
100% |████████████████████████████████| 172kB 494kB/s
Collecting jinja2 (from ansible)
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |████████████████████████████████| 266kB 2.3MB/s
Collecting PyYAML (from ansible)
Downloading PyYAML-3.11.zip (371kB)
100% |████████████████████████████████| 372kB 384kB/s
Collecting setuptools (from ansible)
Downloading setuptools-21.0.0-py2.py3-none-any.whl (509kB)
100% |████████████████████████████████| 512kB 309kB/s
Requirement already up-to-date: pycrypto>=2.6 in /Library/Python/2.7/site-packages (from ansible)
Collecting pyasn1>=0.1.7 (from paramiko->ansible)
Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting cryptography>=1.1 (from paramiko->ansible)
Downloading cryptography-1.3.1-cp27-none-macosx_10_6_intel.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 196kB/s
Collecting MarkupSafe (from jinja2->ansible)
Downloading MarkupSafe-0.23.tar.gz
Collecting enum34 (from cryptography>=1.1->paramiko->ansible)
Downloading enum34-1.1.4-py2.py3-none-any.whl (61kB)
100% |████████████████████████████████| 61kB 59kB/s
Collecting ipaddress (from cryptography>=1.1->paramiko->ansible)
Downloading ipaddress-1.0.16-py27-none-any.whl
Collecting six>=1.4.1 (from cryptography>=1.1->paramiko->ansible)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting idna>=2.0 (from cryptography>=1.1->paramiko->ansible)
Downloading idna-2.1-py2.py3-none-any.whl (54kB)
100% |████████████████████████████████| 57kB 657kB/s
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko->ansible)
Downloading cffi-1.6.0-cp27-none-macosx_10_6_intel.whl (219kB)
100% |████████████████████████████████| 221kB 350kB/s
Collecting pycparser (from cffi>=1.4.1->cryptography>=1.1->paramiko->ansible)
Downloading pycparser-2.14.tar.gz (223kB)
100% |████████████████████████████████| 225kB 1.8MB/s
Installing collected packages: pyasn1, setuptools, enum34, ipaddress, six, idna, pycparser, cffi, cryptography, paramiko, MarkupSafe, jinja2, PyYAML, ansible
Found existing installation: pyasn1 0.1.7
Uninstalling pyasn1-0.1.7:
Successfully uninstalled pyasn1-0.1.7
Found existing installation: setuptools 18.3.1
Uninstalling setuptools-18.3.1:
Successfully uninstalled setuptools-18.3.1
Found existing installation: six 1.8.0
Uninstalling six-1.8.0:
Successfully uninstalled six-1.8.0
Running setup.py install for pycparser
Found existing installation: paramiko 1.14.1
Uninstalling paramiko-1.14.1:
Successfully uninstalled paramiko-1.14.1
Running setup.py install for MarkupSafe
Running setup.py install for PyYAML
Running setup.py install for ansible
Successfully installed MarkupSafe-0.23 PyYAML-3.11 ansible-2.0.2.0 cffi-1.6.0 cryptography-1.3.1 enum34-1.1.4 idna-2.1 ipaddress-1.0.16 jinja2-2.8 paramiko-2.0.0 pyasn1-0.1.9 pycparser-2.14 setuptools-21.0.0 six-1.10.0
You are using pip version 7.1.2, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜ ansible-tinc git:(master) ansible --version
ansible 2.0.2.0
config file = /Users/mwang/ansible-tinc/ansible.cfg
configured module search path = Default w/o overrides
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment




Comments are closed.