LoginSignup
6
6

More than 5 years have passed since last update.

centos7 ansible2.0 環境を構築する Vagrantfile

Posted at

手間をかけて ansible 2.0 系をインストールする意義

get_url を SNI に対応させるためです。
詳細はこちらを参照してください。

Vagrantfile

  • 192.168.33.74 はお好みのアドレスに変更してください。
  • proxy 配下でない場合は proxy についての記述を削除ください。
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "centos7"

  config.vm.network "private_network", ip: "192.168.33.74"

  if Vagrant.has_plugin?("vagrant-proxyconf")
     config.proxy.http = "http://your_proxy_host:your_proxy_port"
     config.proxy.https = "http://your_proxy_host:your_proxy_port"
     config.proxy.no_proxy = "localhost,127.0.0.1"
   end

  config.vm.provision "shell", inline: <<-SHELL
    # yum proxy
    cat >> /etc/yum.conf  <<EOF
proxy=http://your_proxy_host:your_proxy_port 
EOF

    # install ansible v2
    yum -y update
    yum install -y epel-release
    yum install -y rpm-build python2-devel python-setuptools  PyYAML python-jinja2 python-paramiko  python-six python-httplib2 python-keyczar sshpass

    cd /usr/src
    wget https://github.com/ansible/ansible/releases/download/v2.0.0.1-1/ansible-2.0.0.1.tar.gz
    tar xvf ansible-2.0.0.1.tar.gz
    cd ansible-2.0.0.1
    make rpm OFFICIAL=yes
    rpm -Uvh ./rpm-build/ansible-*.noarch.rpm

    # install python 2.7.11
    mkdir /opt/python
    cd /usr/src
    wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
    tar xvf Python-2.7.11.tgz
    cd Python-2.7.11
    ./configure --prefix=/opt/python
    make
    make install
  SHELL

end
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6