github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/commands/job/revert.mdx (about) 1 --- 2 layout: docs 3 page_title: 'Commands: job revert' 4 sidebar_title: revert 5 description: | 6 The revert command is used to revert to a prior version of the job. 7 --- 8 9 # Command: job revert 10 11 The `job revert` command is used to revert a job to a prior version of the 12 job. The available versions to revert to can be found using [`job history`] 13 command. 14 15 The revert command will use a Consul token with the following preference: 16 first the `-consul-token` flag, then the `$CONSUL_HTTP_TOKEN` environment variable. 17 Because the consul token used to [run] the targeted job version was not 18 persisted, it must be provided to revert if the targeted job version includes 19 Consul Connect enabled services and the Nomad servers were configured to require 20 [consul service identity] authentication. 21 22 The revert command will use a Vault token with the following preference: 23 first the `-vault-token` flag, then the `$VAULT_TOKEN` environment variable. 24 Because the vault token used to [run] the targeted job version was not 25 persisted, it must be provided to revert if the targeted job version includes 26 Vault policies and the Nomad servers were configured to require [vault policy] 27 authentication. 28 29 ## Usage 30 31 ```plaintext 32 nomad job revert [options] <job> <version> 33 ``` 34 35 The `job revert` command requires two inputs, the job ID and the version of that 36 job to revert to. 37 38 ## General Options 39 40 @include 'general_options.mdx' 41 42 ## Revert Options 43 44 - `-detach`: Return immediately instead of monitoring. A new evaluation ID 45 will be output, which can be used to examine the evaluation using the 46 [eval status] command. 47 48 - `-consul-token`: If set, the passed Consul token is sent along with the revert 49 request to the Nomad servers. This overrides the token found in the 50 \$CONSUL_HTTP_TOKEN environment variable. 51 52 - `-vault-token`: If set, the passed Vault token is sent along with the revert 53 request to the Nomad servers. This overrides the token found in the 54 \$VAULT_TOKEN environment variable. 55 56 - `-verbose`: Show full information. 57 58 ## Examples 59 60 Revert to an older version of a job: 61 62 ```shell-sessionnomad job history -p example 63 Version = 1 64 Stable = false 65 Submit Date = 07/25/17 21:27:30 UTC 66 Diff = 67 +/- Job: "example" 68 +/- Task Group: "cache" 69 +/- Task: "redis" 70 +/- Config { 71 +/- image: "redis:3.2" => "redis:4.0" 72 port_map[0][db]: "6379" 73 } 74 75 Version = 0 76 Stable = false 77 Submit Date = 07/25/17 21:27:18 UTC 78 79 $ nomad job revert example 0 80 ==> Monitoring evaluation "faff5c30" 81 Evaluation triggered by job "example" 82 Evaluation within deployment: "e17c8592" 83 Allocation "4ed0ca3b" modified: node "e8a2243d", group "cache" 84 Evaluation status changed: "pending" -> "complete" 85 ==> Evaluation "faff5c30" finished with status "complete" 86 87 $ nomad job history -p example 88 Version = 2 89 Stable = true 90 Submit Date = 07/25/17 21:27:43 UTC 91 Diff = 92 +/- Job: "example" 93 +/- Task Group: "cache" 94 +/- Task: "redis" 95 +/- Config { 96 +/- image: "redis:4.0" => "redis:3.2" 97 port_map[0][db]: "6379" 98 } 99 100 Version = 1 101 Stable = false 102 Submit Date = 07/25/17 21:27:30 UTC 103 Diff = 104 +/- Job: "example" 105 +/- Task Group: "cache" 106 +/- Task: "redis" 107 +/- Config { 108 +/- image: "redis:3.2" => "redis:4.0" 109 port_map[0][db]: "6379" 110 } 111 112 Version = 0 113 Stable = false 114 Submit Date = 07/25/17 21:27:18 UTC 115 ``` 116 117 [`job history`]: /docs/commands/job/history 118 [eval status]: /docs/commands/eval-status 119 [consul service identity]: /docs/configuration/consul#allow_unauthenticated 120 [vault policy]: /docs/configuration/vault#allow_unauthenticated 121 [run]: /docs/commands/job/run