Using `ec2_tag` module without the state argument
currently results in:
```
failed: [127.0.0.1] => {"failed": true, "parsed": false}
```
This fix makes `state=present` the default
cs.images.find(human_id= throws novaclient.exceptions.NotFound,
resulting in the try/except block with
image = cs.images.find(name=image) being skipped. catching
novaclient.exception.NotFound allows images to be specified with the
human readable name.
Example:
tasks:
- name: Server build request
local_action:
module: rax
region: DFW
image: Ubuntu 12.04 LTS (Precise Pangolin)
Also, the import is placed after try: import pyrax, because pyrax
imports novaclient and should fail if novaclient is missing.
Line 276: no_reboot = dict(default=True, type="bool"),
This should really default to False (When AMIs are created the machine will reboot before copying the disk).
"When enabled, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed."
The `ec2_ami`, `ec2_elb`, `ec2_tag`, `ec2_vpc`, `route53`, and `s3` modules
all canonicalize the AWS access and secret key params as
`aws_access_key` and `aws_secret_key`. However, following the fixes for #4540,
those modules now use `get_ec2_creds` from `lib/ansible/module_utils/ec2.py`,
which requires access/secret key params to be canonicalized as
`ec2_access_key` and `ec2_secret_key`. As a result, AWS credentials passed
to those six modules as parameters are ignored (they instead always use
the AWS credentials specified via environment variables, or nothing).
So this change fixes those six modules to canonicalize the
AWS access and secret key params as `ec2_access_key` and `ec2_secret_key`,
allowing them to again accept AWS credentials passed via module params.
When using repositories other than the main one at docker.io, the image name contains the repo name (which itself contains ":" as a separator between domain and port). We don't really care about it here, so just get rid of it before looking at the image name.