Skip to main content

Ansible trên windows server

14,May 2019

1. Cài đặt ansible trên Windows sử dụng Cygwin

+ Cách 1: Download Cygwin tại địa chỉ https://www.cygwin.com/install.html , sau đó chạy câu lệnh 

setup-x86_64.exe -q --packages=binutils,curl,cygwin32-gcc-g++,gcc-g++,git,gmp,libffi-devel,libgmp-devel,make,nano,openssh,openssl-devel,python-crypto,python-paramiko,python2,python2-devel,python2-openssl,python2-pip,python2-setuptools,apt-cyg

+ Cách 2: Download Cygwin tại địa chỉ https://www.cygwin.com/install.html , sau đó chạy câu lệnh

setup-x86_64.exe

In ‘Select Packages’

  • Select Category dropdown and search for lynx
  • Go to All -> Web -> lynx: A text-based Web Browser
  • Select latest version
  • Click next to complete installation

Install apt-cyg

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin  ;Install apt-cyg
apt-cyg install binutils curl gcc-core gmp libffi-devel libgmp-devel make python python-crypto python-openssl python-setuptools python-devel git nano openssh openssl openssl-devel

+ Download và cài đặt PyYAML và Jinja2

https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz
https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz
tar -xzvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz
cd PyYAML-3.10
python setup.py install
cd Jinja2-2.6
python setup.py install

Hoặc 
apt-cyg install git python-{jinja2,six,yaml}

 

+ Cài đặt Ansible 

git clone https://github.com/ansible/ansible /opt/ansible

nano bash_profile
# Ansible settings
ANSIBLE=/opt/ansible
export PATH=$PATH:$ANSIBLE/bin
export PYTHONPATH=$ANSIBLE/lib
export ANSIBLE_LIBRARY=$ANSIBLE/library

Administrator@vm-kv-system2 ~
$ source ~/.bash_profile

Administrator@vm-kv-system2 ~
$ ansible --version
ansible 2.9.0.dev0
  config file = None
  configured module search path = [u'/opt/ansible/library']
  ansible python module location = /opt/ansible/lib/ansible
  executable location = /opt/ansible/bin/ansible
  python version = 2.7.16 (default, Mar 20 2019, 12:15:19) [GCC 7.4.0]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

+