LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-19-2017, 06:05 AM   #1
fusion1275
Member
 
Registered: Jul 2007
Location: Knaphill, Surrey
Distribution: Linux Mint
Posts: 310

Rep: Reputation: 36
Ansible playbook and need tabbed spaces in fstab


Hi all,

So I have written a playbook in ansible to build all my LVM disk requirements and is working like a charm. I have even got the script to insert the new mount points into the fstab file but I am really finding it hard to get the line tab delimited as per the other lines in fstab.

Any ideas how that is done in ansible??

Here is the code block I am using:

Code:
## Mount the filesystem
  - name: Mounting /usr/DS filesystem
    mount:
      path: /usr/DS
      src: /dev/dsvg/DSlv
      fstype: ext4
      state: mounted
Each time I attempt it I get the line all bunched up in the fstab and if I try a space I get 040 in the line. So I have tried all sorts of regex escape back and forward slashes but still cant get it to work.

Cheers.
 
Old 09-19-2017, 04:26 PM   #2
vwtech
Member
 
Registered: Dec 2007
Distribution: Fedora, Oracle Linux & Centos
Posts: 197

Rep: Reputation: 26
Show me how /etc/fstab looks after you run your playbook, so we can see the issue.
 
Old 09-20-2017, 04:03 AM   #3
fusion1275
Member
 
Registered: Jul 2007
Location: Knaphill, Surrey
Distribution: Linux Mint
Posts: 310

Original Poster
Rep: Reputation: 36
Here is the fstab entry:

Code:
dev/dsvg/DSlv /usr/DS ext4 defaults 0 0
I want it the same as the other entries with the tab delimited spaces

Code:
dev/dsvg/DSlv    /usr/DS    ext4    defaults        0 0
Any clues? ideas?

Thanks v.much
 
Old 09-21-2017, 02:44 PM   #4
vwtech
Member
 
Registered: Dec 2007
Distribution: Fedora, Oracle Linux & Centos
Posts: 197

Rep: Reputation: 26
The mount module is more focused on working instead of how we'd all like the /etc/fstab file to be formatted.
That being said you could use the lineinfile and shell modules to accomplish your goal.

- name: Add mount to /etc/fstab
lineinfile:
dest: /etc/fstab
line: 'dev/dsvg/DSlv /usr/DS ext4 defaults 0 0'

- name: Ensure items in /etc/fstab are mounted
shell: mount -a

*If you find this helpful, use the link beside "Did you find this post helpful?".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using passwords in ansible playbook pgb205 Linux - Server 1 12-27-2016 12:20 AM
ansible will not execute whole playbook DimTheo Linux - Server 1 11-23-2016 11:59 PM
Vagrant+Ansible playbooks. How to use same playbook on non vagrant provision markotitel Linux - Virtualization and Cloud 1 12-06-2013 09:00 AM
[SOLVED] editing fstab - mount point with spaces vincix Linux - Newbie 5 11-23-2012 04:09 AM
fstab and a password containing spaces kodiakmook Linux - General 2 05-15-2002 11:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration