Newbie: Need best practice advice on ansible used as configuration manager.

I build simple servers for customers. Like, email, ftp, webserver and samba.

Just started using ansible and it is great for setup and reuse of work. I am using roles from ansible galaxy.

Each server is independent. That means I do not have a cluster of servers to manage. The most I can think of now that will be like a cluster is to do a yum update for all the servers. Having said that, most of the time each server is independent.

I can get the server installed with the necessary packages using roles. So my playbook file looks something like this.

roles:

  • network
  • epel_repo
  • common
  • samba

task:

  • name: Create groups
    task:
  • name: Create users
    task:
  • name: Upload smb.conf
    task:

What is the best practice method to manage the configuration? What is a good folder structure?

Currently I have, after reading http://docs.ansible.com/ansible/playbooks_best_practices.html#directory-layout

ansible
-filter_plugins
-group_vars
-host_vars
-library
-roles

Then I have the playbook file like “fileserver.example.com.yml”

Where should I store my config files for fileserver.example.com? There is no “files” folder in ansible root. For example, where do a store smb.conf that is only meant for fileserver.example.com?

Do I just create the following?

ansible
-filter_plugins
-group_vars
-host_vars
-library
-roles
-files
-fileserver.example.com
-etc
-samba
-smb.conf

Would this be best practice? Need advice.

Similarly for templates too. Where do I store the templates for fileserver.example.com?

My objective is to change the config files locally and run ansible to change them in the server. Not sure how to organize it all. Especially when there are a few servers. Most of the servers are unique and independent.

I hope, I am making sense and it is clear.

In your situation I would avoid having separate configuration files as
much as possible. I would go for a template for e.g. smb.conf, that
fits all hosts. I would guess this file is rather similar on all your
servers...

Johannes

Thank you for the advice. I will try to make smb.conf as a template.