ec2_vol is not mounting the filesystem

140 views
Skip to first unread message

Igal Dahan

unread,
Jun 3, 2015, 9:26:22 AM6/3/15
to ansible...@googlegroups.com
Hi 

I have created playbook which i can provision ec2 instance and create volume to that ec2 instance but when i am connected into the instance the volume is not recognized and seems not partitioned and thus not mounted.

my questions are: 

is the ec2_vol create or attach are partitioning and mounting the new volume ? 
  if yes why its not, the playbook is listed below?
  if not what should it in order to automatically mounting it ?

  - name: Launch instances
      local_action:
          module: ec2
          image: "{{ image }}"
          instance_type: "{{ instance_type }}"
          keypair: "{{ keypair }}"
          instance_tags: '{ "Name":"{{ hostname }}" , "Group":"couchbase" }'
          region: "{{ region }}"
          group: "{{ group }}"
          zone: "{{ zone }}"
          wait: "true"
          #wait_timeout: 500
          spot_wait_timeout: 300
          count: "{{count}}"
          volumes: 
             - device_name: /dev/xvda
               volume_size: "{{volume_size}}"
      register: ec2
    
    - name: Create Volume
      local_action:
         module: ec2_vol
         instance: "{{ item.id }}"
         #id: "{{volume_id}}"
         #device_name: "/dev/xvdf"
         region: "{{ region }}"
         zone: "{{ zone }}"
         volume_size: 10
         volume_type: "gp2" 
      with_items: ec2.instances
      register: ec2_vol          

    - name: Attach Volume
      local_action:
         module: ec2_vol
         id: "{{item.volume_id}}"
         region: "{{ region }}"
         zone: "{{ zone }}"
      with_items: ec2_vol.results
      register: ec2_vol         

benno joy

unread,
Jun 3, 2015, 9:46:40 AM6/3/15
to ansible...@googlegroups.com
Hi,

Curretly the ec2_vol module only supoprts creating a new volume and attaching it to an instance. It doesnt partition them and mount them. 
probably you should use modules like 'lvg,lvol,filesystem and mount" to get the other things in place.




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/990b1337-0aa2-486b-b931-4dd331be8a9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Igal Dahan

unread,
Jun 4, 2015, 7:36:15 AM6/4/15
to ansible...@googlegroups.com
Thanks a lot 

yes i used mkfs and mount for new fs in include task file and command shell for resize2fs for resizing existing one  

Igal
Reply all
Reply to author
Forward
0 new messages