Ansible ist nichts für dich. Sergey Pechenko

Ich schlage vor, dass Sie die Entschlüsselung des Berichts 2019 von Sergey Pechenko lesen. "Ansible - das ist nichts für Sie!"



Ein paar Worte über mich.



Ingenieur. Ich weiß etwas über IT und bin bereit, dieses Wissen zu teilen. Wie Menschen, die spezifische Fragen haben; Sie mögen keine Leute, die wollen, dass jemand alles für sie tut.



Kurzer Überblick über die Geschichte:


  • Boden vorbereiten.
  • («bashsible»).
  • ?
  • , .
  • .
  • .
  • .
  • Jinja, !


Ansible, . .



-, . Ansible . . – . , Ansible <.. group_vars> . yaml, - , Git, . . . Ansible 5 , .



< > . 2.1, – , , . , , , - .


– . AWS. Ansible , . . .



– , Ansible @pro_ansible.



— . , , , Ansible. , . : « ?». , , .



. . , – , Ansible.


Ansible , . , . , . Ansible, , , . , – , , , , . .


, .



, Ansible, Ansible. . 4 . , , . – , - . – . - «play» — , . «Playbook» — . 2 play playbook.


Ansible «all». , . Ansible — inventory. , . , . , , inventory , . . < > all, 2, 3, host3 <>. , . , ?


. . – ? , , ? , ? «» «».



. . . , . , , «» «».


– 80% 20% , . 20% 80% . , .



, , . Ansible . Python .


Python , Python - . Ansible . .


, Python, . , . , , Senoir YAML Developer.


, , . – . , , , . , , .



. , , , (« »). , - , , .


, , , , . , inventory, , . YaML, Senior YaML Developer, « Ansible» — , .


, . Ansible , , — . «library». . . , , – Python , , , . .


Python- - « » — - « », «module_utils». , . , . .



. ? , , – . , , , IT, , , . . GPL'. . . , exception .


? Ansible. , , . . exceptions, , . . – . , , . . , , , , , .



. 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 , , ; , «» . , . , . , , .



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. ? . .



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. , - , . .



. . , , . action plugins, callback plugins .. , «*_plugins» library " ". , , .


Ansible . , , . — , .



action-. - < >. : tasks, assert . , . .



. , , - . Python- c if __name__ == '__main__', . . : , «run». Ansible . , .. , .


import Ansible, – action-.



— , , . , . — .



? - . Jinja. Jinja2 (2.10). , , Ansible.



Jinja . , . .


– , , , . . , .


– . , - Jinja, - , . , Ansible , . . , .


, , Jinja2 . , . , . Jinja .



– , , . - . , .


. – cache behavior = merge. . . – «combine». «combine», .



? , . group_vars/all – , - , . . group1, group2.


, «all». – hostvars. , . . - , , . . , .



№2 – . , , . , .



? . YaML Jinja. — «from_yaml» — .



, ! , 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 – , ?


Ich hatte Ansible Erfahrung ohne ein paar Terraform. Es war ein Einsatz, es war Amazon, es waren fünf Regionen. Als nach zwei Regionen gesagt wurde, dass ein dritter benötigt wird, fügte ich mehrere Zeilen hinzu und entfaltete sie.


Video:



All Articles