Add support for CoreOS to service module
Description of Issue/Question
Salt doesn't detect CoreOS as systemd driven OS and uses legacy salt.modules.service instead of salt.modules.systemd.
Setup
Salt minion on CoreOS, locally installed ActivePython 2.7.12, salt minion installed via pip
Steps to Reproduce Issue
salt-call service.get_all
Versions Report
Salt Version: Salt: 2016.11.1
Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.4.2 gitdb: 0.6.4 gitpython: 1.0.1 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 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: 0.9.0 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-57-generic system: Linux version: Ubuntu 16.04 xenial
I don't believe that we support CoreOS, because we have never tested running python on it.
But we could add recognition of it. Could you provide us some steps for getting it installed?
You could also use providers to specify using systemd. https://docs.saltstack.com/en/latest/ref/states/providers.html https://docs.saltstack.com/en/latest/ref/modules/index.html#module-provider-override
providers:
service: systemd
Thanks, Daniel
Hello Daniel. Of course I used providers according to instructions in manual. In the same part of manual is also to report an issue, that's why I did it. Seems to me that following patch works for recognition of coreos. Applied to {saltdir}/_modules/service.py:
--- service.py.orig 2017-02-01 07:30:09.853068634 +0100
+++ service.py 2017-01-23 13:18:36.990023369 +0100
@@ -45,6 +45,7 @@
'Void',
'Mint',
'Raspbian',
+ 'Container by CoreOS',
'XenServer'
))
if __grains__.get('os', '') in disable:
Installing Python on CoreOS:
I used ActivePython from ActiveState, but standard CPython should also work. Steps:
- download Python from http://www.activestate.com/activepython/downloads
- uncompress
./install.sh -I /opt/pythonmkdir /opt/bin && cd /opt/binfor i in python pip easy_install virtualenv; do ln -s ../python/$i; done
echo <<END >/etc/environment
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
LD_LIBRARY_PATH=/opt/lib
END
After that salt-ssh should work.
Installing salt-minion:
You need a container with devel tools like gcc, make, etc. I have one here: https://quay.io/repository/horakmar/gcc
Just run the container with mounted /opt from host (-v /opt:/opt for docker) and install salt:
pip install salt
Don't forget to copy C++ runtime library:
mkdir /opt/lib && cp /usr/lib/libstdc++.so.6 /opt/lib
After that you can run salt minion as a service. /etc/systemd/system/saltminion.service:
[Unit]
Description=The Salt Minion
After=network.target
[Service]
Environment=LD_LIBRARY_PATH=/opt/lib
Type=notify
NotifyAccess=all
LimitNOFILE=8192
ExecStart=/opt/bin/salt-minion
[Install]
WantedBy=multi-user.target
systemctl start saltminion
That's all. Martin
Hi,
I installed Activepython as per the above instructions. But salt-ssh is not working from centos (which is salt master). Below is the output with debug log. It says that python is not installed, but it was installed on coreOS and able to run python script on coreos server. Did it work for you?
[DEBUG ] Reading configuration from /etc/salt/master [DEBUG ] Configuration file path: /etc/salt/master [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [DEBUG ] LazyLoaded flat.targets [DEBUG ] LazyLoaded jinja.render [DEBUG ] LazyLoaded yaml.render [DEBUG ] compile template: /etc/salt/roster [DEBUG ] Jinja search path: ['/var/cache/salt/master/files/base'] [PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'jinja' renderer: 0.00697112083435 [DEBUG ] Rendered data from file: /etc/salt/roster:
core2: host: 10.10.11.6 user: core priv: /root/.ssh/id_rsa
[DEBUG ] Results of YAML rendering: OrderedDict([('core2', OrderedDict([('host', '10.10.11.6'), ('user', 'core'), ('priv', '/root/.ssh/id_rsa')]))]) [PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'yaml' renderer: 0.00415897369385 [DEBUG ] Matched minions: {'core2': OrderedDict([('host', '10.10.11.6'), ('user', 'core'), ('priv', '/root/.ssh/id_rsa')])} [DEBUG ] LazyLoaded roots.envs [DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available. [DEBUG ] Updating roots fileserver cache [DEBUG ] LazyLoaded local_cache.prep_jid [DEBUG ] Adding minions for job 20170204173125281997: ['core2'] [DEBUG ] Could not LazyLoad network.interfaces: 'network.interfaces' is not available. [DEBUG ] Performing shimmed, blocking command as follows: network.interfaces [DEBUG ] Executed SHIM command. Command logged to TRACE [DEBUG ] Child Forked! PID: 11302 STDOUT_FD: 10 STDERR_FD: 12 [DEBUG ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE [DEBUG ] RETCODE 10.10.11.6: 10 [DEBUG ] LazyLoaded nested.output core2: ---------- retcode: 10 stderr: + SUDO= + '[' -n '' ']' + SUDO_USER= + '[' '' ']' + '[' '' ']' + EX_PYTHON_INVALID=10 + PYTHON_CMDS='python3 python27 python2.7 python26 python2.6 python2 python' + for py_cmd in '$PYTHON_CMDS' + command -v python3 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python27 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python2.7 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python26 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python2.6 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python2 + continue + for py_cmd in '$PYTHON_CMDS' + command -v python + continue + echo 'ERROR: Unable to locate appropriate python command' ERROR: Unable to locate appropriate python command + exit 10 stdout: ERROR: salt requires python 2.6 or newer on target hosts, must have same major version as origin host
@sugun999 can you open a different issue for this?
Thanks, Daniel
Hi,
Thanks. Created new issue.
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.