Team,
Anyone have idea to integrate Windows nodes with foreman with help of ansible. Im able to add windows hosts to forman but, when im trying to do some remote action with ansible, it is including remote_execution_ssh variables. Even i tried to override + include some extra parameters which are supported for regular ansible. below is the sample task details.
---
proxy_operation_name: ansible-runner
ansible_inventory:
all:
hosts:
- vm03-windows12.test.org
vars: {}
_meta:
hostvars:
vm03-windows12.test.org:
foreman:
hostgroup: Windows
foreman_subnets: []
foreman_interfaces:
- ip: 10.0.2.7
ip6:
mac: 00:0d:3a:7d:50:0f
name: vm03-windows12.test.org
attrs: {}
virtual: false
link: true
identifier:
managed: true
primary: true
provision: true
subnet:
subnet6:
tag:
attached_to:
type: Interface
location: Default Location
location_title: Default Location
organization: Test.org
organization_title: Test.org
domainname: test.org
owner_name: hostcreate
owner_email: ''
ssh_authorized_keys: []
foreman_users:
hostcreate:
firstname: ''
lastname: ''
mail: ''
description: ''
fullname: ''
name: hostcreate
ssh_authorized_keys: []
root_pw:
foreman_config_groups: []
puppetmaster: ''
foreman_ansible_roles: []
ansible_connection: winrm
ansible_ssh_private_key_file: "/usr/share/foreman-proxy/.ssh/id_rsa_foreman_proxy"
ansible_winrm_server_cert_validation: ignore
ansible_user: testuser
ansible_become_method: runas
ansible_port: 5985
ansible_host: 10.0.2.7
ansible_become_user: testuser
ansible_become: 'yes'
ansible_ssh_port: '22'
ansible_ssh_user: root
ansible_become_password: password123
ansible_password: password123
ansible_winrm_scheme: http
ansible_winrm_transport: basic
remote_execution_ssh_user: root
remote_execution_effective_user_method: sudo
remote_execution_connect_by_ip: true
remote_execution_ssh_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3F6jajskfkjsfhjshfskSCHFRqB7LVTZq17o2p0Bx4kF2tYEIudx4jtqIsQh3W0py5hE+OTuvc1u4hl927RmzWw0zSmWKCX5M6o9ZRWmrmEYWdKCyNSqgeegw9is7Tco1xljOLhiCGAbmG9y91LbJJyKSLdge6TSTTWymzYzsfOcnoqFDVklGzIiCRJGgmowj9XFebakGxKLnjhuXKbtnKN4VJpGM+JgZLp6Rwt8tUzAZp8dsMEK4gueHvxEcJortEhSPYGA8W5+yP/pQlck0945ma+CrjN
foreman-proxy@proxy.test.org
verbosity_level: '0'
remote_execution_command: true
name: vm03-windows12.test.org
hostname: 10.0.2.7
script: |-
---
- hosts: all
tasks:
- name: checking the ping status
win_ping:
execution_timeout_interval:
use_batch_triggering: true
use_concurrency_control: false
connection_options:
retry_interval: 15
retry_count: 4
proxy_batch_triggering: true
proxy_url: https://proxy.test.org:8443
proxy_action_name: ForemanRemoteExecutionCore::Actions::RunScript
proxy_version:
major: 2
minor: 0
patch: 1
current_request_id:
current_timezone: Asia/Calcutta
current_user_id: 4
current_organization_id:
current_location_id: 2
Output:
---
proxy_output:
result:
- output_type: stdout
output: "[WARNING]: log file at /var/log/ansible.log is not writeable and we cannot
create it, aborting\n"
timestamp: 1598255235.0670078
- output_type: stdout
output: "\n"
timestamp: 1598255235.0670578
- output_type: stdout
output: "\n"
timestamp: 1598255236.0696933
- output_type: stdout
output: "\r\nPLAY [all] *********************************************************************\n"
timestamp: 1598255236.0698001
- output_type: stdout
output: "\r\nTASK [Gathering Facts] *********************************************************\n"
timestamp: 1598255236.0698779
- output_type: stdout
output: "\n"
timestamp: 1598255236.0700006
- output_type: stdout
output: 'ok: [vm03-windows12.test.org]
'
timestamp: 1598255240.3793015
- output_type: stdout
output: '500 Server Error: Internal Server Error
'
timestamp: 1598255241.3825948
- output_type: stdout
output: "\r\nTASK [checking the ping status] ************************************************\n"
timestamp: 1598255241.3826725
- output_type: stdout
output: "\n"
timestamp: 1598255241.3827906
- output_type: stdout
output: 'ok: [vm03-windows12.test.org]
'
timestamp: 1598255243.4877446
- output_type: stdout
output: |-
PLAY RECAP *********************************************************************
vm03-windows12.test.org : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
timestamp: 1598255243.4878688
exit_status:
Note: Im trying to separating the windows and linux ansible parameters with the help of host groups.