Skip to main content

Ansible tricks - Chạy một role từ command line

Khi viết một role cho ansible role, thi thoảng tôi muốn chạy luôn role này. Hoặc có 1 role tôi clone được từ github. Đôi khi chỉ có một role thôi nên rất ngại viết hẳn một playbook đẻ chỉ chạy mỗi role đó.
ansible-role sẽ cứu rỗi ta, làm công việc nhanh chóng hơn.
Cài đặt ansible-role
sudo pip install ansible-role  
Sau khi cài đặt, ta thấy ansible-role có các options như

Ví dụ

  • Ta có 1 role ntp-client
Muốn chạy role này ta thực hiện lệnh sau
ansible-role --module-path .  ntp-client  ntp -i hosts -u root  
  • --module-path: Đường dẫn tới module
  • ntp-client: tên của role
  • -i hosts: inventory host
  • -u root: remote user
Kết quả
Ta có thể thấy hiện tại ansible-role đã hỗ trợ tất cả các tham số của ansible-playbook, do vậy ta có thể thoải mái làm việc với ansible-role mà ít bị hạn chế bởi những options.

Comments

Popular posts from this blog

Zabbix, AWS and Auto Registration

One of the things I love the most with AWS is  auto-scaling . You choose an AMI, set some parameters and AWS will spin instances up and down whenever a threshold is breached. But with all these instances spinning up and down there are some unknowns. For example, what is the IP address of the new instance? Its host name? This can be critical when other components of your infrastructure are dependent on knowing these parameters. I had this problem when I started to use  Zabbix  as the monitoring system. At first it seemed like a complicated one, but Zabbix has a wonderful feature called  Auto Registration  which can be used exactly for this situation. I will try to show how to configure auto registration both on the client (EC2 instance running Ubuntu 14.04) and on the Zabbix server (Zabbix Server 2.4.2). Zabbix-agent Installation and Configuration Let’s start with installing zabbix-agent on the Ubuntu client: 1 2 $ sudo apt-get update $ sud...

Scaling Kubernetes to 2,500 Nodes

We’ve been running  Kubernetes  for deep learning research for over two years. While our largest-scale workloads manage bare cloud VMs directly, Kubernetes provides a fast iteration cycle, reasonable scalability, and a lack of boilerplate which makes it ideal for most of our experiments. We now operate several Kubernetes clusters (some in the cloud and some on physical hardware), the largest of which we’ve pushed to over 2,500 nodes. This cluster runs in Azure on a combination of D15v2 and NC24 VMs. On the path to this scale, many system components caused breakages, including etcd, the Kube masters, Docker image pulls, network, KubeDNS, and even our machines’ ARP caches. We felt it’d be helpful to share the specific issues we ran into, and how we solved them. etcd After passing 500 nodes in our cluster, our researchers started reporting regular timeouts from the  kubectl  command line tool. We tried adding more Kube masters (VMs running  kube-apiserv...

CTI with Node + Redis

Summary In this article I'll be discussing a way to implement call data passing between disparate telephony systems, i.e., Computer Telephony Integration (CTI).  The techniques I employ in this article ( DNIS pooling, database storage of call data, etc) are nothing groundbreaking.  In fact, these techniques are as old as the hills (well, maybe not that old).  What will be new here is the use of current software architectures such as REST  with highly-efficient run-time environments such as Node.js and Redis  to realize an open data integration between 3rd party systems. This article is the culmination of a series I've written on this topic.  In Part 1,  REST calls from Genesys Routing Strategies , I discussed how to make REST web service calls from one particular vendor's CTI system ( Genesys ).  In Part 2, VXML and REST Web Services , I discussed REST web service execution from VXML applications. I'll be leveraging informa...