Why file fail when directory exists?

15 views
Skip to first unread message

leam hall

unread,
Feb 15, 2018, 6:33:52 PM2/15/18
to Ansible Project
I'm creating a mount point for an ISO image, and a later task puts the mount point in fstab. Why is the file module erroring after the ISO is mounted? The directory exists so the task shouldn't try to recreate it.

###

148     - name: make_build_repo_dir
149       file:
150         path:   /var/www/html/repo/centos/6/os
151         state:  directory
152         owner:  root
153         group:  root
154         mode:   0755
155        
156     - name: iso_image_to_fstab
157       lineinfile:
158         path:   /etc/fstab
159         state:  present
160         regexp: '^/opt/iso/CentOS-6-minimal.iso'
161         line:   '/opt/iso/CentOS-6-minimal.iso /var/www/html/repo/centos/6/os iso9660 rw,loop=/dev/loop0 0 0'
162
163     - name: mount_iso_image
164       mount:
165         path:   /var/www/html/repo/centos/6/os
166         state:  mounted
167         fstype: iso9660
168         src:    /opt/iso/CentOS-6-minimal.iso
169

leam hall

unread,
Feb 20, 2018, 7:00:38 AM2/20/18
to Ansible Project
Figured it out; the playbook was trying to make the directory permission 0755 when the mounted fs is 0555.
Reply all
Reply to author
Forward
0 new messages