Ansible-Developer

Ansible_playbook_变量和变量引用

2017-10-22  本文已影响98人  Michael_林

#
# Topic: playbook 基本语法和常用命令
# State:
# 1. Ansible playbook 脚本编写方法
# 2. Playbook是Ansible的最和兴的功能组件
# 3. Ansible 的配置管理和应用部署工作都是通过playbook来完成的
# Testing environment:
# OS: RHEL6.6
# Python: python2.7.5
# Ansible: ansible 2.3.1.0
# Nodes: 3
#
# 1. Playbook 基础语法


# Install Nginx

######################## Example End ############################
...

# Playbook 中的变量和变量引用

# 示例Inventory定义
#[tomat]
#ansible1
#ansible2
#ansible3
#
#[tomat:vars]
# inventory_name=michael_chacki
# 示例playbook:
# ---
# # show vars
# - name: the frist play
# hosts: tomat
# remote_user: root
# gather_facts: false
# tasks:
# - name: the first task
# debug: msg="The hostname is {{inventory_hostname}} and the key is {{ key }}, the inventory_name is {{ inventory_name }}"


# show_vars.yaml


# show_vars.yaml


# show register vars

上一篇下一篇

猜你喜欢

热点阅读