Hi All,

I have the following playbook which i want to create 

---  
- hosts: localhost
  connection: local
  gather_facts: False
  vars_files:
     - ebs-aws/external_vars.yml
  tasks:
    - name: stop service

    - name: Connect to instance and unmount the vol 
        
    - name: Detach vol from each instances 
      ec2_vol:
        region: "{{ item.region }}"
        instance: "{{ item.instanceid }}"
        id: "{{ item.old_vol }}"
        aws_access_key: "{{ ec2_access_key }}"
        aws_secret_key: "{{ ec2_secret_key }}"
        instance: None
      with_items:
         - "{{ mappings }}"

    - name: Attach vol to each instances 
      ec2_vol:
        region: "{{ item.region }}"
        instance: "{{ item.instanceid }}"
        id: "{{ item.new_vol }}"
        aws_access_key: "{{ ec2_access_key }}"
        aws_secret_key: "{{ ec2_secret_key }}"
        volume_type: gp2
        device_name: /dev/xvdh
      with_items:
         - "{{ mappings }}"

    - name: Connect to instance and mount the vol 

    - name: start service

ebs-aws/external_vars.yml
mappings:
    - { publicip: '', old_vol: '', instanceid: '',  new_vol: '', region: 
'', az: '' }

I have a requirement  to connect to the public ip of the instance and stop 
the service and umount the volume and then detach the vol and reattach the 
volume and once done. Connect to the instance and remount the volume and 
start the service? The ec2 instances are not launched by ansible for it to 
register.

How do i accomplish this doing this per host basic? 

Regards,
Kevin

-- 
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/b97eff04-ef3d-4a63-87f0-a984645ad14b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to