Ansible

Similar documents
(Microsoft PowerPoint - \201y\214\366\212J\224\305\201zENOG45.pptx)

bash on Ubuntu on Windows bash on Ubuntu on Windows bash on Ubuntu on Windows bash on Ubuntu on Windows bash on Ubuntu on Windows ˆ Windows10 64bit Wi

Clonezilla-LCA2011

Agenda 2

[1] install PY2 PY3 Fabric & Invoke Quick Guide Invoke : Python で記述するタスクランナー Fabric : SSH を使うデプロイタスクランナー Fabric, Invoke 2018 Jeff Forcier. BSD 2-Claus

インストール取扱説明書

Microsoft Word - PSB導入ガイド_ docx

A : kerl kerl Erlang/OTP Erlang/OTP 2 2 Elixir/Phoenix URL 2 PDF A.2 Bash macos.bash_profile exp

5.1.4 パッケージをインストールする サービスを 起 動 / 停 止 する 任 意 のコマンドを 実 行 する プレイブックの 条 件 制 御 条 件 分 岐 繰 り 返 し 実 行... 1

DCL intro Manual for Ubuntu11.10

Agenda インフラを取り巻く環境 Infrastructure as Code TISの取り組み Project SHIFT( 仮 ) IaCのスキルアップに向けて Copyright 2017 TIS Inc. All rights reserved. 2

Add-onアプリケーション開発 - 環境構築マニュアル -

3 Ubuntu Linux Ubuntu Linux Debian Linux DistroWatch.com 1 Debian Ubuntu Linux 1 Debian CD(4.1 ) Knoppix Debian CentOS Linux CentOS 1 Ubuntu L

GitLab + Dokku で作る CI/ CD 環境 Kazuhiro NISHIYAMA 第 78 回 Ruby 関西勉強会 2017/07/29 Powered by Rabbit 2.2.0

インストール取扱説明書

9 rbenv rbenv ruby 9.1 rbenv rbenv rbenv ruby ruby-build ruby 9.2 rbenv macos.bash_profile ~/.bash_profile ~/.bash_profile.bak $ touch ~/.bash_profile


Alibaba Cloud [ ナレッジドキュメント ] AWS EC2 から Alibaba Cloud ECS へのマイグレーション手順 (Linux 版 ) AWS EC2 から Alibaba Cloud ECS への マイグレーション手順 (Linux 版 ) Ver

Alibaba Cloud [ ナレッジドキュメント ] AWS EC2 から Alibaba Cloud ECS へのマイグレーション手順 (Linux 版 ) AWS EC2 から Alibaba Cloud ECS へのマイグレーション手順 (Linux 版 ) Ver SB

Server Backup Manager 5.0 Debian および Ubuntu システムへの Server Backup Free のインストール 1. APT-GET をしてServer Backup Free をインストールする 2. Server Backup Free のインストール

Clonezilla-LCA2011

Zabbix でミドルウェア毎に効率的に データを収集するために作った仕組みの話 株式会社サイバーエージェント Conference Japan

PowerPoint Presentation

東京エリアDebian勉強会 - 第86回 2012年3月度

Raspberry Pi3 / arm64 - Debian/Ubuntu ミートアップ in 札幌

Docker Haruka Iwao Storage Solution Architect, Red Hat K.K. February 12, 2015

IIJ Technical WEEK アプリ開発を楽にするRuby PaaS「MOGOK」について

Ubuntu Linux PC Ubuntu Linux (14.04 LTS, Trusty Tahr) 32bit CD 64bit CD 2. 32bit CPU 64bit 32bit PC CPU 32bit 64bit Windows 64bit 64bit. 32bit Core 64

108 Debian.Deb 銀河系唯一のDebian 専門誌

第168回東京エリアDebian勉強会   debianにおけるnginxの設定例

AWS Deck Template

速習!Ansible で Infrastructure as Code 2017/4/13 TAkeshi Kuramochi

# mv httpd tar.gz /usr/local/src /usr/local/src # tar zxvf httpd tar.gz make #./configure # make # make install Apache # /usr/local/apac

プレゼンテーション

[当日発表資料]AWS_Summit_CYBIRD_fix.key


Alibaba Cloud [ ナレッジドキュメント ] オンプレから Alibaba Cloud ECS へのマイグレーション手順 (Linux 版 ) オンプレから Alibaba Cloud ECS への マイグレーション手順 (Linux 版 ) Ver SB Clou

ViewSonic Corporation, Macintosh Power Macintosh Microsoft Windows Windows ViewSonic 3 OnView ViewMatch ViewMeter ViewSonic ViewSonic, ViewSonic

Raspberry Pi 2 Model B に Debian Jessie / armhf をインストールする - 第125回 2015年3月度

IaaS の基本構築パターンをGUI と Ansible で紹介 [富士通:岩松]

Debian での数学ことはじめ。 - gnuplot, Octave, R 入門

Helix Swarm2018.1アップグレード手順

TeX LiveのCIテスティング

Helix Swarm2018.1インストール手順

スライド 1

ksocket Documentation

Android Studioセットアップガイド

install1_5_1.book

楽しい開発.pptx

チーズケーキ技術 17.12

Installation Guide for Linux

FOSSology - Install from Source のススメ 1

slice00_install.dvi

test

2. Docker の基本的な操作 1 docker hub の参照 2 DockerHub の Explorer リンクからアプリケーションを参照 3 アプリケーション検索 4 tag について 3. docker 基本コマンド 1 docker の

1 Linux UNIX-PC LAN. UNIX. LAN. UNIX. 1.1 UNIX LAN. 1.2 Linux PC Linux. 1.3 studenta odd kumabari studentb even kumabari studentc odd kumabari student

PowerPoint Presentation

Alibaba Cloud [ ナレッジドキュメント ] AWS EC2 から Alibaba Cloud ECS へのマイグレーション手順 (Linux_PostgreSQL 版 ) AWS EC2 から Alibaba Cloud ECS への マイグレーション手順 (Linux_Postgre

ソフトウェアエンジニアリング - 調査 #52

演習に必要な

help gem gem gem my help

dvi

<91818C E90B690EA97708CF696B188F58D758DC0838A815B83742E706466>

プレゼンテーション

オンラインインストール 第 1.0 版 astroll developer

RouteMagic Controller( RMC ) 3.6 RMC RouteMagic RouteMagic Controller RouteMagic Controller MP1200 / MP200 Version 3.6 RouteMagic Controller Version 3

実践 Infrastructure as Code

CLUSTERPRO ファイルサーバ監視オプション編

WEBサービス超入門 mask.key

東京エリアDebian勉強会 - 第91回 2012年9月度/OSC2012 Tokyo/Fall)

untitled

事例に見るSCORMの・・・

オフラインインストール 本書では Exastro IT Automation を ITA として記載します 第 1.1 版 Exastro developer

IW2002-B5 1 Internet Week ( ) 9:30 12:30 ( ) Copyright 2002 All Rights Reserved, by Seiji Kumagai ADSL FTTH 24 IP LAN

東京エリアDebian勉強会 Debian JP Project - OSC 2017 Tokyo/Fall (第154回出張勉強会)

ANSIBLE ご紹介 AUTOMATION FOR EVERYONE レッドハット株式会社

AWS Deck Template

untitled

Alibaba Cloud [ ナレッジドキュメント ] オンプレから Alibaba ECS へのマイグレーション手順 ( イメージ移行版 ) オンプレから Alibaba ECS への マイグレーション手順 ( イメージ移行版 ) _Ver SB Cloud Corp. 2009

E2 Spider 2018/08/03 Intel NUC Core i7 PC 2.5 /M.2 SSD BOXNUC7I7BNH PC DDR4-2133(PC ) 8GBX2 260pin 1.2V CL15 SP016GBSFU213B22 WD SSD M /51

II III I ~ 2 ~

中堅中小企業向け秘密保持マニュアル


PR映画-1

- 2 -



1 (1) (2)

RouteMagic Controller RMC-MP200 / MP Version

第3回_416.ppt

MOTIF XF 取扱説明書

20 H8/3069LAN H. Fukura


28 Docker Design and Implementation of Program Evaluation System Using Docker Virtualized Environment

51 Debian

インストール取扱説明書

161 Debian.Deb 銀河系唯一の Debian 専門誌 GO

最も一般的な手法: ファイアウォールによってノード間の MPI 通信がブロックされた場合の対応方法

演習に必要な

自己紹介 指崎則夫 ( さしざきのりお ) SCUGJ 運営スタッフ Microsoft MVP

Transcription:

Ansible 2014 8 2014 8 1

