salt icon indicating copy to clipboard operation
salt copied to clipboard

use salt-ssh to install the salt-minion for client server in batch

Open disylee opened this issue 12 years ago • 12 comments

backgroup: I trying to use salt-ssh to install the salt-minion for client server in batch.

[root@localhost epel]# tree -f
.
├── ./epel-release-6-8.noarch.rpm
└── ./salt_install.sls

0 directories, 2 files
[root@localhost salt]# ls
epel  roster  salt
[root@localhost salt]# cat roster
web1:
  host:  10.20.14.18
  user:  root
  passwd:  redhat
  port:  22
  timeout:  10

but test.ping error below,first it can't found the host: the I try this

[root@localhost salt]# salt-ssh '*' test.ping
test:
    ----------
    retcode:
        1
    stderr:
        Traceback (most recent call last):
          File "/tmp/.root_c87ee6__salt/salt-call", line 2, in <module>
            from salt.scripts import salt_call
          File "/tmp/.root_c87ee6__salt/salt/__init__.py", line 44, in <module>
            from salt.utils import migrations
          File "/tmp/.root_c87ee6__salt/salt/utils/__init__.py", line 102, in <module>
            import salt.payload
          File "/tmp/.root_c87ee6__salt/salt/payload.py", line 14, in <module>
            import salt.crypt
          File "/tmp/.root_c87ee6__salt/salt/crypt.py", line 32, in <module>
            import salt.minion
          File "/tmp/.root_c87ee6__salt/salt/minion.py", line 60, in <module>
            import salt.client
          File "/tmp/.root_c87ee6__salt/salt/client/__init__.py", line 38, in <module>
            import salt.utils.event
          File "/tmp/.root_c87ee6__salt/salt/utils/event.py", line 74, in <module>
            import salt.state
          File "/tmp/.root_c87ee6__salt/salt/state.py", line 29, in <module>
            import salt.pillar
          File "/tmp/.root_c87ee6__salt/salt/pillar/__init__.py", line 14, in <module>
            import salt.fileclient
          File "/tmp/.root_c87ee6__salt/salt/fileclient.py", line 13, in <module>
            import requests
          File "/tmp/.root_c87ee6__salt/requests/__init__.py", line 52, in <module>
            from . import utils
          File "/tmp/.root_c87ee6__salt/requests/utils.py", line 23, in <module>
            from .compat import parse_http_list as _parse_list_header
          File "/tmp/.root_c87ee6__salt/requests/compat.py", line 96, in <module>
            from ordereddict import OrderedDict
        ImportError: No module named ordereddict
    stdout:

Sadly,I try this command but return OK,like this

[root@localhost salt]# salt-ssh '*' -r "free -m"
test:
    ----------
    retcode:
        0
    stderr:

    stdout:
        [email protected]'s password:
                     total       used       free     shared    buffers     cached
        Mem:           490        135        355          0         10         44
        -/+ buffers/cache:         80        410
        Swap:          991          0        991

this my epel_install.sls

  [root@localhost epel]# cat salt_install.sls
epel_install:
  file.managed:
    - name:  /tmp/epel-release-6-8.noarch.rpm
    - source: salt://epel/epel-release-6-8.noarch.rpm
    - user: root
    - group: root

  cmd.run:
    - name: rpm -ivh /tmp/epel-release-6-8.noarch.rpm
    - unless: test -f /etc/yum.repos.d/epel.repo
    - require:
     - file: epel_install   
  chche_yum:
    cmd.run:
      - name: yum makecache
      - require:
        - file: epel_install
  salt_install:
    pkg.installed:
      - name: salt-minion
      - require:
        - file: epel_install

but I try to excute it ,reward ERROR below

