Assuming your AMI as the plumbing to mount NFS, mount it in the userdata
script, do your load, then unmount it.
Our userdata variable in Ansible for new instances looks like this (non-EFS
stuff removed):
user_data: |
#cloud-config
runcmd:
- file_system_id="{{ efs.efs.file_system_id }}"
- efs_directory="/mnt/efs"
[... other stuff ...]
- mkdir -p ${efs_directory}
- echo "${file_system_id}:/ ${efs_directory} efs defaults,_netdev 0
0" >> /etc/fstab
- mount -a -t efs defaults
[ ... copy some stuff off EFS ... ]
[ ... other stuff ...]
We use the EFS volume later on, so in our case we leave it mounted, and we
need the fstab entry to keep it mounted over a restart/reboot.
You would change the fstab/mount stuff to mount on /mnt/efs directly, and
add a line at the bottom to umount /mnt/efs.
You could hardcode the EFS ID, or locate it in some way (maybe via tags).
Regards, K.
On Tue, Aug 7, 2018 at 4:10 PM, containerkid <[email protected]>
wrote:
> Dear All.
> Any suggestions ?
>
> Thanks
>
>
>
>
> On Monday, August 6, 2018 at 9:04:46 PM UTC+2, containerkid wrote:
>>
>> Dear All.
>> I am working on a project where we have a scenario in which we have to
>> mount an NFS file system when each time system boots up ( we spin up using
>> AWS/GITLAB CI/CD approach) so each time when i run the pipleline i get new
>> instance with new Private ip, but my NFS( EFS in aws) will remain same and
>> the mount point also.
>>
>> Environment is as below :
>>
>> infrastructure is build in AWS via terraform
>> configuration management we are using Ansible.
>>
>> Situation is like this below :
>>
>> We have to deploy a software which is loaded in S3 bucket , when the
>> gitlab runner build the AMI we mount the NFS file system using normal way
>> of mouting using the ansible and download the binaries in the file system .
>> Once its extracted file system will umount and AWS ami creation will start.
>>
>> In the deployment phase i have to mount the file system so that RDS can
>> access will start provisioning the application environment , i think the
>> best option is autofs instead of confd ( any suggessions are welcome) but
>> if i use ansible for autofs how i can go for configuration ? i just need to
>> mount the file system during the system boot itself thats it .
>>
>>
>> Thanks
>> CK
>>
> --
> 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/f0c911a3-4469-4427-aa98-2070c20db3bf%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/f0c911a3-4469-4427-aa98-2070c20db3bf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Karl Auer
Email : [email protected]
Website: http://2pisoftware.com
GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
--
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%2B%2BT08T2c%2B8wwH6b9yY8tEHBW5cU0FOn6sHxzpgeXXmho1qEFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.