0
votes

I'm new to SaltStack and I'm working on a build to deploy tomcat and tomcat war files to Ubuntu 16.04 systems. I haven't ran into any issues until my first attempt at deploying a war file with tomcat.war_deployed. If anyone with more experience with SaltStack that could provide me any feedback I'd greatly appreciate it.

/srv/pillar/top.sls

base:
  '*':
    - tomcat-manager

/srv/pillar/tomcat-manager.sls

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

Output of salt '*' 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

Output of 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

Updates

myminion:8080/manager is accessible on my minion(s).

I haven't been able to find if SaltStack officially supports Tomcat8 so I decided to test this with Tomcat7 and it's giving me the same issue.

When I run salt '*' tomcat.version on the minions:

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

Output of salt '*' tomcat.status:

myminion:
    False
myminion1:
    False

Output of salt '*' tomcat.serverinfo:

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

I haven't had any luck with search engines for Failed to create HTTP request yet.

Output of 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

Output of 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
Could you confirm that this url localhost:8080/manager is working correctly ? - Mostafa Hussein
Hey Mostafa, myminion:8080/manager is accessible, thanks. - hashwagon
localhost:8080/manager and 127.0.0.1:8080/manager are both available from the minion itself. - hashwagon

1 Answers

0
votes

What worked for me was restarting the tomcat instance on the minion.

The tomcat instance could be running with the old user parameters.