[root@localhost epel]# salt-ssh '*' state.sls epel_install.sls
test:
    ----------
    _caller_cachedir:
        /var/cache/salt/master
    _error:
        Failed to return clean data
    _ssh_version:
        5.3p1
    ext_pillar:
    file_roots:
        ----------
        base:
            - /srv/salt
    id:
        test
    pillar_roots:
        ----------
        base:
            - /srv/pillar
    stderr:
        Traceback (most recent call last):
          File "/tmp/.root_c87ee6__salt/salt-call", line 2, in <module>
            from salt.scripts import salt_call
          File "/tmp/.root_c87ee6__salt/salt/__init__.py", line 44, in <module>
            from salt.utils import migrations
          File "/tmp/.root_c87ee6__salt/salt/utils/__init__.py", line 102, in <module>
            import salt.payload
          File "/tmp/.root_c87ee6__salt/salt/payload.py", line 14, in <module>
            import salt.crypt
          File "/tmp/.root_c87ee6__salt/salt/crypt.py", line 32, in <module>
            import salt.minion
          File "/tmp/.root_c87ee6__salt/salt/minion.py", line 60, in <module>
            import salt.client
          File "/tmp/.root_c87ee6__salt/salt/client/__init__.py", line 38, in <module>
            import salt.utils.event
          File "/tmp/.root_c87ee6__salt/salt/utils/event.py", line 74, in <module>
            import salt.state
          File "/tmp/.root_c87ee6__salt/salt/state.py", line 29, in <module>
            import salt.pillar
          File "/tmp/.root_c87ee6__salt/salt/pillar/__init__.py", line 14, in <module>
            import salt.fileclient
          File "/tmp/.root_c87ee6__salt/salt/fileclient.py", line 13, in <module>
            import requests
          File "/tmp/.root_c87ee6__salt/requests/__init__.py", line 52, in <module>
            from . import utils
          File "/tmp/.root_c87ee6__salt/requests/utils.py", line 23, in <module>
            from .compat import parse_http_list as _parse_list_header
          File "/tmp/.root_c87ee6__salt/requests/compat.py", line 96, in <module>
            from ordereddict import OrderedDict
        ImportError: No module named ordereddict
    stdout:

isn't cause by python?

disylee avatar Nov 24 '14 09:11 disylee

@disylee We're not able to reproduce this on either 2014.1.13 or 2014.7.0. What does 'salt-ssh --versions' tell you, and what distribution are you running?

cro avatar Nov 26 '14 22:11 cro

@cro [root@localhost .ssh]#salt --version salt 2014.7.0 (Helium)

disylee avatar Nov 28 '14 07:11 disylee

Trying more here.. but still not able to reproduce. Can you get me a versions-report 'salt --versions-report' ? What OS is this (on the Master), and curious what OS is on the target box (and python version of the target).

How did you install the 2014.7.0 version?

pitatus avatar Dec 02 '14 23:12 pitatus

the version
[root@localhost ~]# salt-ssh --version
salt-ssh 2014.7.0 (Helium)



