- name: Test FloatingIP
  hosts: localhost
  tasks:
    - name: Launch an instance
      os_server:
        state: present
        auth:
          auth_url: "{{ auth_url }}"
          username: "{{ username }}"
          password: "{{ password }}"
          project_name: "{{ project_name }}"
        name: server1
        image: "{{ image }}"
        timeout: 200
        flavor: "{{ flavor }}"
        security_groups: default
      when: mode == 'create'

    - name: Remove instance
      os_server:
        state: absent
        auth:
          auth_url: "{{ auth_url }}"
          username: "{{ username }}"
          password: "{{ password }}"
          project_name: "{{ project_name }}"
        name: server1
      when: mode == 'delete'
