1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/nomad/tasks/nomad_job.yml
chris93111 b2e075e6d3
new module nomad_job & nomad_job_info (#867)
* nomad_job module

* Delete nomad_job.py

* new module nomad_job

* fix symlink

* disable test with centos6 , not supported

* fix centos unsupported

* fix

* requested changes doc

* disable freebsd ci

* requested change docs + check_mode

* lint

* fix syntax

* update docs

* doc fix

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update nomad_job.py

fix docs + ssl true default

* Update nomad_job.yml

disable ssl ci

* nomad_job_info

* Update nomad_job_info.py

fix token nomad job info

* Update nomad_job.py

idempotence + check_mode plan result

* Update nomad_job.py

fail if no id with json content

* Update nomad_job.yml

ci idempotence + check_mode , nomad_job and nomad_job_info

* Update nomad_job.yml

fix ci

* Update main.yml

add kill nomad ci

* Update main.yml

always kill

* fix check mode delete job

* ci with delete and check_mode

* lint

* force start in first deploy

* 12.4 nomad

* fix version nomad

* fix ci assert

* fix ci

* fix ci

* lint

* fix version job id None, import os unused

* lint job_info

* Update aliases

* docs frag + info refacto

* lint

lint

* ci

* jmespath

* fix ci

Co-authored-by: FERREIRA Christophe <christophe.ferreira@cnaf.fr>
Co-authored-by: Felix Fontein <felix@fontein.de>
2020-10-19 13:40:07 +02:00

90 lines
2 KiB
YAML

---
- name: run check deploy nomad job
nomad_job:
host: localhost
state: present
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
register: job_check_deployed
check_mode: true
- name: run create nomad job
nomad_job:
host: localhost
state: present
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
force_start: true
register: job_deployed
- name: get nomad job deployed
nomad_job_info:
host: localhost
use_ssl: false
name: example
register: get_nomad_job
- name: get list of nomad jobs
nomad_job_info:
host: localhost
use_ssl: false
register: list_nomad_jobs
- name: assert job is deployed and tasks is changed
assert:
that:
- job_check_deployed is changed
- job_deployed is changed
- get_nomad_job.result[0].ID == "example"
- list_nomad_jobs.result | length == 1
- name: run check deploy job idempotence
nomad_job:
host: localhost
state: present
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
register: job_check_deployed_idempotence
check_mode: true
- name: run create nomad job idempotence
nomad_job:
host: localhost
state: present
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
register: job_deployed_idempotence
- name: run check delete nomad job
nomad_job:
host: localhost
state: absent
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
register: job_deleted_check
check_mode: true
- name: run delete nomad job
nomad_job:
host: localhost
state: absent
use_ssl: false
content: "{{ lookup('file', 'job.hcl') }}"
register: job_deleted
- name: get job deleted
nomad_job_info:
host: localhost
use_ssl: false
name: example
register: get_job_delete
- name: assert idempotence
assert:
that:
- job_check_deployed_idempotence is not changed
- job_deployed_idempotence is not changed
- job_deleted_check is changed
- job_deleted is changed
- get_job_delete.result[0].Stop