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