官术网_书友最值得收藏!

How to do it...

Consider the following playbook which we can execute without an inventory:

---
- hosts: localhost
tasks:
- name: get value
debug:
msg: "The value is: secret-value"

To execute this, we can just run the ansible-playbook command with this playbook:

$ ansible-playbook playbook.yml
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
PLAY [localhost] ***************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [include secret] **********************************************************
ok: [localhost]
TASK [get value] ***************************************************************
ok: [localhost] => {
"msg": "The value is: secret-value"
}
PLAY RECAP *********************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0
主站蜘蛛池模板: 金华市| 贡嘎县| 贵溪市| 吴忠市| 哈密市| 同仁县| 合作市| 新竹市| 丰台区| 仁怀市| 黄龙县| 德格县| 微山县| 海宁市| 澄城县| 桑植县| 深圳市| 大田县| 天祝| 临高县| 梅河口市| 通辽市| 卓尼县| 壶关县| 鄂州市| 家居| 南昌市| 岫岩| 凤凰县| 汉川市| 襄樊市| 曲松县| 芷江| 广宗县| 黑河市| 兖州市| 祁东县| 科尔| 武山县| 绵阳市| 宜宾县|