Ansible n'est pas pour vous. Sergey Pechenko

Je vous suggÚre de lire le décodage du rapport 2019 par Sergei Pechenko "Ansible - ce n'est pas pour vous bash!"



Quelques mots sur moi.



IngĂ©nieur. Je connais quelque chose en informatique et je suis prĂȘt Ă  partager ces connaissances. Comme des gens qui posent des questions spĂ©cifiques; ils n'aiment pas les gens qui veulent que quelqu'un fasse tout pour eux.



Bref aperçu de l'histoire:


  • PrĂ©parer le sol.
  • («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 – , ?


J'ai eu une expérience Ansible sans un tas de Terraform. C'était un déploiement, c'était Amazon, c'était cinq régions. Quand aprÚs deux régions ils ont dit qu'une troisiÚme était nécessaire, j'ai ajouté plusieurs lignes et déplié.


Vidéo:



All Articles