Skip to content

deploy chacra failed #286

@hjwsm1989

Description

@hjwsm1989

hosts file is

[test]
chacra1.xsky.com short_hostname=chacra1

deply.yml is

- hosts: test
  user: root
  roles:
    - common
    - repos
    - statsd
  vars:
     app_name: "chacra"
     use_ssl: true
     wsgi_file: wsgi.py
     wsgi_callable: application
     ansible_ssh_port: 22
     binary_root: "/opt/binaries"
     repos_root: "/opt/repos"
     branch: "master"
     development_server: true
     purge_repos: True
     fqdn: "{{ inventory_hostname }}"
     # required for first deploy
     api_user: "admin"
     api_key: "secret"
     # graphite reporting for statsd
     graphite_host: "3.shaman.xsky.com"
     # required
     graphite_api_key: '1234-asdf-1234'
     # callbacks
     callback_url: "https://3.shaman.xsky.com/api/repos/"
     # required for first deploy
     callback_user: "admin"
     callback_key: "secret"
     callback_verify_ssl: False
     health_ping: true
     health_ping_url: "https://3.shaman.xsky.com/api/nodes/"
     # use_letsencrypt: True
     # nginx_ssl_cert_path: "/etc/letsencrypt/live/{{ fqdn }}/fullchain.pem"
     # nginx_ssl_key_path: "/etc/letsencrypt/live/{{ fqdn }}/privkey.pem"
     nginx_ssl_cert_path: "/etc/ssl/certs/{{ fqdn }}-bundled.crt"
     nginx_ssl_key_path: "/etc/ssl/private/{{ fqdn }}.key"
     combine_deb_repos: False

The deploy command is 'ansible-playbook -vvv -i hosts deploy.yml'

it's failed with

TASK [common : populate the database for chacra] ***************************************************************************************************************************************************************************************
task path: /opt/chacra/src/chacra/deploy/playbooks/roles/common/tasks/postgresql.yml:81
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/commands/command.py
<chacra1.xsky.com> ESTABLISH SSH CONNECTION FOR USER: root
<chacra1.xsky.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/d61856f8b9 chacra1.xsky.com '/bin/sh -c '"'"'ALEMBIC_CONFIG=/opt/chacra/src/chacra/alembic-prod.ini /usr/bin/python && sleep 0'"'"''
<chacra1.xsky.com> (1, '\n{"changed": true, "end": "2021-08-06 16:34:13.372460", "stdout": "==> LOADING ENVIRONMENT\\nbasepath=/opt/chacra/src/chacra,module_name=prod", "cmd": ["/opt/chacra/bin/pecan", "populate", "/opt/chacra/src/chacra/prod.py"], "failed": true, "delta": "0:00:02.304443", "stderr": "Traceback (most recent call last):\\n  File \\"/opt/chacra/bin/pecan\\", line 8, in <module>\\n    sys.exit(CommandRunner.handle_command_line())\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\\", line 96, in handle_command_line\\n    runner.run(sys.argv[1:])\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\\", line 91, in run\\n    self.commands[ns.command_name]().run(ns)\\n  File \\"/opt/chacra/lib/python2.7/site-packages/chacra/commands/populate.py\\", line 34, in run\\n    self.load_app()\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\\", line 162, in load_app\\n    return load_app(self.args.config_file)\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/core.py\\", line 213, in load_app\\n    set_config(config, overwrite=True)\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\\", line 253, in set_config\\n    config = conf_from_file(config)\\n  File \\"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\\", line 183, in conf_from_file\\n    *imp.find_module(module_name, [basepath])\\n  File \\"/opt/chacra/src/chacra/prod.py\\", line 5, in <module>\\n    from prod_db import sqlalchemy\\nImportError: No module named prod_db", "rc": 1, "invocation": {"module_args": {"warn": true, "executable": null, "_uses_shell": false, "_raw_params": "/opt/chacra/bin/pecan populate /opt/chacra/src/chacra/prod.py", "removes": null, "creates": null, "chdir": null, "stdin": null}}, "start": "2021-08-06 16:34:11.068017", "msg": "non-zero return code"}\n', '')
fatal: [chacra1.xsky.com]: FAILED! => {
    "changed": true, 
    "cmd": [
        "/opt/chacra/bin/pecan", 
        "populate", 
        "/opt/chacra/src/chacra/prod.py"
    ], 
    "delta": "0:00:02.304443", 
    "end": "2021-08-06 16:34:13.372460", 
    "invocation": {
        "module_args": {
            "_raw_params": "/opt/chacra/bin/pecan populate /opt/chacra/src/chacra/prod.py", 
            "_uses_shell": false, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "stdin": null, 
            "warn": true
        }
    }, 
    "msg": "non-zero return code", 
    "rc": 1, 
    "start": "2021-08-06 16:34:11.068017", 
    "stderr": "Traceback (most recent call last):\n  File \"/opt/chacra/bin/pecan\", line 8, in <module>\n    sys.exit(CommandRunner.handle_command_line())\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 96, in handle_command_line\n    runner.run(sys.argv[1:])\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 91, in run\n    self.commands[ns.command_name]().run(ns)\n  File \"/opt/chacra/lib/python2.7/site-packages/chacra/commands/populate.py\", line 34, in run\n    self.load_app()\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 162, in load_app\n    return load_app(self.args.config_file)\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/core.py\", line 213, in load_app\n    set_config(config, overwrite=True)\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\", line 253, in set_config\n    config = conf_from_file(config)\n  File \"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\", line 183, in conf_from_file\n    *imp.find_module(module_name, [basepath])\n  File \"/opt/chacra/src/chacra/prod.py\", line 5, in <module>\n    from prod_db import sqlalchemy\nImportError: No module named prod_db", 
    "stderr_lines": [
        "Traceback (most recent call last):", 
        "  File \"/opt/chacra/bin/pecan\", line 8, in <module>", 
        "    sys.exit(CommandRunner.handle_command_line())", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 96, in handle_command_line", 
        "    runner.run(sys.argv[1:])", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 91, in run", 
        "    self.commands[ns.command_name]().run(ns)", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/chacra/commands/populate.py\", line 34, in run", 
        "    self.load_app()", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/commands/base.py\", line 162, in load_app", 
        "    return load_app(self.args.config_file)", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/core.py\", line 213, in load_app", 
        "    set_config(config, overwrite=True)", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\", line 253, in set_config", 
        "    config = conf_from_file(config)", 
        "  File \"/opt/chacra/lib/python2.7/site-packages/pecan/configuration.py\", line 183, in conf_from_file", 
        "    *imp.find_module(module_name, [basepath])", 
        "  File \"/opt/chacra/src/chacra/prod.py\", line 5, in <module>", 
        "    from prod_db import sqlalchemy", 
        "ImportError: No module named prod_db"
    ], 
    "stdout": "==> LOADING ENVIRONMENT\nbasepath=/opt/chacra/src/chacra,module_name=prod", 
    "stdout_lines": [
        "==> LOADING ENVIRONMENT", 
        "basepath=/opt/chacra/src/chacra,module_name=prod"
    ]
}

RUNNING HANDLER [common : restart app] *************************************************************************************************************************************************************************************************

PLAY RECAP *****************************************************************************************************************************************************************************************************************************
chacra1.xsky.com           : ok=31   changed=7    unreachable=0    failed=1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions