--- - name: Set up Docker Swarm hosts: swarm tags: [swarm-init] roles: - dns-client - docker - docker-swarm - swarm-bootstrap - name: Mount extra shares tags: [extra-shares] hosts: swarm vars: shares: # I can't seem to use a domain name, so unfortunately, we have to hard- # code the IP address - src: //10.0.0.160:/stingray path: /mnt/stingray-cifs opts: rw,_netdev,hard,intr,nobrl,username=stingray,password={{ secrets.stingray_password }} fstype: cifs state: unmounted - src: //10.0.0.160:/lfs-media path: /mnt/media-cifs opts: rw,_netdev,hard,intr,nobrl,username=mediadm,password={{ secrets.mediadm_password }} fstype: cifs state: unmounted - src: truenas.local:/mnt/emc14t9/lfs/media path: /mnt/media opts: rw,_netdev,hard,intr,nolock fstype: nfs state: mounted tasks: - name: Ensure mount directory exists become: true file: path: "{{ item.path }}" state: directory mode: '0755' loop: "{{ shares }}" - name: Mount media share become: true mount: src: "{{ item.src }}" path: "{{ item.path }}" opts: "{{ item.opts }}" state: "{{ item.state | default('mounted') }}" fstype: "{{ item.fstype }}" loop: "{{ shares }}"