Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/nomad/tasks/main.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 # Skip Alpine (Nomad official binaries are glibc-linked, Alpine uses musl)
7 # Skip MacOS because of how complicated it is to run an downloaded binary
8 - name: Skip unsupported platforms
9 meta: end_play
10 when: >
11 ansible_facts.distribution == 'Alpine'
12 or ansible_facts.os_family == 'Darwin'
13
14 - name: Install python-nomad
15 pip:
16 name: python-nomad
17 extra_args: "-c {{ remote_constraints }}"
18 register: result
19 until: result is success
20
21 - name: Install jmespath
22 pip:
23 name: jmespath
24 extra_args: "-c {{ remote_constraints }}"
25 register: result
26 until: result is success
27
28 - name: Generate privatekey
29 community.crypto.openssl_privatekey:
30 path: '{{ remote_tmp_dir }}/privatekey.pem'
31
32 - name: Generate CSR
33 community.crypto.openssl_csr:
34 path: '{{ remote_tmp_dir }}/csr.csr'
35 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
36 subject:
37 commonName: localhost
38
39 - name: Generate selfsigned certificate
40 register: selfsigned_certificate
41 community.crypto.x509_certificate:
42 path: '{{ remote_tmp_dir }}/cert.pem'
43 csr_path: '{{ remote_tmp_dir }}/csr.csr'
44 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
45 provider: selfsigned
46 selfsigned_digest: sha256
47
48 - name: Install unzip
49 package:
50 name: unzip
51 register: result
52 until: result is success
53
54 - name: Download nomad binary
55 unarchive:
56 src: '{{ nomad_uri }}'
57 dest: '{{ remote_tmp_dir }}'
58 remote_src: true
59 register: result
60 until: result is success
61
62 - name: Run tests integration
63 block:
64 - name: Start nomad (dev mode enabled)
65 shell: nohup {{ nomad_cmd }} agent -dev </dev/null >/dev/null 2>&1 &
66
67 - name: wait nomad up
68 wait_for:
69 host: localhost
70 port: 4646
71 delay: 10
72 timeout: 60
73
74 - import_tasks: nomad_job.yml
75 always:
76
77 - name: kill nomad
78 shell: pkill nomad