Hi Everyone,
Quick question, I have a play where I put a laravel queue system in
maintenance mode before running updates against it's consumers.
I'd like to check for the existence of a file with stat on the queue
manager, run it if it exists (it might not be there if this is the first
run and it hasn't been deployed yet).
I've tried:
# If artisan exists, then set the application into maint. mode
- name: checking for artisan's existance in current symlink
stat: path={{ hostvars[item].www_dir }}/current/artisan
register: artisan_current
delegate_to: "{{ item }}"
with_items: groups.queue_managers
# This makes sure we don't keep serving an old release from the pool if
the deployment fails
# NGinx doesn't use the symlink so might keep serving from an old path
- name: set maint.mode in current version
command: php {{ hostvars[item].www_dir }}/current/artisan down
when: artisan_current.stat.exists is defined and
artisan_current.stat.exists
delegate_to: "{{ item }}"
with_items: groups.queue_managers
and
- name: checking for artisan's existance in current symlink
stat: path={{ hostvars[item].www_dir }}/curthe rent/artisan
register: hostvars[item].artisan_current
delegate_to: "{{ item }}"
with_items: groups.queue_managers
- name: set maint.mode in current version
command: php {{ hostvars[item].www_dir }}/current/artisan down
when: hostvars[item].artisan_current.stat.exists is defined and
hostvars[item].artisan_current.stat.exists
delegate_to: "{{ item }}"
with_items: groups.queue_managers
Whatever happens, I can see the stat return "exists: true", and then the
conditional check fails:
build 07-Mar-2016 11:57:06 TASK [checking for artisan's existance in current
symlink] *********************
build 07-Mar-2016 11:57:07 ok: [redacted -> redacted ] => (item=redacted) =>
{"changed": false, "item": "redacted", "stat": {"atime": 1457350038.6739905,
"checksum": "659b7d3cb04a4d3b4fd58cb147c2c9b33e0ea831", "ctime":
1457349988.065974, "dev": 64769, "exists": true, ...lots more output here...}}
build 07-Mar-2016 11:57:07 build 07-Mar-2016 11:57:07 TASK [set maint.mode in
current version] ***************************************
build 07-Mar-2016 11:57:07 skipping: [redacted] => (item=redacted) =>
{"changed": false, "item": "redacted", "skip_reason": "Conditional check
failed", "skipped": true}
Can anyone help me work out where the register actually puts the results of the
stat and therefore how I can present the results to the when: statement.
Thanks,
Steve
--
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/724d2e2f-30be-4287-bfab-518ed6f6cfa7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.