Más contenido relacionado La actualidad más candente (20) Similar a Warsztaty ansible (20) Warsztaty ansible2. „
the three great virtues
of a programmer:
laziness
impatience
hubris
— Larry Wall
12. hello, world!
at tern
h os t p
odule name
m
ansible localhost -m file
-a "path=/etc/ansible state=directory"
module args
15. facts
ansible localhost -m setup
localhost | success >> {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"172.16.0.150",
"192.168.1.132",
...
],
...
}
17. playbooks
s: t rue
r_fact
gathe
--- hosts: localhost
vars:
bles
facts
varia
- greeting: Hello
tasks:
- command: echo "{{greeting}},
{{inventory_hostname}}"
ansible-playbook hello.yml
23. yaml 101
dict key: value
- list item
--"quotes somet imes
- hosts: localhost
user: "{{some_variable}}"
mandatory"
tasks:
- debug: msg="hello, {{item}}"
with_items:
- ansible
- world
- debug: msg="another task"
24. yaml 101
yaml is a json superset
(rly!)
--[{
"hosts": "localhost",
"user": "{{some_variable}}",
"tasks": [{
"debug": "msg=hello, {{item}}",
"with_items": ["ansible", "world"]
},
{ "debug": "msg=another task" }]
}]