Offline Ansible Control Machine installation

2019-02-23 18:43发布

问题:

I need to install Ansible Control Machine behind a corporate firewall with no internet access. I can't find documentation for an offline install. I have access on my workstation to download anything I want and can copy it to the target machine. I have tried searching online but have not been able to find examples on how to do this. My server is Ubuntu 14.04 but if anyone has documentation for Red Hat or another distro that would also help.

回答1:

I did a testing on my RH6, so if you have a RH6 with Internet access to download all required installation file, and a RH6 installation ISO. You should be able to achieve this.

Assuming you have a RH6 which has Internet access, let's call it A. And another one doesn't have access: B.

  1. download Ansible and Jinja2 from A, and copy the files to B. For Ansible: http://docs.ansible.com/ansible/intro_installation.html Jinja2 is required for Ansible, download it here: https://pypi.python.org/pypi/Jinja2

  2. Mount the RH6 installation ISO to your RH6 B, then install the required RPM. In my case, i installed PIP as well:

rpm -ivh python-paramiko-1.7.5-2.1.el6.noarch.rpm libyaml-0.1.3-4.el6_6.x86_64.rpm PyYAML-3.10-3.1.el6.x86_64.rpm perl-TermReadKey-2.30-13.el6.x86_64.rpm perl-Error-0.17015-4.el6.noarch.rpm python-six-1.9.0-2.el6.noarch.rpm

//following required for Git rpm -ivh --force --nodeps perl-Git-1.7.1-3.el6_4.1.noarch.rpm

rpm -ivh git-1.7.1-3.el6_4.1.x86_64.rpm

Note: i didn't install httplib2 here, you can do it later.

  1. install MarkupSafe (required for Jinja2)

//install MarkupSafe

tar -xvf MarkupSafe-0.23.tar.gz

cd MarkupSafe-0.23/

sudo python setup.py install

  1. install Jinja2

//install Jinjia2

tar -xvf Jinja2-2.8.tar.gz

cd Jinja2-2.8/

sudo python setup.py install

  1. On RH6 B, you should be able to run Ansible now:

tar -zxvf ansible.tar.gz

source ./hacking/env-setup

echo "127.0.0.1" > ~/ansible_hosts

export ANSIBLE_INVENTORY=~/ansible_hosts

ansible --version



回答2:

I know this is a very old question, but I've found the answer in this blog post and I believe that could help someone out there.

Although this post aproach is on a CentOS/RHEL machine, I believe the procedure is very similar to other distros:

  1. Download the packages (RPM) dependencies
  2. Download the Ansible packages
  3. Upload the downloaded packages to the target machine
  4. Install it using yum localinstall

Or you could also install it from the source.



标签: ansible