Replied to the other one of these, so see thread there, thanks!
On Wed, Apr 16, 2014 at 3:20 PM, Beau Simensen <[email protected]> wrote: > Hi all! > > I've been digging Ansible on the first few days I've been trying to play > with it. I ran into some complications with mount, though. My use case is > that I want to add the "acl" option to the "/" mount. If I want to try and > have the mount module just add that option (or just set the options) I have > a whole bunch of other values I need to know (source and fstype) and if I > don't specify some others (dump and passno) then they get set to default > values. > > Ideally what I'd like to see is something where I can just set the options > for a given mount point without having to know anything else. Bonus points > for just adding or removing specific options rather than having to set the > whole lot. > > I've finally landed on the following solution but it is less than idea. My > questions are 1) is there a better way to do this that i've missed so far? > 2) would it make sense to make mount smarter so that it can default to > existing values if only a name or source are passed (basically run the > logic from this playbook internally)? 3) would it make more sense to create > something like "mount_option" that would be its own thing ("mount_option: > name=/ value=acl state=present", "mount_option: source=/dev/sda1 value=rw > state=missing")? > > > - shell: "grep ' / ' /etc/mtab | awk '{print $1}'" > register: root_device > > - shell: "grep ' / ' /etc/mtab | awk '{print $3}'" > register: root_fstype > > - shell: "OPTS=$(grep ' / ' /etc/mtab | awk '{print $4}'); if ! $( echo > \"$OPTS\" | tr ',' \"\n\" | grep -qx 'acl' ); then OPTS=$OPTS,acl; fi; echo > $OPTS" > register: root_options > > - shell: "grep ' / ' /etc/mtab | awk '{print $5}'" > register: root_dump > > - shell: "grep ' / ' /etc/mtab | awk '{print $6}'" > register: root_pass > > - mount: name=/ src={{ root_device.stdout }} fstype={{ root_fstype.stdout > }} state=mounted opts={{ root_options.stdout }} dump={{ root_dump.stdout }} > passno={{ root_pass.stdout }} > > > An unexpected and not really desired byproduct of this is that I end up > with several "changed" values in my recap because it ends up running all of > these shell commands every time. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/3a8b036b-b13d-4b24-9b18-cdff4e9ec81d%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/3a8b036b-b13d-4b24-9b18-cdff4e9ec81d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx0HwUK1EgfGzRN-3rvVga7sJYg%2BwSM_FWkpNK4nyARFw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
