Sugiro que vocĂȘ leia a decodificação do relatĂłrio de 2019 de Sergei Pechenko "Ansible - isso nĂŁo Ă© para vocĂȘ, festa!"
![](https://habrastorage.org/webt/qu/6p/ie/qu6pied7yneriwzio_7bz_mzzmu.png)
Algumas palavras sobre mim.
![](https://habrastorage.org/webt/o1/ky/xu/o1kyxuaxusmyl803qv0poxkba1g.png)
Engenheiro. Eu sei algo sobre TI e estou pronto para compartilhar esse conhecimento. Como pessoas que criam perguntas especĂficas; eles nĂŁo gostam de pessoas que querem que alguĂ©m faça tudo por eles.
![](https://habrastorage.org/webt/sw/iq/wa/swiqwarpy72jgjszumpl5vmhxpc.png)
Breve resumo da histĂłria:
- Preparando o solo.
- («bashsible»).
- ?
- , .
- .
- .
- .
- Jinja, !
![](https://habrastorage.org/webt/4b/p2/xz/4bp2xzcvqlvhps18y5ocu9ndbkk.png)
Ansible, . .
![](https://habrastorage.org/webt/zn/4g/9i/zn4g9in7l2cfvlju2fyhn7zlkjs.png)
-, . Ansible . . â . , Ansible <.. group_vars> . yaml, - , Git, . . . Ansible 5 , .
![](https://habrastorage.org/webt/3o/fo/su/3ofosu2hombis_qqg4c7dsqe-su.png)
< > . 2.1, â , , . , , , - .
â . AWS. Ansible , . . .
![](https://habrastorage.org/webt/gr/cx/qh/grcxqh4bz8xorq0chokkdadeozw.png)
â , Ansible @pro_ansible.
![](https://habrastorage.org/webt/xs/os/-r/xsos-rly8ivdv6o9qmw0umabcfg.png)
â . , , , Ansible. , . : « ?». , , .
![](https://habrastorage.org/webt/e3/jr/hc/e3jrhcf1n1afp4c31x4wvidbnwe.png)
. . , â , Ansible.
Ansible , . , . , . Ansible, , , . , â , , , , . .
, .
![](https://habrastorage.org/webt/3r/mq/_e/3rmq_eilsrqwo6awfovbfhpjrim.png)
, Ansible, Ansible. . 4 . , , . â , - . â . - «play» â , . «Playbook» â . 2 play playbook.
Ansible «all». , . Ansible â inventory. , . , . , , inventory , . . < > all, 2, 3, host3 <>. , . , ?
. . â ? , , ? , ? «» «».
![](https://habrastorage.org/webt/st/o1/vo/sto1vodtbovmhkixjebbvjlgtzy.png)
. . . , . , , «» «».
â 80% 20% , . 20% 80% . , .
![](https://habrastorage.org/webt/bg/yj/cy/bgyjcy38cdp7uqnwwwcqyzm0qjq.png)
, , . Ansible . Python .
Python , Python - . Ansible . .
, Python, . , . , , Senoir YAML Developer.
, , . â . , , , . , , .
![](https://habrastorage.org/webt/nt/xx/xl/ntxxxlfpl0btoiogrltwup4xyqg.png)
. , , , (« »). , - , , .
, , , , . , inventory, , . YaML, Senior YaML Developer, « Ansible» â , .
, . Ansible , , â . «library». . . , , â Python , , , . .
Python- - « » â - « », «module_utils». , . , . .
![](https://habrastorage.org/webt/yl/mr/n3/ylmrn3i1oip1e6fsurvqqghom8u.png)
. ? , , â . , , , IT, , , . . GPL'. . . , exception .
? Ansible. , , . . exceptions, , . . â . , , . . , , , , , .
![](https://habrastorage.org/webt/lv/s7/wb/lvs7wb1jfufr3nj78tnjqoivkfa.png)
. Changed = False. , changed â ok. . message, . â - .
. , Ansibleâ «». «host_vars». «host_vars[_]» . Ansible.
? , , ansible_facts - host_vars , . Controller , host_vars.
set_fact - . . , - , - . Python-, .
AnsibleModule, . Argument_spec â , . : « -, -». argument_spec Ansible , , ; , «» . , . , . , , .
![](https://habrastorage.org/webt/4n/mf/a1/4nmfa105ay7l4oa3jyet14mdc9g.png)
Ansible. . , - 2.4, , , , Grafana'. - «uri», bashsible, â shell, curl, JSON c Grafana' . , , Grafana' .
, , . , â , . . , «_spec», . , «file», , : , owner, group, chmod. , c . , , . .
, â - , , Ansible, , . : â .
Ansible aliases (<>). «grafana_url» «url» â . , . «required = true». - . .
, Grafana. ? . .
![](https://habrastorage.org/webt/54/xv/b4/54xvb4vlu1jokm0jgoid9ndal_e.png)
argument_spec, , . , check_mode.
, check_mode? . : , , . , , production.
production ? , . check_mode? , production. , â - . , 100 . ? , check_mode .
, , check_mode, Grafana . : Grafana, , .
, . «required_together», Ansible , , . â , Ansible , .
mutually_exclusive, . . : , , . . , . - , , , , , .
exception, .
â production , . Ansible. , - , . .
![](https://habrastorage.org/webt/9p/uw/8t/9puw8t_rau095udqhr1kw2kmsme.png)
. . , , . action plugins, callback plugins .. , «*_plugins» library " ". , , .
Ansible . , , . â , .
![](https://habrastorage.org/webt/lc/aw/lu/lcawlutf6p9z4at14cbj-tkuoaq.png)
action-. - < >. : tasks, assert . , . .
![](https://habrastorage.org/webt/vf/ff/ai/vfffai8lwzed2jbxwlx0xnh_vwe.png)
. , , - . Python- c if __name__ == '__main__'
, . . : , «run». Ansible . , .. , .
import Ansible, â action-.
![](https://habrastorage.org/webt/lk/qj/ti/lkqjtisr94sqrvy3riw-jac0p-0.png)
â , , . , . â .
![](https://habrastorage.org/webt/iz/1b/lc/iz1blcgayuxqs52cpdxikyn3scw.png)
? - . Jinja. Jinja2 (2.10). , , Ansible.
![](https://habrastorage.org/webt/xj/jo/uj/xjjoujmbx2mpwtxkfh7ub0juq0u.png)
Jinja . , . .
â , , , . . , .
â . , - Jinja, - , . , Ansible , . . , .
, , Jinja2 . , . , . Jinja .
![](https://habrastorage.org/webt/ks/td/b_/kstdb_kdfvn0xprjs2z3zpxscha.png)
â , , . - . , .
. â cache behavior = merge. . . â «combine». «combine», .
![](https://habrastorage.org/webt/sn/8a/cd/sn8acdxj2hgz-rkr34_ohe0oezc.png)
? , . group_vars/all â , - , . . group1, group2.
, «all». â hostvars. , . . - , , . . , .
![](https://habrastorage.org/webt/-v/tz/2p/-vtz2pu9tqilib0qnnd6drbeftw.png)
â2 â . , , . , .
![](https://habrastorage.org/webt/qu/dw/pi/qudwpizhh8emfiz906jifmiax98.png)
? . YaML Jinja. â «from_yaml» â .
![](https://habrastorage.org/webt/vp/xp/52/vpxp52otcedgoe3ejkoc7cmqeli.png)
, ! , Ansible , . ?
. , . ? , , Ansible, Ansible 2.4. . , «uri», REST API, Consul'. , key-value Ansible. . . backend , « ». curl â , - . , «library», requests , backend'. .
. c Zabbix - . , , . . . < >, , . , Zabbix « ».
. , Ansible .
, . â - daemon, , . «agentless» Ansible â SSH, . , , .
. : , , Ansible Tower?
Ansible Tower , , , â , .
OpenSource .
OpenSource â AWX.
.
-, , - AWX , , . Ansible- . Ansible CI/CD, jobs, Jenkins, , , Rundeck. , shell-, ansible-playbook .
, DevOps Ansible , , ?
job, , Jenkins , job . job. . . .
?
.
! , , ? , , - . , - .
-, ansible-lint, . , . ? ansible-lint? â . .
. . ?
â molecule.
! Ansible. Linux . , . , - , .
, . , , Ansible, , 5 ? , - -. , open-sourceâ ( napalm).
Linux .
Cisco , .
Terraform â , ?
Eu tive uma experiĂȘncia Ansible sem um monte de Terraform. Foi uma implantação, foi a AmazĂŽnia, foram cinco regiĂ”es. Quando, depois de duas regiĂ”es, disseram que era necessĂĄrio um terço, adicionei vĂĄrias linhas e desdobrei.
VĂdeo: