I'm trying to install MSI file with the help of ansible.windows.win_package
module
One of the arguments needs to hold the appserver machine name
Trying the following syntax - didn't work (I shrink the arguments list in the following task file example):
- name: Install Server.msi center_primary_dbserver
ansible.windows.win_package:
path: c:\r10_files\Server.msi
arguments:
...
AUTH=WINDOWS
APPSERVER={{ center_primary_appservers }}
RABBITSERVER={{ center_qservers.hosts[0] }}
...
THUMBPRINT={{ cert_thumbprint }}
SECURED=1
SQLSERVERNAME={{ inventory_hostname_short }}
LOG_SIZE=100
...
when: "'center_primary_dbservers' in group_names"
Here, is part of my inventory file:
---
all:
children:
root:
children:
center:
children:
center_primary_appservers:
hosts:
vm1.domain.com:
center_qservers:
hosts:
vm2.domain.com:
center_primary_dbservers:
hosts:
vm3.domain.com:
As we can see -
I need to place the value of the center_primary_appserver
machine in APPSERVER
argument,
and the value of the center_qserver
machine in RABBITSERVER
argument
For the THUMBPRINT
I created a separate task file that it's results are registered with a cert_thumbprint
variable, like this:
- name: Import certificate thumbprint
ansible.windows.win_certificate_store:
path: "{{ cert_path.files[0].path }}"
file_type: pkcs12
password: "FooF!ght3rs"
store_location: LocalMachine
key_storage: machine
state: present
become: yes
become_method: runas
become_user: SYSTEM
register: cert_thumbprint
when: "'certificate_autohrities' in group_names"
So, currently, executing this task produces the following error:
{
"changed": false,
"invocation": {
"module_args": {
"arguments":
...
THUMBPRINT={'changed': False, 'skipped': True,
'skip_reason': 'Conditional result was False'}
RABBIT_PARENT_SERVER=center_qservers.hosts[0]
SECURED=1
SQLSERVERNAME=vm3
LOG_SIZE=100
...
}
}
}
}
To sum up the question:
What is the right syntax to:
- assign in MSI Arguments - registered variable from another task file (in our example:
cert_thumbprint
)?
- assign in MSI Arguments - machine varaible from inventory (in our example:
center_primary_appservers
, center_qservers.hosts[0]
)?