Ansible/Rundeck with Windows nodes

570 views
Skip to first unread message

Jeremy Vermillion

unread,
Jan 24, 2022, 8:38:28 AM1/24/22
to rundeck-discuss
I am trying to set up Ansible integration on my Rundeck server.
  • Ansible is installed on the same server as rundeck (Debian)
  • Rundeck version 3.4.4
I was able to get my nodes file working and showing in Rundeck.
Rundeck appears to be trying to run the playbook with SSH even thought the nodes file has win:vars so it fails as "unreachable".  The same playbook running from the same inventory runs successfully in Debian shell.

Thanks,
Jeremy

rac...@rundeck.com

unread,
Jan 24, 2022, 8:49:54 AM1/24/22
to rundeck-discuss

Hi Jeremy,

I use this inventory file to access remote windows machines through the Ansible model source:

[winwin]
192.168.1.84 ansible_shell_type=powershell

[winwin:vars]
ansible_user=administrator
ansible_password=password
ansible_port=5985
ansible_connection=winrm
ansible_winrm_scheme=http
ansible_winrm_server_cert_validation=ignore

I hope it is useful.

Regards!

Jeremy Vermillion

unread,
Jan 24, 2022, 2:10:01 PM1/24/22
to rundeck-discuss
Hey, I tried changing my inventory  file to look like yours and it runs fine in Debian shell but when I attempt to run in Rundeck it again attempts to run in ssh.

UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host intdevopsch01.identifi.local port 22: Connection refused", "unreachable": true}

rac...@rundeck.com

unread,
Jan 24, 2022, 2:32:36 PM1/24/22
to rundeck-discuss
Hi Jeremy, Your project default node executor is set as "Ansible Ad-hoc Executor"? Check that on Project Settings > Edit Configuration > Defatul Node Executor tab.

Greetings.

Jeremy Vermillion

unread,
Jan 24, 2022, 3:28:18 PM1/24/22
to rundeck-discuss
Yes, Default Node Executor  set to Ansible Ad-Hoc Node Exectutor, Default File Copier set to Ansible File Copier

rac...@rundeck.com

unread,
Jan 24, 2022, 3:49:33 PM1/24/22
to rundeck-discuss
Hi Jeremy,

In the Default Node Executor tab (Project Settings > Edit Configuration) uncheck the "Generate ansible inventory" checkbox and try again. Look.

Hope it helps!

Jeremy Vermillion

unread,
Jan 24, 2022, 3:55:43 PM1/24/22
to rundeck-discuss
When I do that I don't get the unreachable error, instead I get "provided hosts list is empty, only localhost is available." for each of my nodes

rac...@rundeck.com

unread,
Jan 25, 2022, 6:44:04 AM1/25/22
to rundeck-discuss

Hi Jeremy,

Another place to look is the ansible.cfg file, let me share my configuration:

[defaults]
inventory       = /path/to/my/hosts
gather_subset = all
nocows = 1

The host file (inventory):

[winwin]
10.0.1.53 ansible_shell_type=powershell

[winwin:vars]
ansible_user=administrator
ansible_password=password
ansible_port=5985
ansible_connection=winrm
ansible_winrm_scheme=http
ansible_winrm_server_cert_validation=ignore

My full project Configuration:

#Tue Jan 25 08:32:47 CLST 2022
#edit below
project.ansible-config-file-path=/path/to/my/ansible.cfg
project.ansible-executable=/bin/bash
project.ansible-ssh-passphrase-option=option.password
project.ansible-windows-executable=powershell.exe
project.description=
project.disable.executions=false
project.disable.schedule=false
project.execution.history.cleanup.batch=500
project.execution.history.cleanup.enabled=false
project.execution.history.cleanup.retention.days=60
project.execution.history.cleanup.retention.minimum=50
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? *
project.jobs.gui.groupExpandLevel=1
project.label=
project.name=ProjectANSIBLE
project.nodeCache.enabled=true
project.nodeCache.firstLoadSynch=true
project.output.allowUnsanitized=false
project.ssh-authentication=privateKey
project.ssh-keypath=/home/user_name/.ssh/id_rsa
resources.source.1.type=local
resources.source.2.config.ansible-config-file-path=/path/to/my/ansible.cfg
resources.source.2.config.ansible-gather-facts=true
resources.source.2.config.ansible-ignore-errors=true
resources.source.2.config.ansible-inventory=/path/to/my/hosts
resources.source.2.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory
service.FileCopier.default.provider=com.batix.rundeck.plugins.AnsibleFileCopier
service.NodeExecutor.default.provider=com.batix.rundeck.plugins.AnsibleNodeExecutor

And my Ansible model source configuration.

I use this job definition to test the node:

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: 76d0a0b2-e27d-4fea-a8a5-a32be4430dbe
  loglevel: INFO
  name: HelloWorldWindows
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: 'name: 10.0.1.53 '
  nodesSelectedByDefault: true
  plugins:
    ExecutionLifecycle: null
  scheduleEnabled: true
  sequence:
    commands:
    - exec: whoami
    keepgoing: false
    strategy: node-first
  uuid: 76d0a0b2-e27d-4fea-a8a5-a32be4430dbe

The execution.

Greetings.

Jeremy Vermillion

unread,
Jan 25, 2022, 8:07:16 AM1/25/22
to rundeck-discuss
Looks like all I needed to do was change and unhash the default inventory location and it seems to be working correctly now!  ¯\_(ツ)_/¯

Thank you so much for the help.

rac...@rundeck.com

unread,
Jan 25, 2022, 8:16:26 AM1/25/22
to rundeck-discuss
Awesome Jeremy, I'm glad to know that.

Cheers!
Reply all
Reply to author
Forward
0 new messages