Security Automation with Ansible 2
上QQ阅读APP看书,第一时间看更新

Ansible Tower, Jenkins, and Other Automation Tools

Ansible is powerful. Once you realize the innumerable benefits of writing down a way to configure and provision systems, you will never want to go back. In fact, you may want to go ahead and write playbooks for complex cloud environments to deploying stacks for data scientists. The rule of thumb is if you can script it, you can create a playbook for it. 

Let's assume that you have gone ahead and done just that. Build different playbooks for a variety of scenarios. If you see the advantages of codifying how infrastructure is built and provisioned, you will obviously want to put your playbooks under version control:

Multiple playbooks stored under version control, ready to be deployed to systems for provisioning

At this point, we have solved interesting challenges surrounding automation:

  • We now have the ability to replay commands against multiple targets
  • Remember that if the playbooks are in an idempotent manner, we can safely run them n number of times against our targets without any worries
  • By virtue of them being text-based documents, we get versioning and all the benefits that come from doing so

What is still manual is the fact that we need someone or something to execute the ansible-playbook command. Not only that, this someone or something will need to do the following:

  • Remember when to execute the playbooks
  • Schedule them accordingly
  • Store secrets safely (usually we require the SSH key to be able to login)
  • Store the output or remember to rerun a playbook if something failed

We can all aspire to be that spectacular when it comes to remembering the small things, or we can accept that these detail-oriented, scheduling-based tasks are better left to competent software rather than superhumans! 

Superhumans will have the ability to remember, schedule, execute, and notify about playbooks

It turns out we don't all have to become superhumans. We can simply use scheduling and automation tools such as Ansible Tower, Jenkins, or Rundeck to do all of what we have defined previously, and more. 

In this chapter, we will look at all the three tools that we mentioned to understand what do they offer so as to take our automation to the next level of abstraction of automation.

Specifically, we will cover the following topics: 

  • Installing and configuring Ansible Tower
  • Using Ansible Tower to manage playbooks and schedule
  • Installing and configuring Jenkins
  • Installing and configuring Rundeck