ansible-community / ansible-nomad

:watch: Ansible role for Nomad
https://galaxy.ansible.com/brianshumate/nomad
BSD 2-Clause "Simplified" License
294 stars 163 forks source link

run more tasks in install only once #116

Closed rndmh3ro closed 3 years ago

rndmh3ro commented 3 years ago

This PR ensures that all tasks that run on localhost only run once. Otherwise nomad gets downloaded more than once if you install nomad on multiple hosts at the same time.

lanefu commented 3 years ago

@rndmh3ro what if role is deploying for multi CPU architectures during execution of play

rndmh3ro commented 3 years ago

Yeah, this wouldn't work then, I suppose.

lanefu commented 3 years ago

@rndmh3ro is the package really getting downloaded multiple times?

Is this conditional not working as expected? when: not nomad_package.stat.exists

- name: Download Nomad
  get_url:
    url: "{{ nomad_zip_url }}"
    dest: "{{ role_path }}/files/{{ nomad_pkg }}"
    checksum: "sha256:{{ nomad_sha256.stdout }}"
    timeout: "42"
  become: false
  tags: installation
  delegate_to: 127.0.0.1
  when: not nomad_package.stat.exists
rndmh3ro commented 3 years ago

Hm, I cannot reproduce this anymore. It only gets downloaded once.