I store the modules I need to deploy within Consul. It consist of both Perl
and PHP modules so on our web servers I only want to install the modules
associated with PHP. The following playbook works as long as there are TWO
matching modules. In my test case I have two keys with one of them being a
key related to PHP deploys. The error I get is:
fatal: [127.0.0.1] => with_items expects a list or a set
FATAL: all hosts have already failed -- aborting
If I remove the "when" clause and only have one key within Consul, it also
works. How do I get around the error if I'm using a "when" clause and all
that remainds within "deploy_list_result" is just one item?
## PLAYBOOK ##
- consul_kv: host=indeploy001 action=get key=deploylist/{{ jira_ticket }}
keys=True
register: modules_to_deploy
- name: set fact
set_fact: deploy_list="{{ item | replace("deploylist/" + jira_ticket +
"/",'') }}-{{ lookup('consul_kv',item) }}"
when: "'{{ item | replace('deploylist/' + jira_ticket + '/','') }}' in
php_modules"
with_items: '{{ modules_to_deploy.value }}'
register: deploy_list_result
- shell: sudo rpm -Uvh {{ rpm_repo }}/aria-{{ item }}.rpm --force --test
with_items: "{{ deploy_list_result.results |
map(attribute='ansible_facts.deploy_list') | sort }}"
register: php_command_result
--
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/7f307ebe-2c47-469c-9724-46c30c7e5a42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.