티스토리 뷰

Ansible

My First Ansible Project Episode II

naleejang 2018. 5. 8. 18:55

Hello, my blog visitors~!!



In this article, 

I will try to post about my first ansible code. Actually, I drew some architecture for posting an article because I hope that you can understand my ansible code well.


My first ansible project code exist on my github repository like below. 


Github URL: https://github.com/naleejang/Ansible_Project


If you don't know about Cobbler well, you need to study Cobbler and Kickstart before looking this blog. You can study Cobbler following site. (http://cobbler.github.io/)




What is Cobbler?


According to Cobbler, Cobbler is a Linux installation server that allows for rapid setup of network installation environments.




Cobbler with Ansible Architecture


When I developed ansible playbook about cobbler, I didn't know cobbler's process well. so I had found cobbler information on the internet like google. Most blog's posting described only text and codes. so I found cobbler architecture on the internet. but I couldn't understand cobbler architecture and process. I created 3 VMs via KVM and configured test environment like below architecture.



The 3 VM's role are like below.


  • Cobbler Server : This is installation server. It needs dhcp, rsync, tftp, createrepo and apache packages for configuring Cobbler server.

  • Ansible Tower: This is ansible server with web ui. It needs credential for connecting target host via SSH, playbook codes for making Cobbler tasks automatically.

  • Test Server : This is empty bare metal server or VM using Network boot. 


After create 3 VMs, I deployed Cobbler server as refer Cobbler Quickstart Guide. 

(http://cobbler.github.io/manuals/quickstart/)

and then I deployed Ansible and Ansible Tower as refer Ansible document.

(http://docs.ansible.com/ansible-tower/latest/html/quickinstall/index.html) 

I booted test server using network boot. As soon as start to boot the test server, I could look screen like above blue picture.



Ansible Playbook Architecture


After configure test bed, I started to develop ansible playbook code as refer other people's cobbler playbook. My playbook architecture is like below.



  • add_iso_cobbler.yml : It calls cobbler-addISO's main tasks of roles if this playbook called by ansible tower.

  • remove_iso_cobbler.yml : It calls cobbler-removeISO's main tasks of roles if this playbook called by ansible tower.

  • roles : Roles are ways of automatically loading certain vars_files, tasks, and handlers based on a known file structure. Grouping content by roles also allows easy sharing of roles with other users.

    • cobbler-addISO : It includes tasks and vars for importing ISO image information to cobbler

      • tasks : process for importing ISO image to cobbler.

      • vars : variables about ISO image

    • cobbler-removeISO : It includes tasks and vars for deleting ISO image information from cobbler.

      • tasks : process for deleting ISO image information.

      • vars : variables about ISO image


Ansible Playbook Task Process


My playbook's code of cobbler-addISO task process is like below. If I don't use Ansible and Ansible Tower, I have to execute commands like following tasks everytime maybe. 


Some cobbler playbooks that I found on the ansible galaxy includes from configure cobbler server to import ISO images.




You can look my playbook code in my github repository. If you don't understand after you read this article, I recommend to study about cobbler an kickstart first.

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함