Mar 8 05:41
@VonC
Mar 7 20:09
@VonC considering we have no solutions so far can you suggest how can I highlight my question to a broader audience? How should I respond to Your answer?
Mar 5 06:01
@VonC please let me know if you tried replicating my workflow and if auto-approval worked for you?
Mar 3 18:34
@VonC I don't think Could there be a delay? and this issue is unrelated to any GitHub incident. My runs are 3 days old and aren't waiting on anything. Would it be possible for you to copy my workflow and replicate the issue?
Mar 3 15:33
in this run you can see i have approved all items as seen in the matrix but the auto-approval does not work.
Mar 3 15:32
Mar 3 15:27
Run activescott/[email protected]
input environments_to_approve: [ 'item1', 'item3', 'item4' ]
input actors_to_approve: [ 'dependabot[bot]', 'mohtashims' ]
Deployment 'Update main.yml' (8130868052) to environment 'item3' will be approved...
Deployment 'Update main.yml' (8130861282) to environment 'item4' will be approved...
Deployment 'Update main.yml' (8130883932) to environment 'item1' will be approved...
Notice: Found 3 deploys that should be approved...
Approving deployment to item1 triggered by mohtashims for run Update main.yml...
Mar 3 15:02
but i see all three in the matrix as seen in the snapshot.
Mar 3 15:02
i dont know how to force activescott/automate-environment-deployment-approval to use node.js 20 as it is third party or if you can suggest some other solutions?
Mar 3 15:02
the issue is reproducible by simply using my workflow. Also, if I list item4 in environment_allow_list it does not get auto-approved
Mar 3 15:02
sorry but the suggestions do not help resolve the issue. 1. I'm using the latest version of the workflow i.e v1.0.6. I also approved item4 manually yet item1 and item3 remain unapproved ... does not get auto-approved. The token has permissions to perform everything and the approver mohtashims is also good.
 
Sep 15, 2020 14:13
but i wanted this to work with add_host as well
Sep 15, 2020 14:12
With set_facts it works!! difference is kicking in
Sep 15, 2020 14:01
Let me try
Sep 15, 2020 14:00
success_nodes is also constructed using add_host
Sep 15, 2020 14:00
success_nodes is also calculated using add_host
Sep 15, 2020 13:58
yes it give the list with all the entries and not the difference
Sep 15, 2020 13:57
yes they are equal for sure
Sep 15, 2020 13:56
2.9.4
Sep 15, 2020 13:56
between the two add_host
Sep 15, 2020 13:56
why does it not work in my case ?
Sep 15, 2020 13:55
As per the documentation the difference should work as i expect it to work
Sep 15, 2020 13:53
To get the difference of 2 lists (items in 1 that don’t exist in 2):

{{ list1 | difference(list2) }}
Sep 15, 2020 13:51
dest_nodes: 1, 2, 3, 4
success_nodes: 1, 2

my expected output is : 3,4

In my case success_nodes will always be a subset or equal to dest_nodes.
Sep 15, 2020 13:33
thats what i understood with the difference filter / function. I will run the loop on the difference rather than with_items: "{{ groups['dest_nodes'] }}" for each host play.
Sep 15, 2020 13:30
and i m expecting the difference to be Nil / Empty
Sep 15, 2020 13:30
Yes, thats what i m trying to convey
Sep 15, 2020 13:29
i.e same as it was for DIFFERENCENODE:{{ groups['dest_nodes'] | difference(success_nodes | default([])) }}
Sep 15, 2020 13:28
task path: /app/axmw/Ansible/playbook/injectsshkeys/checkandaddkey.yml:37
ok: [10.9.146.220] => {
"msg": "DIFFERENCENODE:[u'10.9.22.111', u'10.9.55.22', u'10.9.66.22']"
}
ok: [192.168.88.13] => {
"msg": "DIFFERENCENODE:[u'10.9.22.111', u'10.9.55.22', u'10.9.66.22']"
}
Sep 15, 2020 13:28
The output is:
Sep 15, 2020 13:28
- debug:
msg: "DIFFERENCENODE:{{ groups['dest_nodes'] }}"
Sep 15, 2020 13:28
With this
Sep 15, 2020 13:26
sure
Sep 15, 2020 13:24
The above playbook is include_tasks: performtask.yml from the Original Post
Sep 15, 2020 13:23
dest_nodes is also same as success_nodes i.e [u'10.9.22.111', u'10.9.55.22', u'10.9.66.22']"
Sep 15, 2020 13:22
---

- name: Check if connectivity already works
block:
- local_action: "raw ssh -o BatchMode=yes {{ TARGET_USER }}@{{ item }} echo success"
register: connworknow
ignore_errors: yes
- add_host:
hostname: "{{ item }}"
groups: success_nodes
when: connworknow.rc == 0
ignore_errors: yes


- debug:
msg: "SUCCESSNODE:{{ groups['success_nodes'] }}"

- debug:
msg: "DIFFERENCENODE:{{ groups['dest_nodes'] | difference(success_nodes | default([])) }}"

Output:

TASK [debug] *********************************************************************************************************************************
Sep 15, 2020 13:20
sure sharing ... one minute please
Sep 15, 2020 13:18
i'm trying to print the difference between dest_nodes and success_node when they are identical i.e having the same set of IPs
Sep 15, 2020 13:16
@Kevin C when dest_nodes and success_nodes both become identical as evident from the debug ....`-debug: msg="{{ groups['dest_nodes'] | difference(success_nodes | default([])) }}" prints all ips when the difference printed should be Nil/ Nothing.
Sep 15, 2020 13:14
@ Kevin C i updated my reply in the original post for readability.
Sep 15, 2020 13:14
I tried the following with debug but i get syntax error and not the difference. ` groups['dest_nodes' | difference(success_nodes | default([]) )] groups['dest_nodes' | difference('success_nodes' | default([]) )] groups[dest_nodes | difference(success_nodes | default([]) )]`
Sep 15, 2020 13:14
I may have not understood completely but, do you mean build a new third list success_nodes of successful task performed IPs inside performtask.yml and then mention something like this with_items: "{{ groups['dest_nodes'] | difference(success_nodes) }}" ?