IMHO, as long as this works for you it is okay.
On Tuesday, April 1, 2014 5:49:36 PM UTC+2, Patrick Ogenstad wrote:
>
> I've just gotten started with Ansible. I must say it's ridiculously
> simple. :)
>
> I've created a few playbooks and was setting up mysql. The module
> documentation mentions editing ~/.my.cnf and some links on the net
> recommend using the file in order to create a idempotent mysql playbook.
>
> However I didn't want to write the password in a textfile.
>
> Instead as a workaround I created two tasks in the playbook:
>
> # This task will fail the first time when the password
> # is blank
> - name: Ensure MySQL Root Password is changed, this task will fail the
> first time
> mysql_user: name=root password={{ mysqlrootpass }} login_user=root
> login_password={{ mysqlrootpass }} state=present
> register: mysqlwithpassword
> ignore_errors: True
>
> - name: Set MySQL root password
> mysql_user: name=root password={{ mysqlrootpass }} login_user=root
> login_password='' state=present
> when: mysqlwithpassword|failed
>
> The first task will always fail on the first run and when it fail the
> second task will run. Running the Playbook a second time won't change the
> system making the playbook idempotent.
>
> Would this be considered bad form in a Ansible sort of way? :) Do you see
> any downside to solving the problem in this way?
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/388f5255-7704-4eec-8228-175f7dcef8be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.