From 353db36515a8dc25e641568116dccf66b4962cfe Mon Sep 17 00:00:00 2001 From: Vic Iglesias Date: Wed, 23 Dec 2015 11:37:12 -0800 Subject: [PATCH] Update GCE PEM deprecation text and examples --- lib/ansible/modules/cloud/google/gce.py | 34 +++++++++++++++++++-- lib/ansible/modules/cloud/google/gce_lb.py | 7 +++-- lib/ansible/modules/cloud/google/gce_net.py | 5 +-- lib/ansible/modules/cloud/google/gce_pd.py | 5 +-- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gce.py b/lib/ansible/modules/cloud/google/gce.py index 88d593bf878..fe077bb09ea 100644 --- a/lib/ansible/modules/cloud/google/gce.py +++ b/lib/ansible/modules/cloud/google/gce.py @@ -76,11 +76,12 @@ options: pem_file: version_added: 1.5.1 description: - - (deprecated) path to the pem file associated with the service account email + - path to the pem file associated with the service account email + This option is deprecated. Use 'credentials_file'. required: false default: null credentials_file: - version_added: 2.1.0 + version_added: "2.1.0" description: - path to the JSON file associated with the service account email default: null @@ -163,7 +164,7 @@ options: requirements: - "python >= 2.6" - - "apache-libcloud >= 0.17.0" + - "apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials" notes: - Either I(name) or I(instance_names) is required. author: "Eric Johnson (@erjohnso) " @@ -188,6 +189,9 @@ EXAMPLES = ''' # Launch instances from a control node, runs some tasks on the new instances, # and then terminate them +# This example uses JSON credentials with the credentials_file parameter +# rather than the deprecated pem_file option with PEM formatted credentials. + - name: Create a sandbox instance hosts: localhost vars: @@ -226,6 +230,30 @@ EXAMPLES = ''' state: 'absent' instance_names: {{gce.instance_names}} +# The deprecated PEM file credentials can be used as follows +- name: Create a sandbox instance with PEM credentials + hosts: localhost + vars: + names: foo,bar + machine_type: n1-standard-1 + image: debian-6 + zone: us-central1-a + service_account_email: unique-email@developer.gserviceaccount.com + pem_file: /path/to/pem_file + project_id: project-id + tasks: + - name: Launch instances + local_action: gce instance_names={{names}} machine_type={{machine_type}} + image={{image}} zone={{zone}} + service_account_email={{ service_account_email }} + pem_file={{ pem_file }} + project_id={{ project_id }} + register: gce + - name: Wait for SSH to come up + local_action: wait_for host={{item.public_ip}} port=22 delay=10 + timeout=60 state=started + with_items: {{gce.instance_data}} + ''' try: diff --git a/lib/ansible/modules/cloud/google/gce_lb.py b/lib/ansible/modules/cloud/google/gce_lb.py index c513a325294..fce797ba3e8 100644 --- a/lib/ansible/modules/cloud/google/gce_lb.py +++ b/lib/ansible/modules/cloud/google/gce_lb.py @@ -119,12 +119,13 @@ options: pem_file: version_added: "1.6" description: - - (deprecated) path to the pem file associated with the service account email + - path to the pem file associated with the service account email + This option is deprecated. Use 'credentials_file'. required: false default: null aliases: [] credentials_file: - version_added: 2.1.0 + version_added: "2.1.0" description: - path to the JSON file associated with the service account email default: null @@ -139,7 +140,7 @@ options: requirements: - "python >= 2.6" - - "apache-libcloud >= 0.17.0" + - "apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials" author: "Eric Johnson (@erjohnso) " ''' diff --git a/lib/ansible/modules/cloud/google/gce_net.py b/lib/ansible/modules/cloud/google/gce_net.py index 3c00f88a0d5..1868a9257db 100644 --- a/lib/ansible/modules/cloud/google/gce_net.py +++ b/lib/ansible/modules/cloud/google/gce_net.py @@ -91,7 +91,8 @@ options: pem_file: version_added: "1.6" description: - - (deprecated) path to the pem file associated with the service account email + - path to the pem file associated with the service account email + This option is deprecated. Use 'credentials_file'. required: false default: null aliases: [] @@ -112,7 +113,7 @@ options: requirements: - "python >= 2.6" - - "apache-libcloud >= 0.17.0" + - "apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials" author: "Eric Johnson (@erjohnso) " ''' diff --git a/lib/ansible/modules/cloud/google/gce_pd.py b/lib/ansible/modules/cloud/google/gce_pd.py index f3df2a84bae..21433f4035f 100644 --- a/lib/ansible/modules/cloud/google/gce_pd.py +++ b/lib/ansible/modules/cloud/google/gce_pd.py @@ -97,7 +97,8 @@ options: pem_file: version_added: "1.6" description: - - (deprecated) path to the pem file associated with the service account email + - path to the pem file associated with the service account email + This option is deprecated. Use 'credentials_file'. required: false default: null aliases: [] @@ -126,7 +127,7 @@ options: requirements: - "python >= 2.6" - - "apache-libcloud >= 0.17.0" + - "apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials" author: "Eric Johnson (@erjohnso) " '''