newbie question re inventory parsing

512 views
Skip to first unread message

Raf M

unread,
Jan 11, 2024, 12:39:35 PM1/11/24
to rundeck-discuss
hello,
I have working ansible inventory and playbook running on rundec server.

inventory is yaml file and is processed correctly from managed node cli/bash:
$ ansible-inventory --graph -i /var/lib/rundeck/ansible/inventory.yaml
@all:
  |--@ungrouped:
  |  |--DEVNET2
  |  |--DEVNET1
  |  |--localhost


playbook is also working as expected from bash:

$ ansible-playbook /var/lib/rundeck/ansible/playbooks/lx/subPing.yaml  -i /var/lib/rundeck/ansible/inventory.yaml

PLAY [0/0 ping linux target] *******************************************************************************************************

TASK [0/1 Ping {{ target }}] *******************************************************************************************************
ok: [DEVNET2]
ok: [DEVNET1]
ok: [localhost]

PLAY RECAP *************************************************************************************************************************
DEVNET1                    : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
DEVNET2                    : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0


When trying to run same inventory/playbook from rundeck (communty) I am getting:

Failed to parse inventory.yaml with yaml plugin: Invalid extra vars data supplied.
failed to parse /var/lib/rundeck/ansible/invertory.yaml with auto plugin: no root 'plugin' key found, '/var/lib/rundeck/ansible/inventory.yaml' is not a valid YAML inventory plugin config file.

Can someone please point me to what am I doing wrong?
Thanks,

Raf

configuration info:
rundec ver: 5.0.0.20231216-1 all
os: Ubuntu 22.04.3 LTS
inventory.yaml content:
---
 all:
     hosts:
      DEVNET2:
        ansible_ssh_host: devnet2
        ansible_user: lxbot
        ansible_ssh_private_key_file: /var/lib/rundeck/.ssh/id_rsa
      DEVNET1:
        ansible_ssh_host: devnet1
        ansible_user: lxbot
        ansible_ssh_private_key_file: /var/lib/rundeck/.ssh/id_rsa
      localhost:
        ansible_user: lxbot
        ansible_ssh_private_key_file: /var/lib/rundeck/.ssh/id_rsa

$ sudo cat /var/lib/rundeck/ansible.cfg
[defaults]
host_key_checking = False
gathering = explicit
inventory = /var/lib/rundeck/ansible/inventory.yaml
retry_files_enabled = False
filter_plugins = /usr/lib/python3/dist-packages/ansible/modules/
deprecation_warnings=False
ansible_python_interpreter=/usr/bin/python3

rac...@rundeck.com

unread,
Jan 11, 2024, 12:43:06 PM1/11/24
to rundeck-discuss
Hi!

How did you configure your Ansible model source/node executor on Rundeck? please follow this.

Greetings.

Raf M

unread,
Jan 12, 2024, 12:37:08 PM1/12/24
to rundeck...@googlegroups.com
Thanks for responding.
my project settings > edit nodes config:

image.png

inventory file permissions:
-rw-rw-r-- 1 rundeck rundeck 830 Jan 11 16:52 /var/lib/rundeck/ansible/inventory.yaml

I saved config and went to nodes > show all nodes I can only see localhost in there
It would suggest inventory file was not imported.
Tried to copy both ansible.cfg and inventory.yaml file into /etc/ansible/ but it made no difference (I updated ansible.cfg to point to new inventory location at /etc/ansible/inventory.yaml)

Can you confirm those setting are correct?
Is there anything else you thing I could try (where can I find detailed error log to get some hints on what went wrong)?

Thanks

Project settings > edit config > default node executor is set as: Ansible ad-cock node executor
Ansible binaries directory path: /usr/bin/
Ansible config file path: /var/lib/rundeck/ansible.cfg
Vault Key File path:  /var/lib/rundeck/ansible/var/ansible-vars.yaml
SSH Authentication: privateKey
SSH user: lxbot
SSH Key File path: /var/lib/rundeck/.ssh/id_rsa
Use become privilege escalation: enabled
Privilege escalation user: lxbot

Think this one is more for ansible execution so probably not relevant at this stage.

--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/k-lGRU3QCTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/3e2832d4-5f21-455d-bee1-60f152ea6673n%40googlegroups.com.

rac...@rundeck.com

unread,
Jan 12, 2024, 2:03:38 PM1/12/24
to rundeck-discuss
Hello,

I saved the config and went to nodes > show all nodes I can only see localhost in there:

Set the "gather facts" to "no". Probably you're facing this. In some environments, it's a common issue.

It would suggest inventory file was not imported.
Is there anything else you thing I could try (where can I find detailed error log to get some hints on what went wrong)?

The Rundeck service.log file shows the ansible status at the moment of checking the project nodes. Do you see any clue there?

Hope it helps!
Reply all
Reply to author
Forward
0 new messages