Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Very Demiurge Very Mindful
Kolla Ansible
Commits
8d7920fa
Commit
8d7920fa
authored
8 years ago
by
Jenkins
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Make passwords.yml file generation configurable"
parents
cac8b397
e1b5b149
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kolla/cmd/genpwd.py
+12
-2
12 additions, 2 deletions
kolla/cmd/genpwd.py
tools/kolla-ansible
+16
-11
16 additions, 11 deletions
tools/kolla-ansible
with
28 additions
and
13 deletions
kolla/cmd/genpwd.py
+
12
−
2
View file @
8d7920fa
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
argparse
import
os
import
os
import
random
import
random
import
string
import
string
...
@@ -29,6 +30,15 @@ def generate_RSA(bits=2048):
...
@@ -29,6 +30,15 @@ def generate_RSA(bits=2048):
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
-p
'
,
'
--passwords
'
,
type
=
str
,
default
=
os
.
path
.
abspath
(
'
/etc/kolla/passwords.yml
'
),
help
=
(
'
Path to the passwords yml file
'
))
args
=
parser
.
parse_args
()
passwords_file
=
os
.
path
.
expanduser
(
args
.
passwords
)
# These keys should be random uuids
# These keys should be random uuids
uuid_keys
=
[
'
ceph_cluster_fsid
'
,
'
rbd_secret_uuid
'
]
uuid_keys
=
[
'
ceph_cluster_fsid
'
,
'
rbd_secret_uuid
'
]
...
@@ -41,7 +51,7 @@ def main():
...
@@ -41,7 +51,7 @@ def main():
# length of password
# length of password
length
=
40
length
=
40
with
open
(
'
/etc/kolla/
passwords
.yml
'
,
'
r
'
)
as
f
:
with
open
(
passwords
_file
,
'
r
'
)
as
f
:
passwords
=
yaml
.
load
(
f
.
read
())
passwords
=
yaml
.
load
(
f
.
read
())
for
k
,
v
in
passwords
.
items
():
for
k
,
v
in
passwords
.
items
():
...
@@ -67,7 +77,7 @@ def main():
...
@@ -67,7 +77,7 @@ def main():
for
n
in
range
(
length
)
for
n
in
range
(
length
)
])
])
with
open
(
'
/etc/kolla/
passwords
.yml
'
,
'
w
'
)
as
f
:
with
open
(
passwords
_file
,
'
w
'
)
as
f
:
f
.
write
(
yaml
.
dump
(
passwords
,
default_flow_style
=
False
))
f
.
write
(
yaml
.
dump
(
passwords
,
default_flow_style
=
False
))
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
tools/kolla-ansible
+
16
−
11
View file @
8d7920fa
...
@@ -28,14 +28,15 @@ function usage {
...
@@ -28,14 +28,15 @@ function usage {
Usage:
$0
COMMAND [options]
Usage:
$0
COMMAND [options]
Options:
Options:
--inventory, -i <inventory_path> Specify path to ansible inventory file
--inventory, -i <inventory_path> Specify path to ansible inventory file
--playbook, -p <playbook_path> Specify path to ansible playbook file
--playbook, -p <playbook_path> Specify path to ansible playbook file
--configdir <config_path> Specify path to directory with globals.yml
--configdir <config_path> Specify path to directory with globals.yml
--keyfile, -k <key_file> Specify path to ansible vault keyfile
--keyfile, -k <key_file> Specify path to ansible vault keyfile
--help, -h Show this usage information
--help, -h Show this usage information
--tags, -t <tags> Only run plays and tasks tagged with these values
--tags, -t <tags> Only run plays and tasks tagged with these values
--extra, -e <ansible variables> Set additional variables as key=value or YAML/JSON passed to ansible-playbook
--extra, -e <ansible variables> Set additional variables as key=value or YAML/JSON passed to ansible-playbook
--verbose, -v Increase verbosity of ansible-playbook
--passwords <passwords_path> Specify path to the passwords file
--verbose, -v Increase verbosity of ansible-playbook
Commands:
Commands:
prechecks Do pre-deployment checks for hosts
prechecks Do pre-deployment checks for hosts
...
@@ -53,7 +54,7 @@ EOF
...
@@ -53,7 +54,7 @@ EOF
SHORT_OPTS
=
"hi:p:t:k:e:v"
SHORT_OPTS
=
"hi:p:t:k:e:v"
LONG_OPTS
=
"help,inventory:,playbook:,tags:,keyfile:,extra:,verbose,configdir:"
LONG_OPTS
=
"help,inventory:,playbook:,tags:,keyfile:,extra:,verbose,configdir:
,passwords:,
"
ARGS
=
$(
getopt
-o
"
${
SHORT_OPTS
}
"
-l
"
${
LONG_OPTS
}
"
--name
"
$0
"
--
"
$@
"
)
||
{
usage
>
&2
;
exit
2
;
}
ARGS
=
$(
getopt
-o
"
${
SHORT_OPTS
}
"
-l
"
${
LONG_OPTS
}
"
--name
"
$0
"
--
"
$@
"
)
||
{
usage
>
&2
;
exit
2
;
}
eval set
--
"
$ARGS
"
eval set
--
"
$ARGS
"
...
@@ -65,6 +66,7 @@ PLAYBOOK="${BASEDIR}/ansible/site.yml"
...
@@ -65,6 +66,7 @@ PLAYBOOK="${BASEDIR}/ansible/site.yml"
VERBOSITY
=
VERBOSITY
=
EXTRA_OPTS
=
EXTRA_OPTS
=
CONFIG_DIR
=
"/etc/kolla"
CONFIG_DIR
=
"/etc/kolla"
PASSWORDS_FILE
=
"
${
CONFIG_DIR
}
/passwords.yml"
while
[
"$#"
-gt
0
]
;
do
while
[
"$#"
-gt
0
]
;
do
case
"
$1
"
in
case
"
$1
"
in
...
@@ -104,7 +106,10 @@ while [ "$#" -gt 0 ]; do
...
@@ -104,7 +106,10 @@ while [ "$#" -gt 0 ]; do
EXTRA_OPTS
=
"
$EXTRA_OPTS
-e
$2
"
EXTRA_OPTS
=
"
$EXTRA_OPTS
-e
$2
"
shift
2
shift
2
;;
;;
(
--passwords
)
PASSWORDS_FILE
=
"
$2
"
shift
2
;;
(
--help
|
-h
)
(
--help
|
-h
)
usage
usage
shift
shift
...
@@ -171,6 +176,6 @@ case "$1" in
...
@@ -171,6 +176,6 @@ case "$1" in
;;
;;
esac
esac
CONFIG_OPTS
=
"-e @
${
CONFIG_DIR
}
/globals.yml -e @
${
CONFIG_DIR
}
/passwords.yml
-e CONFIG_DIR=
${
CONFIG_DIR
}
"
CONFIG_OPTS
=
"-e @
${
CONFIG_DIR
}
/globals.yml -e @
${
PASSWORDS_FILE
}
-e CONFIG_DIR=
${
CONFIG_DIR
}
"
CMD
=
"ansible-playbook -i
$INVENTORY
$CONFIG_OPTS
$EXTRA_OPTS
$PLAYBOOK
$VERBOSITY
"
CMD
=
"ansible-playbook -i
$INVENTORY
$CONFIG_OPTS
$EXTRA_OPTS
$PLAYBOOK
$VERBOSITY
"
process_cmd
process_cmd
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment