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.
---
- hosts: all
user: root
tasks:
- name: Create an admin account user=cip
user: name=cip password={{cip_password_hash}} shell=/bin/bash group={{admin_group}}
solutions:
What's the best "ansible" way to work around this issue?
1. Put this into a separate playbook and only execute once.
2. Remove the "user: root" from the play and add remote_user: root and ignore_errors: yes
3. Something I haven't thought of yet
Any advice would be greatly appreciated. Thanks in advance.
--Brice