debops / debops-tools

Your Debian-based data center in a box
https://debops.org/
GNU General Public License v3.0
1.07k stars 116 forks source link

Please enlighten me how to workaround this particular failure I noted #174

Open lvnilesh opened 7 years ago

lvnilesh commented 7 years ago

First time using debops.

I ran debops against a target machine 10.0.1.22 in local network and noted this failure. Can you please enlighten me?

failed: [10.0.1.22 -> localhost] (item={u'subdomain': u'root-ca', u'subject': [u'o=Chromebox Certificate Authority'], u'name': u'root', u'key_size': u'4096'}) => {"changed": true, "cmd": ["./lib/pki-authority", "init", "--name", "root", "--default-sign-base", "365", "--root-sign-multiplier", "12", "--ca-sign-multiplier", "10", "--cert-sign-multiplier", "3"], "delta": "0:00:00.020428", "end": "2016-10-26 17:17:10.360078", "failed": true, "item": {"key_size": "4096", "name": "root", "subdomain": "root-ca", "subject": ["o=Chromebox Certificate Authority"]}, "rc": 2, "start": "2016-10-26 17:17:10.339650", "stderr": "./lib/pki-authority: line 111: declare: -g: invalid option\ndeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]", "stdout": "", "stdout_lines": [], "warnings": []}
failed: [10.0.1.22 -> localhost] (item={u'name': u'domain', u'key_size': u'4096', u'subdomain': u'domain-ca', u'issuer_name': u'root', u'subject': [u'o=Chromebox', u'ou=Domain CA']}) => {"changed": true, "cmd": ["./lib/pki-authority", "init", "--name", "domain", "--default-sign-base", "365", "--root-sign-multiplier", "12", "--ca-sign-multiplier", "10", "--cert-sign-multiplier", "3"], "delta": "0:00:00.009126", "end": "2016-10-26 17:17:10.529653", "failed": true, "item": {"issuer_name": "root", "key_size": "4096", "name": "domain", "subdomain": "domain-ca", "subject": ["o=Chromebox", "ou=Domain CA"]}, "rc": 2, "start": "2016-10-26 17:17:10.520527", "stderr": "./lib/pki-authority: line 111: declare: -g: invalid option\ndeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]", "stdout": "", "stdout_lines": [], "warnings": []}
lvnilesh commented 7 years ago

Seems linked to this https://github.com/debops/ansible-pki/blob/8a7fdebe4104d6249c065fb15a7bf36933fd3d8e/files/secret/pki/lib/pki-authority#L111

lvnilesh commented 7 years ago
./lib/pki-authority: line 111: 
    declare: -g: invalid option

declare: usage: 
    declare [-afFirtx] [-p] [name[=value] ...]
lvnilesh commented 7 years ago

My 10.0.1.22 is Ubuntu 16.04 not pure debian.

lvnilesh commented 7 years ago

Strange.

ssh 10.0.1.22

root@chromebox:~# declare -gA config
root@chromebox:~# 
lvnilesh commented 7 years ago

Here is the play recap:

PLAY RECAP *********************************************************************
10.0.1.22                  : ok=50   changed=0    unreachable=0    failed=1   

TASK: debops.core : Create root directories ----------------------------- 2.62s
TASK: debops.apt_preferences : Remove legacy APT preferences ------------ 1.72s
TASK: debops.secret : Create secret directories on Ansible Controller --- 1.70s
TASK: debops.core : Save local facts ------------------------------------ 1.46s
TASK: debops.core : Install local fact scripts -------------------------- 1.05s
TASK: setup ------------------------------------------------------------- 0.89s
TASK: debops.apt_preferences : Remove APT preferences ------------------- 0.85s
TASK: setup ------------------------------------------------------------- 0.79s
TASK: debops.core : Install required core packages ---------------------- 0.67s
TASK: debops.dhparam : Install encryption software ---------------------- 0.63s
drybjed commented 7 years ago

On Ansible Controller, you need at least bash 4.x for the debops.pki role to work correctly.

ypid commented 7 years ago

@drybjed Would it make sense to include a check for the Bash version also on the Ansible controller so that this becomes a little bit easier to debug?

drybjed commented 7 years ago

@ypid I thought about the same thing. Perhaps the pki-authority script could check the bash version and exit early with an error message that explains what the issue is.

ypid commented 7 years ago

Sounds good.

lvnilesh commented 7 years ago

I am using

zsh --version
zsh 5.2 (x86_64-apple-darwin15.0.0)
drybjed commented 7 years ago

@lvnilesh This doesn't really matter in the context of a script interpreter, which woul be /bin/bash. Check your Bash version, mine is:

$ bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
lvnilesh commented 7 years ago
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.