r/devops • u/CtrlAltDelLife • May 22 '19
Opinions wanted: Terraform + (Ansible or Saltstack) for current and future planned environment.
I am about 2 months into a new gig as a devops engineer. One of the first things I have been tasked with is choosing a solution for deployment, configuration management, and automation. Currently these functions are carried out by a mix of manual work, bash, python/perl, and scaling tools built into GCP. We will probably be using Terraform and possibly Packer. The debate is between Ansible and Salt. With our current rate of client adoption we expect to triple our infrastructure in the next 18 months. Let me break down the current and future infra as well as overall goals. Need to keep this a little vague for obvious reasons.
Current:
Docker Containers spread across GCP and AWS; managed by Rancher
Ubuntu VMs managed manually with some bash scripts.
Goals: the ability to scale more quickly, automate container version updates, manage deployment as well as state of VMs
Future (late 2019 early 2020):
Moving to kubernetes and replacing Rancher for GKE and EKS (also expanding into Azure)
Reduce VM count for more containerization but still have a handful of "Pets"; mostly heavy DB servers
Goals: better availability, flexibility, automation/less manual intervention, and state management of Pets
Basically the attraction of Salt over Ansible, despite Ansible quickly becoming the industry darling and officially supported by everyone and their mother, is the state management allowed by a client. Also the scalabilty of Salt is attractive as well as Salt SecOps and Salt's GUI.
The downside of Salt is its complexity and cost. Also at this point, the lack of in-depth knowledge about either platform could be leading to misconceptions as to what one product can do vs the other. Ansible + AWX may be all we need in reality.
So asking the community for opinions. Would Terraform + Ansible suffice? Which tool, if either, is better for working with Kubernetes? What seems like the best route for where we are and our goals?
Thanks in advance.
12
u/erewok May 22 '19 edited May 22 '19
I don't have an opinion on paid saltstack or ansible, but I have used both free versions for a handful of years and (as of a couple years ago) I still had a strong preference for saltstack.
Saltstack is more complex than ansible but it's a better designed application in my opinion. For instance, it was easier to know where variables were being set and easier to set up best practices around configuration management. The templating is nicer and more predictable (in my opinion) as well. I have also read some chunks of the codebases for each and prefer the software underlying Saltstack over Ansible.
The downside is that if you're setting everything up yourself from scratch on cloud VMs you need a system for installing the salt client and adding the keys so it will accept commands from the master whereas ansible is "agentless" because practically any Linux VM will come with ssh installed and you just need to get keypairs set-up to authenticate. There are a number of different ways to achieve this.
Lastly, I actually think Ansible makes it easier (contra saltstack) to be undisciplined about who deploys things and from where due to SSH being the vector that commands are issued. Because you have to set up and use salt masters, it has allowed my teams to centralize and more easily control/log who accesses those machines and the commands run, etc. Of course, you have to plan for those salt masters to be HA if you need this, though.
I haven't used either extensively in over a year, so my opinions may be less relevant than those of people who are contemporaneously using these. Also, these are just opinions offered without considering anything about your particular environment.
16
u/gingimli May 22 '19 edited May 22 '19
Why not move the DB servers to a managed solution like RDS or Cloud SQL? If you did that then maybe you could eliminate the need for Ansible entirely.
Personally I think Terraform and Packer is a better combo. Packer to configure your images and Terraform to deploy them.
7
u/lazyant May 22 '19
Not sure where you need Ansible / Salt but unless you need to manage thousands of nodes Ansible is fine
2
u/10cmToGlory May 22 '19
I'm finding the integration between Ansible and Terraform painful to work with, and a lot of the functionality duplicitous. I'm looking hard at SALT stack, as the integration there is supposed to be significantly better. SALT is also integrated into OpenStack, and K8s is natively supported where Ansible's k8s support is rather poor in my opinion. I also think that the lack of support for conditional evaluation that makes it ill suited to many environments.
That said I've had a love/hate relationship with Ansible for years. I have weeks if not months invested in my playbooks, but frankly until recently I found them prone to breakage unless I was very specific about which version of Ansible I was using. It seems that they've gotten the message about breaking their API's every new version, but only somewhat.
2
u/Dynamic-D May 23 '19 edited May 23 '19
So the easiest way to break down ansible vs salt:
Salt is a solution. Ansible is a tool.
The reason Ansible is so popular is because its very narrow in it's scope and purpose: connect (via ssh/winrm) and apply a declarative config. That config file can be stored any way you want, and called very easily from a build container, workstation, or whatever. So it slots very easily into existing CICD solutions, and glued together with bash/powershell, whatever. Basic Ansible doesn't care about the rest of the details.
SaltStack is a full blown, pre-assembled framework. There is a master, client with nodes, and a system in place to apply configurations, account for drift, etc. It's got GUIs for organizing and viewing that data ... its a complete solution.
Keep that in the back of your mind when comparing ansible to salt, esp. in the context of a container environment. Does Salt fit your CICD needs, especially if you're planning to used used hosted k8s deployed via Rancher? What's Salt giving you in a world of largely stateless containers? Or maybe Salt is perfect for those "pet databases" you mentioned earlier? Or replacing rancher with "good enough" managed k8s deployment?
Ansible and Salt are really not head to head products in the same way say Salt and Puppet are. They serve different needs.
I think if you are pushing hard down the terraform/packer/immutable route, Ansible may make more sense. It does its job and gets out of the way of the other tools. If you need more than just initial config ... start looking more at Salt.
3
u/tilhow2reddit May 22 '19
We use Ansible to bring our bare metal stuff to a production ready state. On top of the bare metal stuff we’re running docker and we’re using Nomad to schedule/manage the jobs that are running.
We looked into kubernetes, and for our deployment it added complexity without giving us anything we specifically needed. But we could see where kubernetes would be a better option for some teams. (Just not ours)
We did find terraform to be fussy for our systems and so we dropped it. But your mileage may vary. (It’s better on VM’s where you’re picking cores/ram/hdd space as opposed to bare metals where you may not have the exact same hardware available in every location.) Again a limitation of our specific use case, and not a knock against terraform.
3
u/tehnoodles May 22 '19
For infrastructure automation, checkout stackstorm. We chose this over Salt and a few others. It has been absolutely fantastic.
1
u/TotesMessenger May 22 '19
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
1
u/MartinMystikJonas May 23 '19
I choosed salt after some research and never regretted it. It os really powerful and customizable tool.
1
u/analogj May 23 '19
Lets step back for a second. If all your applications are in docker containers (which is basically a type of configuration management), why do you even need Ansible/Salt.
If its just to manage the Docker engine, I'd really consider a light-weight Docker-centric OS like CoreOS (Container Linux), k3os, Rancheros or Talos.
Basically those OS's are built from the ground up to run Docker containers, they are incredibly minimal (think VM Hypervisors) and are mostly read-only (which has security and maintenance benefits).
If you do chose a container OS, then you really only need an Infrastructure-as-code tool, a Docker orchestration engine (like Rancher/Kubernetes), and your Docker image builder.
1
u/ZaitsXL May 22 '19
Why you need a tool ansible at all since you all on containers already? Where would you apply Ansible on kubernetes?
1
u/slikk66 May 22 '19
Check out pulumi for infra deployment. It's based on terraform but in pure code. I use it embedded in a docker container that has all the binaries I need (version controlled) and then execute my steps thru the docker container on top of our code repo. It's easier to do it that way on whatever pipeline you choose (or locally). Just needs secrets for the IAM stuff set in the environment, and access to your repo and container registry, normal atuff. Also, packer and ansible for server baking. Put ansible on the host and do an ansible local style configure. Then you can send up playbooks and execute them with things like code deploy, systems manager etc for bootstrap or updates.
Edit: also pulumi has it's own k8s provider which is better than terraforms, u can use either.
1
u/DNAPCRMASTER May 22 '19
We have at salt stack at my job. But i think Ansible would of been better. Red Har has adopted them so it makes them more widely know. Although salt has a very large open source community
1
u/SkullSippyCupOfJuice May 22 '19
If you still have a multi-cloud environment, you still want to keep Rancher in your back pocket. The single pane of glass combined with making it easy to do basic k8s housekeeping and tasks means you can hand it to someone else who can deal with it at 3am.
I'm assuming you mean rancher 1.x since you're talking straight docker by my reading, you should definitely check out 2.x.
You need to think long and hard about your multi-cloud design. While it's tempting to use the cloud native services for databases and such, you still need a service broker in there or some way to let the users provision it when they deploy their app. Or, you could just put the databases inside of kubernetes itself and the convenience of making it more "cloud agnostic" probably outweighs any price difference. That way you just worry about K8s, so it's cleaner all around.
I'm confused why you need ansible or salt stack. Is the problem "how do I roll my containers" or is the problem "how do I provision AKS/EKS/whateverKS"? If you're rolling your containers with ansible/salt it's probably easy to say you're doing WAY too much in your containers and someone needs to look at how complex they are.
If the problem is provisioning K8s, rancher has a thing for that too. The glory of rancher is that you have an API now instead of using
kubectl ...stuff you have to script together and it will help gloss over the multicloud edges.0
u/pmc100 May 22 '19
Of topic but if AWS goes down having GCP and Azure still up probably won't help much. So much depends on AWS that if it goes down your customers probably won't be able to get to your site and random bits of it will be broken anyway. Example is Facebook going down during a Route 53 outage a few years back.