New FAMILUG

The PyMiers

Sunday, 21 June 2015

[SaltStack] Chào Muối, em là ai?

Title phụ: How to fall in love with SaltStack?

Update: tham gia hội người dùng Salt tại Việt Nam https://www.meetup.com/VietNam-SaltStack-Meetup/

Muối, một cô gái 25 tuổi, sống nội tâm, một mình ở nơi toàn sắp thép, luôn được bao quanh bởi những anh chàng IT khô cằn mà mỗi thằng đều dấu dưới chân mình một cái giếng ngập tràn chất lỏng (nước?).
Muối không hoàn hảo, như tất cả mọi thứ trên hành tinh này.
Muối không dễ được yêu, bởi Muối chỉ dành cho những ai cần đến cô.
Nhưng Muối đơn giản (YAML), muối nhẹ nhàng (lightweight ~ 50MB RAM), dù nhiều khi hơi phũ phàng trước thay đổi (upgrade PITA).
Muối chẳng cần phải so sánh mình với ai, bởi đấy không phải cách một kẻ yêu bản thân mình sẽ sống.

Muối là tên gọi hư cấu mà tác giả dành cho SaltStack, một điều đặc biệt đã thay đổi cuộc đời anh, mãi mãi.

1. SaltStack là gì?
SaltStack (từ đây gọi tắt là Salt) là một phần mềm mã nguồn mở, một hệ thống thuộc nhóm Configuration management, viết bằng Python, sử dụng YAML làm ngôn ngữ giao tiếp với người dùng.

2. SaltStack làm gì?
- tính năng của Salt chia làm 2 phần chính: remote executionconfiguration management dựa trên nền tảng remote execution.
- Remote execution: chạy lệnh từ xa. Tức sau khi cài đặt xong salt-master (daemon đóng vai trò server) và các salt-minion (các daemon đóng vai tròn client), từ salt-master có thể chạy bất kì câu lệnh nào trên máy cài salt-minion.
Tưởng tượng bạn cần xoá 1 key SSH trên 10 hay 100 máy, chỉ cần gõ 1 câu lệnh và tất cả các minion sẽ chạy câu lệnh ấy. Sức mạnh là vô cùng khủng khiếp, giống như nắm một mạng botnet trong tay vậy. Muốn ping 1 server từ 100 máy? gõ lệnh ``ping -c N victim``, và 100 máy sẽ cùng lúc ping đến máy đích.
Configuration management: đảm bảo trạng thái các thành phần của hệ thống. Cần đảm bảo 1 service NGINX chạy với file cấu hình nhất định, forward request đến uWSGI hay unicorn app server trên máy ấy, đã cấu hình để chạy một web application viết bằng Python với phiên bản mới nhất lấy từ 1 git repository? Salt làm được tất cả điều đó, và nó có thể đảm bảo rằng mọi thay đổi bằng tay thực hiện trên những thành phần nói trên sẽ bị thay thế bằng những gì đã định trước.

3. SaltStack dành cho ai?
Đối tượng chính là các *NIX Sysadmin (Windows cũng dùng được) hay các devops, ngoài ra những ai yêu thích việc tự động hoá cũng có thể sử dụng Salt, không ít người dùng Salt để quản lý chính chiếc máy làm việc của mình.

- Remote execution: cho những người cần chạy 1 câu lệnh trên nhiều máy cùng một lúc (VD: quản lý cluster)
- Configuration management: document hệ thống, đảm bảo thống nhất cấu hình, tự động việc deploy.
Khi một hệ thống được quản lý hoàn toàn bằng một bộ "Formula", mọi bước cài đặt, cấu hình đều được ghi lại thành các state ở dạng YAML, không có bước nào có thể bị giấu đi làm bí mật riêng, toàn bộ hệ thống đều được document. Khi cần triển khai một hệ thống tương tự, chỉ cần nhập các tham số cần thiết và chạy bộ formula, một hệ thống mới tinh sẽ được thiết lập trong giây lát (vài phút :)) ).

Công việc của mỗi sysadmin hàng ngày là cài đặt phần mềm, cấu hình cho phù hợp với mục đích, vận hành, troubleshooting khi có lỗi, monitor xem có chạy ổn định không, backup ...
SaltStack là công cụ để tự động bước cài đặt, cấu hình và backup, là công cụ hỗ trợ vận hành và troubleshooting, cũng có thể dùng để monitor.

4. Yêu cầu kiến thức
- biết đọc tài liệu Tiếng Anh
- có khả năng học sử dụng YAML - thuộc loại dễ hơn cả HTML (sẽ dần dần được hướng dẫn theo tutorial của Salt)
- biết mình muốn làm gì với Salt (nấu ăn?)
- KHÔNG CẦN biết lập trình Python.

