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
d022cca6
Commit
d022cca6
authored
Aug 11, 2014
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If ansible and ansible-playbook accept a script for --vault-password-file so should ansible-vault
parent
f186bcc9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
bin/ansible-vault
+9
-15
No files found.
bin/ansible-vault
View file @
d022cca6
...
...
@@ -27,6 +27,8 @@ import os
import
sys
import
traceback
import
ansible.constants
as
C
from
ansible
import
utils
from
ansible
import
errors
from
ansible.utils.vault
import
VaultEditor
...
...
@@ -58,7 +60,7 @@ def build_option_parser(action):
#parser.add_option('-c', '--cipher', dest='cipher', default="AES256", help="cipher to use")
parser
.
add_option
(
'--debug'
,
dest
=
'debug'
,
action
=
"store_true"
,
help
=
"debug"
)
parser
.
add_option
(
'--vault-password-file'
,
dest
=
'password_file'
,
help
=
"vault password file"
)
help
=
"vault password file"
,
default
=
C
.
DEFAULT_VAULT_PASSWORD_FILE
)
# options specific to actions
if
action
==
"create"
:
...
...
@@ -106,13 +108,6 @@ def get_opt(options, k, defval=""):
# Command functions
#-------------------------------------------------------------------------------------
def
_read_password
(
filename
):
f
=
open
(
filename
,
"rb"
)
data
=
f
.
read
()
f
.
close
()
data
=
data
.
strip
()
return
data
def
execute_create
(
args
,
options
,
parser
):
if
len
(
args
)
>
1
:
raise
errors
.
AnsibleError
(
"'create' does not accept more than one filename"
)
...
...
@@ -120,7 +115,7 @@ def execute_create(args, options, parser):
if
not
options
.
password_file
:
password
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
,
confirm_vault
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
password_file
)
cipher
=
'AES256'
if
hasattr
(
options
,
'cipher'
):
...
...
@@ -134,7 +129,7 @@ def execute_decrypt(args, options, parser):
if
not
options
.
password_file
:
password
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
vault_
password_file
)
cipher
=
'AES256'
if
hasattr
(
options
,
'cipher'
):
...
...
@@ -154,7 +149,7 @@ def execute_edit(args, options, parser):
if
not
options
.
password_file
:
password
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
password_file
)
cipher
=
None
...
...
@@ -170,7 +165,7 @@ def execute_view(args, options, parser):
if
not
options
.
password_file
:
password
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
password_file
)
cipher
=
None
...
...
@@ -183,7 +178,7 @@ def execute_encrypt(args, options, parser):
if
not
options
.
password_file
:
password
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
,
confirm_vault
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
password_file
)
cipher
=
'AES256'
if
hasattr
(
options
,
'cipher'
):
...
...
@@ -200,7 +195,7 @@ def execute_rekey(args, options, parser):
if
not
options
.
password_file
:
password
,
__
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
True
)
else
:
password
=
_read_password
(
options
.
password_file
)
password
=
utils
.
read_vault_file
(
options
.
password_file
)
__
,
new_password
=
utils
.
ask_vault_passwords
(
ask_vault_pass
=
False
,
ask_new_vault_pass
=
True
,
confirm_new
=
True
)
...
...
@@ -238,4 +233,3 @@ def main():
if
__name__
==
"__main__"
:
main
()
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