# Use ansible to allow AD authentication

**URL:** <https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619>\
**Category:** Ansible Project\
**Created:** [June 20, 2019, 6:44pm UTC](https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619 "2019-06-20T18:44:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_McPherson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dave_mcpherson/32/6973_2.png) [@Dave\_McPherson](https://forum.ansible.com/u/Dave_McPherson)\
**Post date:** [June 20, 2019, 6:44pm UTC](https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619/1 "2019-06-20T18:44:33Z")

</div>

I am trying to push AD authentication out to a series of Oracle Linux machines.  
The command is: realm join --verbose “domain.local” --user “domain\_service”

---

<div class="post-metadata">

**Author:** ![Angel\_Rengifo\_Cancin](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Angel\_Rengifo\_Cancin](https://forum.ansible.com/u/Angel_Rengifo_Cancin)\
**Post date:** [June 20, 2019, 7:03pm UTC](https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619/2 "2019-06-20T19:03:04Z")

</div>

Hi:

> I am trying to push AD authentication out to a series of Oracle Linux machines.  
> The command is: realm join --verbose “domain.local” --user “domain\_service”
> 
> * * *
> 
> - tasks: Add server to AD  
> hosts: ‘ud-srv’  
> become: true  
> vars:  
> realm\_name:  
> realm: “domain.local”  
> user: “domain\_service”  
> pass: ‘Passwd!!’
> 
> tasks:
> 
> - name: Join the AD Domain
> 
> command: realm join --verbose “{{realm\_name.realm}}” --user “{{realm\_name.user}}” --one-time-password= “{{realm\_name.pass}}”

Have you manually tried this same exact command on the shell? Is it supposed to not ask for a password? Also, I can notice there’s a white space between “=” and “{{realm\_name.pass}}”, is that intentional or a mistake?

When I’m not sure how a command (or shell instruction) might work when running through ansible, I use to put an echo at the beginning, register the output in a variable, show it to stdout and copy &paste manually on the shell for testing:

- name: Join the AD Domain

command: echo realm join --verbose “{{realm\_name.realm}}” --user “{{realm\_name.user}}” --one-time-password= “{{realm\_name.pass}}”  
register: result

- debug: msg={{ result }}

Hope this helps you.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [June 20, 2019, 7:04pm UTC](https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619/3 "2019-06-20T19:04:39Z")

</div>

do you get an error or anything?

---

<div class="post-metadata">

**Author:** ![Dave\_McPherson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dave_mcpherson/32/6973_2.png) [@Dave\_McPherson](https://forum.ansible.com/u/Dave_McPherson)\
**Post date:** [June 20, 2019, 7:52pm UTC](https://forum.ansible.com/t/use-ansible-to-allow-ad-authentication/30619/4 "2019-06-20T19:52:55Z")

</div>

The shell command is #realm join --verbose “domain.local” --user “vm\_service”  
Then it prompts for the vm\_service password