1 3 1.1 Ansible..................................... 4 1.2 Ansible................................... 7 1.3 Chef Puppet... 7 1.4 Ansible Better Shell Script............................. 8 2 Ansible 9 2.1... 9 2.2 inventory................................... 12 2.3 (module)... 15 3 playbook 16 3.1 YAML... 16 3.2 playbook................................. 19 3.3 playbook... 20 3.4 task... 23 3.5 handler......................................... 24 3.6... 25 4 playbook 34 4.1 with_items................................. 34 4.2 register......................... 36 4.3 when... 36 4.4 until............................. 38 4.5 lookup... 38 4.6 filter................................. 39 4.7 vars_prompt... 39 4.8 local_action......................... 40 4.9 action.................... 40 4.10 - environment........................... 41 4.11 - ignore_errors... 41 4.12 task async........................... 42 5 playbook 44 5.1 playbook include... 44 5.2.................... 45 5.3 role................................. 46 5.4 fork..................................... 49 5.5 serial... 49 i

5.6 AWS EC2................................... 50 5.7 dynamic inventory.................. 51 6 53 6.1 ssh......................................... 53 6.2 limit............................. 54 6.3 task tag............................. 54 6.4 dry-run check... 55 6.5 task step... 55 6.6 diff..................................... 55 7 ansible-vault 57 7.1 ansible-vault................................. 57 7.2... 59 8 role Ansible Galaxy 60 8.1 Ansible Galaxy... 60 8.2 role..................................... 60 8.3 role... 61 8.4 role... 63 9 64 9.1... 64 9.2 ControlPath too long....................... 64 9.3... 65 9.4 inventory....................... 65 9.5 playbook....................... 65 9.6 python not found......................... 65 9.7 Windows... 66 9.8 ansible-playbook... 66 9.9 ansible... 66 9.10 invalid type <type list >............................. 66 9.11 Syntax Error...................... 67 9.12 ---................................. 67 9.13 Ansible............................. 67 10 68 A 69 A.1................................... 69 A.2................................... 70 A.3................................. 71 A.4 Python... 71 A.5................................. 72 B plugin 73 B.1 plugin... 73 ii

B.2 lookup plugin... 73 B.3 filter plugin....................................... 74 B.4 callback plugin..................................... 75 B.5 action plugin... 76 B.6 connection type plugin................................. 77 B.7 vars plugin... 77 C ansible config 78 C.1 default................................... 78 C.2 paramiko... 80 C.3 ssh_connection............................... 80 C.4 accelerate... 81 82 iii

Ansible Ansible Ansible Ansible Ansible Ansible 1 Ansible 2 Ansible Ansible ansible 3 playbook playbook ansible-playbook 4 playbook 3 5 playbook role 6 7 ansible-vault ansible-vault 8 role Ansible Galaxy role Ansible Galaxy Ansible 1

tboffice futoase 2

1 Ansible Ansible Ansible Ansible : Ansible GitHub (GPL v3) Ansible ( ) 300 GitHub 6000 GitHub 3

1.1 Ansible Ansible 1.1.1 ssh Chef Puppet Ansible ssh ( Python OS ) ssh UNIX OS Ansible ssh Ansible 1.1.2 Ansible 1 inventory 192.168.0.1 192.168.0.2 IP $ ansible all -m command -a "uptime" intenvory uptime playbook inventory 1.1. Ansible 4

1.1.3 Ansible Ansible 1.1.4 (Idempotency) spam 2 spam Ansible Ansible 1.1.5 shell script Ansible script shell script shell script 1.1.6 Ansible Python Python 2 inventory playbook YAML 1.1. Ansible 5

--- - hosts: all tasks: - name: yum yum: name={{ item }} state=present with_items: - python - ruby - name: foo.sh script: foo.sh - name UTF-8 1.1.7 Ansible Batteries included( : ) htpasswd Google Computing Engine Amazon Route53 nagios ( / ) arista ( ) apache2 / Ansible HTTP Ansible Ansible 1.1.8 Ansible Ansible 1.1. Ansible 6

Chef Puppet Capistrano Fabric Ansible Ansible 1.2 Ansible Ansible Ansible Ansible 5 Simply Clear ( ) Simply Fast ( ) Simply Complete ( ) Simply Efficient (ssh ) Simply Secure (ssh ) Simply 1.3 Chef Puppet CFEngine Puppet Chef Ansible 1.1: Chef Puppet UI Chef Ruby Puppet DSL Ansible ssh YAML (Ansible Tower) Ansible ssh Chef chef-solo Ansible ssh 1.2. Ansible 7

