Installing the Samba server on Ubuntu using Ansible

In this post,we’ll learn that how we can install the Samba server on Ubuntu 14.04 LTS using Ansible. If you don’t know about Ansible, please check this link.

If you want manual step by step procedure to install the Samba server on Ubuntu, please refer this post.

First, download this Repository from the GitHub:

git clone

Note: If git is not installed then you can simply download the zip file.

To use this role, edit the site.yml file:

vi site.yml

Mentioned the samba role:

 - hosts: server
   sudo: True
   gather_facts: True
    - samba

After that, edit the hosts file and enter the ip of your remote server, on which you want to perform all these tasks:

vi hosts

In my case, it is


After that edit the samba/vars/main.yml file:

Change the username(s) and their smbpassword, but these user(s) must exist on the target system. Also change the other values as per your requirement. These are self explanatory.

 workgroup: WORKGROUP
 public_share_name: public
 public_share_path: /samba/public
 private_share_name: private
 private_share_path: /samba/private
 samba_group_name: smbgrp
  - { name: 'arbab', smbpasswd: 'pass123' }
  - { name: 'hussain', smbpasswd: 'password' }

Then run this command:

ansible-playbook -i hosts -u arbab site.yml

run ansible commandNote: Please don’t forget to change arbab with your username

After successful completion of these tasks, it will show you the summary, something like this:

resultEnjoy :-)

Hope this will help you!

Please Remember me in your prayers!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: