Saya sarankan Anda membaca decoding laporan 2019 oleh Sergei Pechenko "Mungkin - ini bukan untuk Anda, bash!"
![](https://habrastorage.org/webt/qu/6p/ie/qu6pied7yneriwzio_7bz_mzzmu.png)
Beberapa kata tentang saya.
![](https://habrastorage.org/webt/o1/ky/xu/o1kyxuaxusmyl803qv0poxkba1g.png)
Insinyur. Saya tahu sesuatu tentang IT dan siap untuk membagikan pengetahuan ini. Seperti orang yang mengajukan pertanyaan spesifik; mereka tidak suka orang yang ingin seseorang melakukan segalanya untuk mereka.
![](https://habrastorage.org/webt/sw/iq/wa/swiqwarpy72jgjszumpl5vmhxpc.png)
Garis besar cerita:
- Mempersiapkan tanah.
- (Ā«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 ā , ?
Saya memiliki pengalaman Ansible tanpa sekelompok Terraform. Itu penyebaran, Amazon, lima wilayah. Ketika setelah dua daerah mereka mengatakan bahwa yang ketiga diperlukan, saya menambahkan beberapa baris dan dibuka.
Video: