github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/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 When ACLs are enabled, this command requires a token with the `submit-job` 39 and `list-jobs` capabilities for the job's namespace. 40 41 ## General Options 42 43 @include 'general_options.mdx' 44 45 ## Revert Options 46 47 - `-detach`: Return immediately instead of monitoring. A new evaluation ID 48 will be output, which can be used to examine the evaluation using the 49 [eval status] command. 50 51 - `-consul-token`: If set, the passed Consul token is sent along with the revert 52 request to the Nomad servers. This overrides the token found in the 53 `$CONSUL_HTTP_TOKEN` environment variable. 54 55 - `-vault-token`: If set, the passed Vault token is sent along with the revert 56 request to the Nomad servers. This overrides the token found in the 57 `$VAULT_TOKEN` environment variable. 58 59 - `-verbose`: Show full information. 60 61 ## Examples 62 63 Revert to an older version of a job: 64 65 ```shell-session 66 $ nomad job history -p example 67 Version = 1 68 Stable = false 69 Submit Date = 07/25/17 21:27:30 UTC 70 Diff = 71 +/- Job: "example" 72 +/- Task Group: "cache" 73 +/- Task: "redis" 74 +/- Config { 75 +/- image: "redis:3.2" => "redis:4.0" 76 port_map[0][db]: "6379" 77 } 78 79 Version = 0 80 Stable = false 81 Submit Date = 07/25/17 21:27:18 UTC 82 83 $ nomad job revert example 0 84 ==> Monitoring evaluation "faff5c30" 85 Evaluation triggered by job "example" 86 Evaluation within deployment: "e17c8592" 87 Allocation "4ed0ca3b" modified: node "e8a2243d", group "cache" 88 Evaluation status changed: "pending" -> "complete" 89 ==> Evaluation "faff5c30" finished with status "complete" 90 91 $ nomad job history -p example 92 Version = 2 93 Stable = true 94 Submit Date = 07/25/17 21:27:43 UTC 95 Diff = 96 +/- Job: "example" 97 +/- Task Group: "cache" 98 +/- Task: "redis" 99 +/- Config { 100 +/- image: "redis:4.0" => "redis:3.2" 101 port_map[0][db]: "6379" 102 } 103 104 Version = 1 105 Stable = false 106 Submit Date = 07/25/17 21:27:30 UTC 107 Diff = 108 +/- Job: "example" 109 +/- Task Group: "cache" 110 +/- Task: "redis" 111 +/- Config { 112 +/- image: "redis:3.2" => "redis:4.0" 113 port_map[0][db]: "6379" 114 } 115 116 Version = 0 117 Stable = false 118 Submit Date = 07/25/17 21:27:18 UTC 119 ``` 120 121 [`job history`]: /docs/commands/job/history 122 [eval status]: /docs/commands/eval-status 123 [consul service identity]: /docs/configuration/consul#allow_unauthenticated 124 [vault policy]: /docs/configuration/vault#allow_unauthenticated 125 [run]: /docs/commands/job/run