首页 文章

SaltStack Tomcat部署:'tomcat.war_deployed'错误

提问于
浏览
0

我'm new to SaltStack and I'正在构建一个将tomcat和tomcat war文件部署到Ubuntu 16.04系统的构建 . 在我第一次尝试使用 tomcat.war_deployed 部署war文件之前,我没有遇到任何问题 . 如果有任何对SaltStack有更多经验的人可以给我任何反馈,我会非常感激 .

/srv/pillar/top.sls

base:
  '*':
    - tomcat-manager

/srv/pillar/tomcat-manager.sls

tomcat-manager:
    user: 'myuser'
    passwd: 'mypassword'

盐的输出'*'pillar.test

tomcat-manager:
  ------------
    passwd:
        mypassword
    user:
        myuser

mystate.sls

# Install tomcat8 packages.
install_tomcat:
  pkg.installed:
    - pkgs:
      - tomcat8
      - tomcat8-admin

# Install postgresql packages.
install_postgresql:
  pkg.installed:
    - name: postgresql-9.5

# Start tomcat service.
start_service_tomcat:
  service.running:
    - name: tomcat8
    - enable: True
    - require:
      - pkg: install_tomcat
    - watch:
      - file: sync tomcat-users.xml

# Tomcat deploy war files.
deploy_war:
  tomcat.war_deployed:
    - name: /mywar
    - war: salt://files/tomcat/war/mywar.war
    - require:
      - service: start_service_tomcat

# Start postgresql service.
start_service_postgresql:
  service.running:
    - name: postgresql
    - enable: True
    - require:
      - pkg: install_postgresql
    - watch:
      - file: sync pg_hba.conf
      - file: sync postgresql.conf

salt'*'state.sls mystate的输出

----------
          ID: deploy_war
    Function: tomcat.war_deployed
        Name: /mywar
      Result: False
     Comment: F
              a                                                                                                                                                                                                                                                                
              i                                                                                                                                                                                                                                                                
              l                                                                                                                                                                                                                                                                
              e                                                                                                                                                                                                                                                                
              d                                                                                                                                                                                                                                                                

              t                                                                                                                                                                                                                                                                
              o                                                                                                                                                                                                                                                                

              c                                                                                                                                                                                                                                                                
              r                                                                                                                                                                                                                                                                
              e                                                                                                                                                                                                                                                                
              a                                                                                                                                                                                                                                                                
              t                                                                                                                                                                                                                                                                
              e                                                                                                                                                                                                                                                                

              H                                                                                                                                                                                                                                                                
              T                                                                                                                                                                                                                                                                
              T                                                                                                                                                                                                                                                                
              P                                                                                                                                                                                                                                                                

              r
              e
              q
              u
              e
              s
              t
     Started: 15:54:02.314254
    Duration: 1980.229 ms
     Changes:

[...]

Failed:     1
-------------
Total states run:     12
Total run time:    2.671 s
ERROR: Minions returned with non-zero exit code

更新

我的小兵可以访问 myminion:8080/manager .

我一直无法找到SaltStack是否正式支持Tomcat8所以我决定用Tomcat7测试它,它给了我同样的问题 .

当我在爪牙上运行 salt '*' tomcat.version 时:

myminion:
    Apache Tomcat/7.0.68 (Ubuntu)
myminion2:
    Apache Tomcat/8.0.32 (Ubuntu)

输出 salt '*' tomcat.status

myminion:
    False
myminion1:
    False

输出 salt '*' tomcat.serverinfo

myminion:
    ----------
    error:
        Failed to create HTTP request
myminion1:
    ----------
    error:
        Failed to create HTTP request

我还没有找到 Failed to create HTTP request 的搜索引擎运气 .

输出 sudo salt-call -l debug tomcat.serverinfo

[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: myminion
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[WARNING ] Unable to find IPv6 record for "myminion" causing a 10 second timeout when rendering grains. Set the dns or /etc/hosts for IPv6 to clear this.
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Connecting to master. Attempt 1 of 1
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (7330)
[DEBUG   ] Setting zmq_reconnect_ivl to '7330ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506', 'clear')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_bbef5074cf_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_bbef5074cf_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_bbef5074cf_pull.ipc
[DEBUG   ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2017-05-04T18:14:04.328838', 'creds': {'publish_port': 4505, 'aes': '######/#####/###############################################=', 'master_uri': 'tcp://mymaster:4506'}, 'key': ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506')}
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded tomcat.serverinfo
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'myminion', 'tcp://mymaster:4506')
[DEBUG   ] LazyLoaded nested.output
local:
    ----------
    error:
        Failed to create HTTP request

salt-call test.versions的输出:

[WARNING ] Unable to find IPv6 record for "dt-rhettvm-01" causing a 10 second timeout when rendering grains. Set the dns or /etc/hosts for IPv6 to clear this.
local:
    Salt Version:
                Salt: 2016.11.4

    Dependency Versions:
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: 2.4.2
          docker-py: Not Installed
              gitdb: Not Installed
          gitpython: Not Installed
              ioflo: Not Installed
             Jinja2: 2.8
            libgit2: Not Installed
            libnacl: Not Installed
           M2Crypto: Not Installed
               Mako: 1.0.3
       msgpack-pure: Not Installed
     msgpack-python: 0.4.6
       mysql-python: Not Installed
          pycparser: Not Installed
           pycrypto: 2.6.1
       pycryptodome: Not Installed
             pygit2: Not Installed
             Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
       python-gnupg: Not Installed
             PyYAML: 3.11
              PyZMQ: 15.2.0
               RAET: Not Installed
              smmap: Not Installed
            timelib: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.1.4

    System Versions:
               dist: Ubuntu 16.04 xenial
            machine: x86_64
            release: 4.4.0-62-generic
             system: Linux
            version: Ubuntu 16.04 xenia

1 回答

  • 0

    对我有用的是重新启动minion上的tomcat实例 .

    tomcat实例可以使用旧的用户参数运行 .

相关问题