Skip to content

Instantly share code, notes, and snippets.

@sanguis
Created July 26, 2016 15:39
Show Gist options
  • Save sanguis/43670c3edfb9f08f6d4bf06d18157b52 to your computer and use it in GitHub Desktop.
Save sanguis/43670c3edfb9f08f6d4bf06d18157b52 to your computer and use it in GitHub Desktop.
ansible when syntax
vars:
web_user: web_user
dirs:
cache: /opt/ansible/cache
web_root: /srv/www/
repo: redacted
#set password to "random" to have password auto_generated
mysql:
user: fop_user
db: fop_db
password: boomers
# tasks file for git_deployment
- name: Generate DB login_password
shell: mkpasswd.pl --length=32
args:
creates: /tmp/.dbpwd
register: dbpwd
when: mysql.password != "random"
- name: debug password genreation
debug: var=dbpwd
when: dbpwd is defined
- name: debug password being set
debug: var=mysql
when: { mysql.password != "random" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment