Menu

Ansible

Follow

Comments

7 comments

  • Avatar
    Alex Ruiz Estradera (Edited )
  • Avatar
    Max

    In libreoffice I see the excel file empty. I hope the .py file has standard ansible module documentation.

     

  • Avatar
    Max

    your github ansible repo fork's devel branch has diff with the file you have here.

    why?

     

  • Avatar
    Martin

    spotinst has a dependency on requests which is not installed by default.

    pip install requests

    You should update the module so it identifies the dependency. Or update the pip line in the doc above to 

    pip install requests spotinst

  • Avatar
    Rom Hirsh

    Hi Martin,

     

    Thanks for the input - i will add this to the Doc 

  • Avatar
    Martin

    Could you give an example of privateIpAddress? I have constructed this from the docs here (and by looking at the code), but I am getting an error. e.g.

        network_interfaces:
           - private_ip_addresses:
              - privateIpAddress: 172.31.15.1
              - privateIpAddress: 172.31.15.2
              - privateIpAddress: 172.31.15.3
              - privateIpAddress: 172.31.31.1
              - privateIpAddress: 172.31.31.2
              - privateIpAddress: 172.31.31.3

    {"status": {"message": "Bad Request", "code": 400}, "errors": [{"field": "body:group.compute.launchSpecification.networkInterfaces.0.privateIpAddresses.0.privateIpAddress", "message": "\"privateIpAddress\" is required", "code": "ValidationError"}]}

     

  • Avatar
    Martin

    Having spoke to SpotInst support it seems privateIpAddress is not currently supported by this module. However there is a work-around using the SpotInst API by updating the group after it has been created. i.e. Using Ansible uri module

    - name: Add PrivateIPs
      uri:
        url: https://api.spotinst.io/aws/ec2/group/{{ result.group_id }}?accountId={{ account_id }}
        method: PUT
        headers:
            Authorization: Bearer {{ token }}
            Content-Type: application/json
        body_format: json
        body: '{ "group": { "compute": { "privateIps": [ "172.31.15.1", "172.31.15.2", "172.31.15.3", "172.31.31.1", "172.31.31.2", "172.31.31.3" ] } } }'

    Setting privateIps will only work when should_persist_private_ip is set in the spotinst module call i.e.

    persistence:
       should_persist_private_ip: true

Please sign in to leave a comment.