# use root to create admin user before disabling root ssh

**URL:** <https://forum.ansible.com/t/use-root-to-create-admin-user-before-disabling-root-ssh/14784>\
**Category:** Ansible Project\
**Created:** [March 15, 2014, 7:31pm UTC](https://forum.ansible.com/t/use-root-to-create-admin-user-before-disabling-root-ssh/14784 "2014-03-15T19:31:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brice\_Dorman](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@Brice\_Dorman](https://forum.ansible.com/u/Brice_Dorman)\
**Post date:** [March 15, 2014, 7:31pm UTC](https://forum.ansible.com/t/use-root-to-create-admin-user-before-disabling-root-ssh/14784/1 "2014-03-15T19:31:04Z")

</div>

objective:  
I want to be able to run a single playbook on a host independent of what state its in and only change what’s necessary.

problem:  
One of the plays in my playbook installs a SW package that disables root ssh, so the first thing I do is create an admin user that can execute all plays, so when root ssh is disabled all the plays can still work.

However the next time this play is executed ( when the playbook is rerun ) the play fails because root ssh is disabled and therefore the playbook exits early.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [March 17, 2014, 3:27pm UTC](https://forum.ansible.com/t/use-root-to-create-admin-user-before-disabling-root-ssh/14784/2 "2014-03-17T15:27:51Z")

</div>

have a 'pre play' that just has 3 tasks, 1st one tries to login as root,  
that play on failure sets\_fact ansible\_ssh\_user per host to either root (on  
success) or newadmin (on failure).
