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
73c67cea
Commit
73c67cea
authored
May 21, 2014
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow public_key to be a path to a file
parent
e36a8d46
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 @
73c67cea
...
...
@@ -30,7 +30,7 @@ options:
required: true
public_key:
description:
- Public Key string to upload
- Public Key string to upload
. Can be a file path or string
default: null
state:
description:
...
...
@@ -43,6 +43,7 @@ author: Matt Martz
notes:
- Keypairs cannot be manipulated, only created and deleted. To "update" a
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
'''
...
...
@@ -116,6 +117,14 @@ def rax_keypair(module, name, public_key, state):
keypair
=
{}
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
:
keypair
=
cs
.
keypairs
.
find
(
name
=
name
)
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