ansible-playbook useful command line options

9
知ってると便利なオプション ansible-playbook useful options 若山史郎 (WAKAYAMA Shirou) ツキノワ株式会社 / Tsukinowa Inc.

Upload: shirou-wakayama

Post on 07-Aug-2015

584 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: ansible-playbook useful command line options

!

知ってると便利なオプション ansible-playbook useful options

若山史郎 (WAKAYAMA Shirou)

ツキノワ株式会社 / Tsukinowa Inc.

Page 2: ansible-playbook useful command line options

おまえだれよ? / Who are you?

• 若山 史郎(@r_rudi) / ツキノワ株式会社

• golang, python, iOS, AndroidWeb app, MQTT, Ansible

• Author of 「入門Ansible」

• in the Amazon Japan

Page 3: ansible-playbook useful command line options

—verbose (-v)

• Increase verbose level

• -v, -vv, -vvv, -vvvv, -vvvvv(v*5), -vvvvvv(v*6)

• v*6 is only in winrm (currently)

• vvv, vvvv shows ssh connection

• Many ansible trouble is related to ssh. Try -vvvv first!

Page 4: ansible-playbook useful command line options

—list-hosts, —list-tasks, --list-tags

• —list-tasks

!

!

• —list-tags (1.9-)

Page 5: ansible-playbook useful command line options

Tips: where can we put tags?

Tag for play

Multiple tags

Name for play

IncludeRole

Page 6: ansible-playbook useful command line options

Tips: special tags (1.9-)

• always

• always run

• tagged

• untagged

• can be specified with -t

Page 7: ansible-playbook useful command line options

--syntax-check

• Very helpful error message

• Useful for CI (like jenkins or CircleCI)

Page 8: ansible-playbook useful command line options

--start-at-task

• “Task failed. I wanna restart from HERE!!! “

• —start-at-task=“<taskname>”

Page 9: ansible-playbook useful command line options

-e @vars.json

• -e set additional variables from command line

• -e "version=1.23.45 other_variable=foo"

• @vars.json or @vars.yml

• load variables from specified JSON/YAML