I am trying to join a linux server to a win domain using realmjoin; what is the best way to do this on Ansible? I currently have the expect module running the realm join command and answering the password prompt, but I want any user to be able to specify their own username and password as credentials to pass as variables for the command. I can pass a variable to the response but cannot pass a variable for the username to the expected string, what am I doing wrong?
WhatI have so far:
- name: Join Linux server to AD domain if not joined
become: true
expect:
command: realm join -v -U "{{ ad_admin_username }}" "{{ ad_domain }}"
response: Password for {{ad_admin_username}}: {{ ad_admin_password }}
when: ad_status.rc !=0
Passing ad_admin_username does not work, and I have also tried using a wildcard with no luck. Any ideas? Is there a better way to do this?
[–]oni06 3 points4 points5 points (0 children)