--- # Copyright (c) Ansible Project # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later # Skip Alpine (Nomad official binaries are glibc-linked, Alpine uses musl) # Skip MacOS because of how complicated it is to run an downloaded binary - name: Skip unsupported platforms meta: end_play when: > ansible_facts.distribution == 'Alpine' or ansible_facts.os_family == 'Darwin' - name: Install python-nomad pip: name: python-nomad extra_args: "-c {{ remote_constraints }}" register: result until: result is success - name: Install jmespath pip: name: jmespath extra_args: "-c {{ remote_constraints }}" register: result until: result is success - name: Generate privatekey community.crypto.openssl_privatekey: path: '{{ remote_tmp_dir }}/privatekey.pem' - name: Generate CSR community.crypto.openssl_csr: path: '{{ remote_tmp_dir }}/csr.csr' privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem' subject: commonName: localhost - name: Generate selfsigned certificate register: selfsigned_certificate community.crypto.x509_certificate: path: '{{ remote_tmp_dir }}/cert.pem' csr_path: '{{ remote_tmp_dir }}/csr.csr' privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem' provider: selfsigned selfsigned_digest: sha256 - name: Install unzip package: name: unzip register: result until: result is success - name: Download nomad binary unarchive: src: '{{ nomad_uri }}' dest: '{{ remote_tmp_dir }}' remote_src: true register: result until: result is success - name: Run tests integration block: - name: Start nomad (dev mode enabled) shell: nohup {{ nomad_cmd }} agent -dev /dev/null 2>&1 & - name: wait nomad up wait_for: host: localhost port: 4646 delay: 10 timeout: 60 - import_tasks: nomad_job.yml always: - name: kill nomad shell: pkill nomad