Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
@akira6592
# #
l 2 s sns
l s .b
l 0 7 Ab
e sib
2
0 b
3
https://tekunabe.hatenablog.jp https://www.slideshare.net/akira6592/
96
4
l
l .
l 7
l 2 : :
l A
5
Ansible
Ansible
6
l Playbook
l
l
l
l
Chef puppet
Ansible
1.
•
2.
•
•
3.
•
4. Ansible
7
l Ansible YAML
insr
8
l . srd in / c bjq
l c begu
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
w : - q
u : /- a b P . / c bo
. / / : : /- : .
mh a b f R tl c b o
a b Wa_c :/ py
9
Ansible
4
3(11.
2 ( )
10
4 11.
2 ) (
123
123
123
P
l IP
l
11
6
12
02. 2 1 1 0
AWS Zabbix
l Ansible
l Playbook
12
•Linux
•Windows
•AWS
•Azure
•GCP
•Dcoker
•OpenStack
DB
•PostgreSQL
•MySQL
•MS SQL
Server
•Zabbix
•Sensu
•nagios
•Mail
•Slack
•syslog
NW
•Cisco IOS
•Juniper
Junos
•Arista EOS
13
http://docs.ansible.com/ansible/modules_by_category.html
yum yum
user
win_firewall_rule Windows Firewall
ec2 AWS ec2
azure_rm_virtualmachine Azure VM
ios_config Cisco IOS
junos_config Juniper Junos
l YAML P
l Playbook ad-hoc
14
:
/
2 2 / - 2
2
2
2 2 -2 - - 2
-2 .
::: -2
ansible.cfg
l Ansible
l SSH
l
15
16
Ansible 2.7
Ansible 2.7.0 (2018/10/04mm N
" zr i n
l 4 4 :6 G 4 7A A
bo ne cP 0I A h b
l 2 A 9A : 4 5 6A A 0I A 4 5 7 A 7
i nP 4 m b s
f k s w
S S y l
l WP 3 1 . -
17
lCHANGELOG https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst#v2-7-0
l go P t https://www.ansible.com/blog/the-release-of-red-hat-ansible-engine-2-7
ldabp uv W https://tekunabe.hatenablog.jp/entry/2018/10/04/ansible_27_nw
91
2 1 .
6 2
::::: . -
2 1
6 9
2 0 2
← l
SRSR
18
1
Web
19
1
20
:
: 6
60 2 6 . 7
60 2 66/ 0 7 1 02 66/ 7 676 1
web
172.16.0.10
web
1
Playbook
21
---
- hosts: web
become: yes
tasks:
- name: httpd package
yum:
name: httpd
state: present
- name: deploy index.html
template:
src: index.html.j2
dest: /var/www/html/index.html
- name: httpd service
service:
name: httpd
state: started
enabled: yes
vars:
v_name: world
web
sudo
yum
httpd
template
index.html.j2
/var/www/html/index.html
service
httpd
v_name world
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1
22
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>Hello, {{ v_name }} !</h1>
</body>
</html>
Playbook
Ansible Jinja2
1
Playbook
23
:@ :FK FKG = EG . -
32 7
6 1 0:KA F@ : K
GC $
6 1 AKK = : C:@
A:F@ = $
6 1 = GP F= AKE
A:F@ = $
6 1 AKK =
A:F@ = $
32 7 4. 3
$ GC* A:F@ =* LF : A: * : =*
:@ :FK FKG = EG
-i Playbook
web
httpd
changed
Index.html
changed
httpd
changed
1
24
Hello, {{ v_name }} !
v_name: world
1
25
1
https://youtu.be/7jIv_h6xQcM
→ Playbook →
26
2
27
@/
@/
6/ / 1 =
6/ 2 : =/ / 0 6/ 2 =/ = /
9
9
6/ /=@9 9 9
6/ / .7
6/ 2 : :
juons
172.16.0.1
juons
OS
2
Playbook
28
---
- hosts: junos
gather_facts: no
connection: netconf
tasks:
- name: ntp config test
junos_config:
lines:
- set system ntp server 10.0.1.123
- name: config backup
junos_command:
commands:
- show configuration
register: result
- name: save config to file
copy:
content: "{{ result.stdout[0] }}"
dest: "show_config_{{ inventory_hostname }}.txt"
juons
SSH NETCONF
junos_config
NTP 10.0.1.123
junos_config show
copy
result 0
show_config_172.16.0.1.txt
show
result
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
Playbook
29
K7= 7 * E : CE6 . - -
0 @ E 6
3 2. E = 6
7 = : $ 6
3 2. E = 7 A 6
EA $ 6
3 2. 7K E = E 6
7 = : $ 6
0 1 0
$ EA 7 = : $ 7 7 7 :
K7= 7 * E : CE6
-i Playbook
junos
changed
show configuration
2
30
c nlg nlg dlfhmX[]a _
1 L 0 LC > ADB D L L @ U DL L@
L@ L L @ L@ @ # # #
NW
: B 1>@ L @ ; > LC > ADB # # # #
6 L >C B@ . -" " -. . 874
@ LD # "5 # /
L L @
C L " @ L /
" C@ D> D
@ > @ " LL ##### /
LLC" L LLC" L 22223 ##### /
T
BD
L@ B
D /
####
L@ @ # # # /
T
T
D @ A >@L
B@" $ $
#####
Ansible
2
31
2
→ Playbook →
https://youtu.be/tE63YsOrX9Q
32
33
l Ansible
l
l Linux Windows NW
l Playbook
34
l
l
l https://docs.ansible.com/
l Getting Started
l https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html
l
l http://docs.ansible.com/ansible/modules_by_category.html
l
l https://github.com/ansible/lightbulb
l Ansible by Red Hat
l https://www.redhat.com/ja/explore/ansible
l
l Ansible 2
l https://book.impress.co.jp/books/1117101100
l Ansible
l https://www.shoeisha.co.jp/book/detail/9784798149943
35
-/ / / ./ - //
l Ansible Night
l LT
l Ansible
l
l 10/18@
l https://ansible-users.connpass.com/event/104387/
l Slack (ansiblejp)
l http://bit.ly/slack-ansiblejp
/

More Related Content

Ansibleではじめるサーバー・ネットワークの自動化 (Ansible2.7情報つき)2018/10/12