Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
d52b50cb
Commit
d52b50cb
authored
Jul 14, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7478 from sivel/rax-keypair-filepath
rax_keypair module: Allow public_key to be a path to a file
parents
87538499
73c67cea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
library/cloud/rax_keypair
+10
-1
No files found.
library/cloud/rax_keypair
View file @
d52b50cb
...
@@ -30,7 +30,7 @@ options:
...
@@ -30,7 +30,7 @@ options:
required: true
required: true
public_key:
public_key:
description:
description:
- Public Key string to upload
- Public Key string to upload
. Can be a file path or string
default: null
default: null
state:
state:
description:
description:
...
@@ -43,6 +43,7 @@ author: Matt Martz
...
@@ -43,6 +43,7 @@ author: Matt Martz
notes:
notes:
- Keypairs cannot be manipulated, only created and deleted. To "update" a
- Keypairs cannot be manipulated, only created and deleted. To "update" a
keypair you must first delete and then recreate.
keypair you must first delete and then recreate.
- The ability to specify a file path for the public key was added in 1.7
extends_documentation_fragment: rackspace.openstack
extends_documentation_fragment: rackspace.openstack
'''
'''
...
@@ -116,6 +117,14 @@ def rax_keypair(module, name, public_key, state):
...
@@ -116,6 +117,14 @@ def rax_keypair(module, name, public_key, state):
keypair
=
{}
keypair
=
{}
if
state
==
'present'
:
if
state
==
'present'
:
if
os
.
path
.
isfile
(
public_key
):
try
:
f
=
open
(
public_key
)
public_key
=
f
.
read
()
f
.
close
()
except
Exception
,
e
:
module
.
fail_json
(
msg
=
'Failed to load
%
s'
%
public_key
)
try
:
try
:
keypair
=
cs
.
keypairs
.
find
(
name
=
name
)
keypair
=
cs
.
keypairs
.
find
(
name
=
name
)
except
cs
.
exceptions
.
NotFound
:
except
cs
.
exceptions
.
NotFound
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment