Re: [ansible-project] running handlers
On Fri, 22 Mar 2024 14:15:03 -0400 Michael DiDomenico wrote: > ... copy a bunch of ssl ca certs into a directory ... > create *.0 symlinks to each of the certs FWIW, instead of handlers, get the lists of the certs and links, and iterate the difference - find: paths: /tmp/ansible/certs patterns: '*.crt' register: out_crt - find: paths: /tmp/ansible/certs patterns: '*.0' file_type: link register: out_lnk - file: state: link src: /tmp/ansible/certs/{{ item }}.crt dest: /tmp/ansible/certs/{{ item }}.0 loop: "{{ certs | difference(links) }}" vars: certs: "{{ out_crt.files | json_query('[].path') | map('basename') | map('splitext') | map('first') }}" links: "{{ out_lnk.files | json_query('[].path') | map('basename') | map('splitext') | map('first') }}" Fit the paths to your needs. -- Vladimir Botka -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20240322210112.70847341%40planb. pgpd7f2n8VtxB.pgp Description: OpenPGP digital signature
[ansible-project] running handlers
i'm trying to copy a bunch of ssl ca certs into a directory. this works file with the copy module and if it sees a new one it runs a handler to rehash all the certs in the directory to create *.0 symlinks to each of the certs however, if an additional cert gets put in there by someone and they don't rehash the directory, now there's a cert without a hash i can count the *.crt's and the *.0's using the find module, which puts a 'matched' number into the ansible registered variable from the find, but i can't figure a way to run the handler to rehash the directory if the counts aren't equal i found some other examples where people just run handlers based on command: /bin/true with changed_when: true, but i don't want to run it all the time, only if the counts aren't equal any suggestions? -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABOsP2NsqXebiN%3D2YQn3kACveYcpvKkOs4r3C2pWoRYxzAsgRA%40mail.gmail.com.
[ansible-project] referring file from different repo
Hello guys, below is my playbook, actually i have csv file called subnetsheet in my git repo where i have kept my playbook, in my first task i am reading my yaml file and then based on the value "location_network" i am reading CSV file and get some of the data which was working as i am expected. here my question is can i keep my CSV file in a different git repo, if yes how can i call that csv file from this current repo. I am trying to keep a single csv file as I have branches. If I modify the csv data in amy of those branch it's getting conflicting so I want to keep a single csv file. If anyone has any idea pls help me. tasks: - name: read vm_data set_fact: vm_data: "{{ lookup('file', 'variables/vm_data.yaml') | from_yaml }}" tags: - read-vm_data - name: getting IP_scope getip_scope: csv_file: template/subnetsheet.csv location_network: "{{ location_network }}" register: vm_data tags: - get-ip-sco regards, Thirumalai Raja. -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALyK%3Dg86kQLgx%3DAPaQ8%2B%3D83n7s5-3mcxOP%2B36%2Bykn18eg%2BUECA%40mail.gmail.com.