
Summary
Class Structure
InventoryManager
—-> InventoryData
InventoryData
—-> Group
—-> Host
Ansible Hack
special host variables:
- inventory_file
- inventory_dir
Special Inventory
group_vars/, host_vars and var plugin
Pattern
pattern is used in playbook after hosts field so as to select hosts satisfied the pattern
supportted pattern:
- raw
- difference !
- intersection &
- subscript such as DataNode[10], DataNode[1:10], DataNode[01:10]
- regular expression
- regular expression began with ~ will ignore subscript
1 |
# select hosts that is NameNode and ZooKeeper but not HMaster |
Playbook
- 'include' is taggable and conditional
Coding Skill
Design Skill
Include syntax is modeled by class PlaybookInclude. User can add condition, tags and vars to tasks and
include statement, so It's reasonable to create super class Conditional and Taggable for PalybookInclude
Usage Skill
Play descriptor
1 |
_name = FieldAttribute(isa='string', default='', always_post_validate=True) |
Question
- Is fact cached in Inventory?
- How to add timeout to fact gathering?
- How to discover and clean the dead worker?




近期评论