5. Cài đặt
- Salt có thể chạy một mình, không cần phải có 2 máy mới chạy được.
Mỗi salt-minion có thể tự vận hành, không cần đến salt-master. Nên để cho đơn giản, cho đến khi đã cảm thấy thoải mái với các tính năng của Salt thì không cần thiết biết đến salt-master.
- Trên Ubuntu, cài bản mới nhất (hiện tại là 2015.5) từ PPA:
sudo add-apt-repository ppa:saltstack/salt
xem hướng dẫn chi tiết ở đây (http://docs.saltstack.com/en/latest/topics/installation/ubuntu.html)
Các OS khác xem ở http://docs.saltstack.com/en/latest/topics/installation/index.html

6. Bắt đầu
Làm theo hướng dẫn của phần master-less http://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html
Học viết salt states/formulas theo hướng dẫn http://docs.saltstack.com/en/latest/topics/tutorials/index.html#states
Trong quá trình này sẽ được sử dụng 2 thành phần quan trọng để làm Salt trở nên linh hoạt là salt grains và salt pillar.

Tham khảo các formula có sẵn: https://github.com/saltstack-formulas

7. Gì nữa?
- Nếu gặp khó khăn, có thể vác đi hỏi: http://docs.saltstack.com/en/latest/topics/index.html#salt-community
- Xem đầy đủ các tính năng của Salt ở : http://docs.saltstack.com/en/latest/

(còn tiếp...)
hvn@familug.org

42 comments:

  1. The market review segment of the report grandstands the market's elements and patterns, for example, the drivers, limitations, and openings that impact the ebb and flow nature and future status of this market. ai courses

    ReplyDelete
  2. This article we hope, has been able to provide some clarity on data science and its training. artificial intelligence certification

    ReplyDelete
  3. Mindblowing blog appreciating your endless efforts in developing a truly transparent content. Which probably the best one to come across disclosing the content which people might not aware of it. Thanks for bringing out the amazing content and keep sharing more further.

    360DigiTMG PMP Certification Course

    ReplyDelete
  4. Buy tiktok likes from this site https://soclikes.com/buy-tiktok-likes if you want to post video on tiktok

    ReplyDelete
  5. A debt of gratitude is in order for the blog entry amigo! Keep them coming...
    Best Digital Marketing Courses in Hyderabad

    ReplyDelete
  6. Your content is very unique and understandable useful for the readers keep update more article like this.
    data science courses

    ReplyDelete
  7. This is an excellent post I saw thanks for sharing it. It is really what I wanted to see. I hope in the future you will continue to share such an excellent post.

    best data science institute in hyderabad

    ReplyDelete
  8. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
    Data Science Course in Bangalore

    ReplyDelete
  9. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
    data analytics course in bangalore

    ReplyDelete
  10. I am glad to discover this page. I have to thank you for the time I spent on this especially great reading !! I really liked each part and also bookmarked you for new information on your site.
    Data Science Course Syllabus

    ReplyDelete
  11. Stupendous blog huge applause to the blogger and hoping you to come up with such an extraordinary content in future. Surely, this post will inspire many aspirants who are very keen in gaining the knowledge. Expecting many more contents with lot more curiosity further.

    data science course in faridabad

    ReplyDelete
  12. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
    data scientist training in malaysia

    ReplyDelete
  13. This post is very simple to read and appreciate without leaving any details out. Great work!
    ai training in aurangabad

    ReplyDelete
  14. Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog.
    data science training in malaysia

    ReplyDelete
  15. Nicely written article. Thank you for this. The international tourist who wish to travel to Kenya should apply for Kenya visa application online. Applying online saves time and provide you the best services where you can check the kenya visa requirements for us citizens and other information very easily.

    ReplyDelete
  16. I have bookmarked your site since this site contains significant data in it. You rock for keeping incredible stuff. I am a lot of appreciative of this site.

    ReplyDelete
  17. 360DigiTMG, the top-rated organisation among the most prestigious industries around the world, is an educational destination for those looking to pursue their dreams around the globe. The company is changing careers of many people through constant improvement, 360DigiTMG provides an outstanding learning experience and distinguishes itself from the pack. 360DigiTMG is a prominent global presence by offering world-class training. Its main office is in India and subsidiaries across Malaysia, USA, East Asia, Australia, Uk, Netherlands, and the Middle East.

    ReplyDelete
  18. I am another customer of this site so here I saw various articles and posts posted by this site,I curious more energy for some of them trust you will give more information further.https://360digitmg.com/course/data-analytics-using-python-r

    ReplyDelete
  19. Excellent effort to make this blog more wonderful and attractive.
    data analytics courses aurangabad

    ReplyDelete
  20. İnstagram takipçi satın al! İnstagram takipçi sitesi ile takipçi satın al sende sosyal medyada fenomen olmaya bir adım at. Sende hemen instagram takipçi satın almak istiyorsan tıkla:

    1- takipçi satın al

    2- takipçi satın al

    3- takipçi satın al

    ReplyDelete
  21. Thank you so much for your great information visit naturesbox.in also

    ReplyDelete
  22. Hii,
    This is great and awsome post for me. i loved to read your blog. it's really-really amazing. thanks for inspired me by your blog.
    Buy Online Pure & Natural Essential Oils
    Buy Body Massage Essential Oil Online
    Buy Hair Essential Oil Online Lowest Price
    Buy Skin Essential Oil Online For Men/Women

    ReplyDelete
  23. With the usage of AI tools, the developers can detect the customers' behavior about a particular website.
    data science training in ahmedabad

    ReplyDelete
  24. Thank You Mr Blogger . For this informative blog . If you want to know more about the Azerbaijan visa you can visit our Azerbaijan e visa website . And read here all the important info about the Azerbaijan visa or evisa.

    ReplyDelete
  25. It's late finding this act. At least, it's a thing to be familiar with that there are such events exist.
    I agree with your Blog and I will be back to inspect it more in the future so please keep up your act.
    360DigiTMG data science course

    ReplyDelete
  26. Get Data Science Certification from top-ranked universities UTM, Malaysia, and IBM.
    data analytics course in pondicherry

    ReplyDelete
  27. Your article is easy to read and understand. I would like to read more articles like this. Getting a Turkey e visa online is a hassle free process. It saves time and money as well.

    ReplyDelete
  28. There are many types of information technology like PCs, sensors, robots and choice emotionally supportive networks. managed it services newcastle

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. Thank you so much for bringing this blog to my attention. It was simple to grasp. Individuals will benefit greatly from it. This is a fantastic blog.

    digital marketing agency in Hyderabad, India

    ReplyDelete
  31. The following are three of the most well-known content creation botches individuals make.
    ChatGPT Prompts

    ReplyDelete