[root@localhost ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m


when I installed the salt ,it may contain salt-ssh ,now  solve this problem ,I trying to use salt to help the client server install some plugin ,then salt-ssh ‘*' test.ping returns Ture
the plugin list:

qq 20141205095125

disylee avatar Dec 05 '14 01:12 disylee

I'm also seeing the same error (ImportError: No module named ordereddict) running 'salt-ssh "cmd.run ls". The source machine is Fedora20 and target is RHEL5 (still supported right?). Running the same salt-ssh command on a RHEL6 target gets past this step (but fails with a ImportError: No module named backports.ssl_match_hostname as per #18083).

On the RHEL5 target the following python rpms are installed:

python-sqlite-1.1.7-1.2.1
python-2.4.3-56.el5
python26-2.6.8-2.el5
python26-zmq-2.1.9-3.el5
python26-jinja2-2.5.5-4.el5
audit-libs-python-1.8-2.el5
python26-libs-2.6.8-2.el5
python26-msgpack-0.1.12-2.el5
python26-babel-0.9.5-2.el5
python26-crypto-2.3-5.el5
python26-PyYAML-3.08-4.el5
libxml2-python-2.6.26-2.1.25.el5_11
python-elementtree-1.2.6-5
libselinux-python-1.33.4-5.7.el5
python-urlgrabber-3.1.0-6.el5
python-libs-2.4.3-56.el5
python-iniparse-0.2.3-6.el5
python26-markupsafe-0.11-3.el5
python26-m2crypto-0.21.1-5.el5
rpm-python-4.4.2.3-34.el5
python-simplejson-2.0.9-8.el5
[tim@computer ~]$ salt-ssh --version
salt-ssh 2014.7.0 (Helium)

cheers, Tim

tbaker57 avatar Dec 05 '14 03:12 tbaker57

..don't have a RHEL 5 box, but do have CentOS 5.11 ..using instructions for epel setup for RHEL5: http://docs.saltstack.com/en/latest/topics/installation/rhel.html rpm -Uvh http://mirror.pnl.gov/epel/5/i386/epel-release-5-4.noarch.rpm I've installed the following on the target:

python26-2.6.8-2.el5
python26-six-1.7.3-3.el5
python26-libs-2.6.8-2.el5
python26-backports-ssl_match_hostname-3.4.0.2-5.el5
python26-ordereddict-1.1-3.el5
python26-backports-1.0-5.el5
python26-urllib3-1.5-8.el5

then a simple test.ping worked for me..

Note: on CentOS 6.x targets in the past I installed python-requests which pulls in ordereddict to resolve this issue also, but if requests is later needed you can also add python26-requests..

pitatus avatar Dec 05 '14 18:12 pitatus

I'm encountering this issue on stock RHEL 6.4. I realize if I install the dependencies it will fix it, but salt is supposed to be copying ordereddict right? It is installed on the master. It would make bootstrapping systems via salt-ssh more straightforward.

    stderr:
        Traceback (most recent call last):
          File "/tmp/.saltssh_535b74__salt/salt-call", line 2, in <module>
            from salt.scripts import salt_call
          File "/tmp/.saltssh_535b74__salt/salt/__init__.py", line 44, in <module>
            from salt.utils import migrations
          File "/tmp/.saltssh_535b74__salt/salt/utils/__init__.py", line 102, in <module>
            import salt.payload
          File "/tmp/.saltssh_535b74__salt/salt/payload.py", line 14, in <module>
            import salt.crypt
          File "/tmp/.saltssh_535b74__salt/salt/crypt.py", line 32, in <module>
            import salt.minion
          File "/tmp/.saltssh_535b74__salt/salt/minion.py", line 60, in <module>
            import salt.client
          File "/tmp/.saltssh_535b74__salt/salt/client/__init__.py", line 38, in <module>
            import salt.utils.event
          File "/tmp/.saltssh_535b74__salt/salt/utils/event.py", line 74, in <module>
            import salt.state
          File "/tmp/.saltssh_535b74__salt/salt/state.py", line 29, in <module>
            import salt.pillar
          File "/tmp/.saltssh_535b74__salt/salt/pillar/__init__.py", line 14, in <module>
            import salt.fileclient
          File "/tmp/.saltssh_535b74__salt/salt/fileclient.py", line 13, in <module>
            import requests
          File "/tmp/.saltssh_535b74__salt/requests/__init__.py", line 52, in <module>
            from . import utils
          File "/tmp/.saltssh_535b74__salt/requests/utils.py", line 23, in <module>
            from .compat import parse_http_list as _parse_list_header
          File "/tmp/.saltssh_535b74__salt/requests/compat.py", line 96, in <module>
            from ordereddict import OrderedDict
        ImportError: No module named ordereddict

Vye avatar Feb 12 '15 23:02 Vye

Hi!I

I have the same issue. I use redhat 6.5 could you tell me what dependencies i need to install?

Thnkas

PabloLemos avatar Feb 19 '15 12:02 PabloLemos

Same issue with salt-ssh 2014.7.1 (Helium) on CentOS 6.6 via EPEL.

I was using 2014.7.0 with this patch: https://github.com/saltstack/salt/pull/19321 Then, when updated to 2014.7.1, that patch is included but it regressed with this issue.

hshib avatar Mar 24 '15 05:03 hshib

This issue can be worked around by installing "python-requests" package on the target.

hshib avatar Mar 24 '15 05:03 hshib

Hi, I'm having the same problem, using salt-ssh through the python client throws the error

'stderr': 'Traceback (most recent call last):\n File "/var/tmp/.root_5fe90b_salt/salt-call", line 15, in \n salt_call()\n File "/var/tmp/.root_5fe90b_salt/py2/salt/scripts.py", line 346, in salt_call\n import salt.cli.call\n File "/var/tmp/.root_5fe90b_salt/py2/salt/cli/call.py", line 6, in \n from salt.utils import parsers\n File "/var/tmp/.root_5fe90b_salt/py2/salt/utils/parsers.py", line 28, in \n import salt.config as config\n File "/var/tmp/.root_5fe90b_salt/py2/salt/config/init.py", line 41, in \n import salt.utils.sdb\n File "/var/tmp/.root_5fe90b_salt/py2/salt/utils/sdb.py", line 9, in \n import salt.loader\n File "/var/tmp/.root_5fe90b_salt/py2/salt/loader.py", line 30, in \n import salt.utils.event\n File "/var/tmp/.root_5fe90b_salt/py2/salt/utils/event.py", line 72, in \n import salt.payload\n File "/var/tmp/.root_5fe90b_salt/py2/salt/payload.py", line 17, in \n import salt.crypt\n File "/var/tmp/.root_5fe90b_salt/py2/salt/crypt.py", line 49, in \n import tornado.gen\n File "/var/tmp/.root_5fe90b_salt/py2/tornado/gen.py", line 98, in \n from singledispatch import singledispatch # backport\n File "/var/tmp/.root_5fe90b_salt/py2/singledispatch.py", line 13, in \n from singledispatch_helpers import MappingProxyType, get_cache_token\n File "/var/tmp/.root_5fe90b_salt/py2/singledispatch_helpers.py", line 19, in \n from ordereddict import OrderedDict\nImportError: No module named ordereddict',

These are my installed pkgs versions: ordereddict (1.1) requests (2.10.0) salt-ssh (2016.3.3)

Any suggestion?

Thanks

ragmel avatar Aug 31 '16 10:08 ragmel

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Jun 25 '18 14:06 stale[bot]