rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
331 stars 100 forks source link

Issue with converting Ansible inventory to Rundeck Nodes #219

Open Vamsi-Pendyala opened 5 years ago

Vamsi-Pendyala commented 5 years ago

I am trying to use rundeck ansible plugin 2.5 version to load my rundeck nodes using ansible inventory hosts file.

I keep getting the following error

PLAY [all] *****

TASK [file] **** changed: [MyservrName -> localhost]

TASK [template] **** fatal: [MyservrName -> localhost]: FAILED! => {"changed": false, "checksum": "aae39d3a6c1060f3152bc2a8d643d83aabc9c849", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"} to retry, use: --limit @/etc/ansible/retry/gather-hosts.retry

PLAY RECAP ***** MyservrName : ok=1 changed=1 unreachable=0 failed=1

I checked and confirmed that both MYserverName and RunDeck server have libselinux-python installed.

Please advise what else I need to do to get this inventory loaded.

My Project Config is as below:

edit below

project.disable.executions=false project.disable.schedule=false project.jobs.gui.groupExpandLevel=1 project.name=nodesansible project.nodeCache.delay=30 project.nodeCache.enabled=true project.ssh-authentication=privateKey project.ssh-command-timeout=0 project.ssh-connect-timeout=0 project.ssh-keypath=/var/lib/rundeck/.ssh/id_rsa resources.source.1.config.ansible-become=false resources.source.1.config.ansible-config-file-path=/etc/ansible resources.source.1.config.ansible-disable-limit=false resources.source.1.config.ansible-gather-facts=false resources.source.1.config.ansible-ignore-errors=true resources.source.1.config.ansible-inventory=/etc/ansible/hosts resources.source.1.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory service.FileCopier.default.provider=jsch-scp service.NodeExecutor.default.provider=jsch-ssh

FloThinksPi commented 5 years ago

Ansible requires libselinux-python to be installed on the target machine like it also needs python to be installed. Read https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements for more information.

So you should install this package everywhere. You can do this via a raw command in ansible.

Vamsi-Pendyala commented 5 years ago

Hi Florian,

I have both python and libselinux-python installed on my client machine. Please see below screenshot. In spite of both packages installed, I keep getting the error.

[cid:image001.png@01D4A349.7B09FFE0]

[cid:image002.png@01D4A34A.0431D8B0]

Regards, Vamsi. From: Florian Braun notifications@github.com Sent: Thursday, January 3, 2019 2:05 AM To: Batix/rundeck-ansible-plugin rundeck-ansible-plugin@noreply.github.com Cc: Vamsi Krishna Pendyalasatyasundara -X (vampendy - INFOSYS LIMITED at Cisco) vampendy@cisco.com; Author author@noreply.github.com Subject: Re: [Batix/rundeck-ansible-plugin] Issue with converting Ansible inventory to Rundeck Nodes (#219)

Ansible requires libselinux-python to be installed on the target machine like it also needs python to be installed. Read https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements for more information.

So you should install this package everywhere. You can do this via a raw command in ansible.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Batix/rundeck-ansible-plugin/issues/219#issuecomment-451100177, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsL3as-THtuosYdWrDo-WhONZTy49yQ2ks5u_dXBgaJpZM4ZnVy7.

Vamsi-Pendyala commented 5 years ago

Please see below output from command line that shows all required SW (both python and selinux and libselinux-python are installed on my client machine.

Python:

[root@MyserverName ~]# python Python 2.7.13 (default, Jul 9 2018, 14:41:49) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Selinux:

[root@MyServerName selinux]# cat config

This file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - SELinux is fully disabled.

SELINUX=permissive

SELINUXTYPE= type of policy in use. Possible values are:

targeted - Only targeted network daemons are protected.

strict - Full SELinux protection.

SELINUXTYPE=targeted

libselinux-python:

[root@MyServerName selinux]# rpm -qa | grep libselinux-python libselinux-python-2.0.94-5.8.el6.x86_64

Vamsi-Pendyala commented 5 years ago

Hi Florian,

I have these installed on both my rundeck server as well as the end node/client machine. Am I still missing something?

Regards, Vamsi. From: Florian Braun notifications@github.com Sent: Thursday, January 3, 2019 10:07 AM To: Batix/rundeck-ansible-plugin rundeck-ansible-plugin@noreply.github.com Cc: Vamsi Krishna Pendyalasatyasundara -X (vampendy - INFOSYS LIMITED at Cisco) vampendy@cisco.com; Author author@noreply.github.com Subject: Re: [Batix/rundeck-ansible-plugin] Issue with converting Ansible inventory to Rundeck Nodes (#219)

You News it in the remotes you want to manage. The Targets of the playbook

Am 03.01.2019 18:52 schrieb Vamsi-Pendyala notifications@github.com<mailto:notifications@github.com>: Hi Florian,

I have both python and libselinux-python installed on my client machine. Please see below screenshot. In spite of both packages installed, I keep getting the error.

[cid:image001.png@01D4A349.7B09FFE0]

[cid:image002.png@01D4A34A.0431D8B0]

Regards, Vamsi. From: Florian Braun notifications@github.com<mailto:notifications@github.com> Sent: Thursday, January 3, 2019 2:05 AM To: Batix/rundeck-ansible-plugin rundeck-ansible-plugin@noreply.github.com<mailto:rundeck-ansible-plugin@noreply.github.com> Cc: Vamsi Krishna Pendyalasatyasundara -X (vampendy - INFOSYS LIMITED at Cisco) vampendy@cisco.com<mailto:vampendy@cisco.com>; Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [Batix/rundeck-ansible-plugin] Issue with converting Ansible inventory to Rundeck Nodes (#219)

Ansible requires libselinux-python to be installed on the target machine like it also needs python to be installed. Read https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements for more information.

So you should install this package everywhere. You can do this via a raw command in ansible.

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Batix/rundeck-ansible-plugin/issues/219#issuecomment-451100177, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsL3as-THtuosYdWrDo-WhONZTy49yQ2ks5u_dXBgaJpZM4ZnVy7.

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Batix/rundeck-ansible-plugin/issues/219#issuecomment-451223261, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFl5bMVQd62cnCILbQ-E34n_LDH1AS4Tks5u_kNggaJpZM4ZnVy7.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Batix/rundeck-ansible-plugin/issues/219#issuecomment-451227489, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsL3avvWR9_U6SSa1yqHLUfiTLzJcOSTks5u_kbWgaJpZM4ZnVy7.

FloThinksPi commented 5 years ago

Try to run some playbook directly on all hosts with ansible cli. Do you use a non Standart Python Interpreter somwehere (Not from OS repos) ?

Vamsi-Pendyala commented 5 years ago

Hi Florian,

We use Python 2.6 by default that comes with RHEL but we also install Python 2.7 on our own.

I ran a sample play book from my run deck server on my client node and it worked fine. Please see the screen shot below. The issue comes up only when I try to use the plug in and load my rundeck nodes from my Ansible host inventory.

[ansible@rundeckserver:/etc/ansible/playbooks]#ansible-playbook check_vintella.yml

PLAY [all] ****

TASK [Gathering Facts] **** ok: [allnapvm13]

TASK [Check vintella service status] ** [WARNING]: Consider using the service module rather than running service. If you need to use command because service is insufficient you can add warn=False to this command task or set command_warnings=False in ansible.cfg to get rid of this message.

changed: [MyClientNode]

TASK [debug] ** ok: [MyClientNode] => { "vasd_status.stdout_lines": [ "Checking vasd: .vasd (pid 1453 1452 1451 1450 1449 1443) is running..." ] }

FloThinksPi commented 5 years ago

I suspect the Importer using the wrong Python Version, if you installed a custom one Not from rhel as well. The Importer May use the wrong Python version. The libselinx package likely only works for Python from rhel.

Otherwise i am Out of ideas.

Vamsi-Pendyala commented 5 years ago

Thanks, Is there a way I can direct the importer (some config variable) to use only the default Python (2.6) instead of the custom one (2.7 we installed)?

Vamsi-Pendyala commented 5 years ago

Also I disabled the custom Python and made the default python path on my Client node as OS installed python path. But I am still getting the same error