Chef Ansible Ansible dynamic inventory Chef UI Amazon AWS CloudFormation Chef Amazon EC2 Chef Ansible Ansible Shell Script Ruby 1.4 Ansible Better Shell Script Ansible Better Shell Script Chef Puppet Ansible playbook shell script playbook playbook Ansible shell script Ansible Ansible 1.4. Ansible Better Shell Script 8

2 Ansible 1. Ansible 2. inventory 3. module 3 2.1 Ansible Ansible 2.1.1 Ansible Python 2.6 OS Python : Ansible Python3 Ansible 1.6.6 2.1.2 Ansible OS Ansible 9

ansible ansible ansible-playbook Playbook ansible-vault ansible-galaxy playbook ansible-playbook yum EPEL RPM EPEL $ sudo yum install ansible RPM $ git clone git://github.com/ansible/ansible.git $ cd./ansible $ make rpm $ sudo rpm -Uvh ~/rpmbuild/ansible-*.noarch.rpm rpm-build python2-devel apt PPA $ sudo apt-add-repository ppa:rquillo/ansible $ sudo apt-get update $ sudo apt-get install ansible deb $ make deb pkg FreeBSD $ sudo pkg install ansible 2.1. 10

Homebrew Mac OS X Homebrew $ brew update $ brew install ansible pip Ansible Python Python pip $ pip install ansible : OS X Mavericks $ sudo CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments \ pip install ansible 2.1.3 Ansible Python 2.6 2.4 2.4 # CentOS $ sudo yum install python-simplejson # Debian $ sudo apt-get install python-simplejson # FreeBSD $ sudo pkg install py27-simplejson Ansible raw Ansible $ ansible all -m raw -a yum -y install python-simplejson Ansible Ansible 2.1. 11

1. inventory 2. playbook task 3. ansible.cfg Ansible Ansible inventory inventory 2.2 inventory inventory ini ( ini ) /etc/ansible/hosts Ansible mail.example.com [web] web01.example.com web02.example.com web03.example.com [db] db01.example.com db02.example.com [webservers] [db] web01 db01 web web01.example.com web02.example.com web03.example.com 3 mail.example.com ansible ( ssh ) $ ansible all -m command -a "uptime" mail.example.com success rc=0 >> 23:51:40 up 33 days, 1:55, 2 users, load average: 1.17, 1.21, 1.20 web01.example.com success rc=0 >> 23:51:41 up 29 days, 12:22, 2 users, load averages: 0.36, 0.28, 0.18 ( ) uptime 2.2. inventory 12

db $ ansible db -m command -a "uptime" db01.example.com success rc=0 >> 23:55:11 up 33 days, 1:55, 2 users, load averages: 0.41, 0.30, 0.20 db01.example.com success rc=0 >> 23:55:11 up 29 days, 12:22, 2 users, load averages: 1.11, 1.07, 1.09 db $ ansible web02.example.com -m command -a "uptime" web02.example.com success rc=0 >> 23:58:32 up 29 days, 1:55, 2 users, load averages: 0.13, 0.20, 0.17 : www*.example.com www www[01:50].example.com www01 www50 web:db web db (or ) web!ng web ng (not ) web:&prod web prod (and ) web:!{{excluded}}:&{{required}} 2.2.1 web01.example.com ansible_ssh_port=2222 ansible_ssh_host=192.168.1.50 web01 192.168.1.50 2222 ansible_ssh_user ssh ansible_ssh_private_key_file 2.2. inventory 13

ansible_connection ssh : Linux Ansible Python /usr/bin/python FreeBSD /usr/local/bin/python ansible_python_interpreter freebsd_host ansible_python_interpreter=/usr/local/bin/python 2.2.2 ansible_ssh_port :vars [web] web01.example.com [web:vars] ansible_ssh_port=2222 ansible_ssh_user=admin web 2.2.3 children [eggservice:children] eggweb eggdb [eggweb] web01.example.com web02.example.com [eggdb] db01.example.com db02.example.com eggservice eggweb * web01 * web02 2.2. inventory 14

eggdb * db01 * db02 2.3 (module) inventory (module) setup setup IP setup inventory $ ansible all -m setup web02.example.com success >> { "ansible_facts": { "ansible_all_ipv4_addresses": [ "192.168.122.1" ], "ansible_all_ipv6_addresses": [ "fe80::a00:27ff:fe99:ebc3", ], "ansible_architecture": "x86_64", "ansible_bios_date": "12/01/2006", "ansible_bios_version": "VirtualBox", ansible_all_ipv4_addresses IP inventory module ansible-playbook 2.3. (module) 15