Answers: <p>It does nothing. A huge part of the purpose of Chef is that converges are <em><a href="https://en.wiktionary.org/wiki/idempotent" rel="noreferrer">idempotent</a></em>, meaning you can run them repeatedly with no cumulative effects. I highly recommend consulting the <a href="https://docs.chef.io/" rel="noreferrer">Chef documentation</a> as it will provide an excellent foundation for understanding how and why Chef works.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-19T19:14:24.910Z
Answers: 2017-05-19T19:14:24.910Z
Answers: Adrian
Body: <p>I need to install a jenkins on a server using a user jenkinsuser and group jenkinsgroup. so in my recipe I defined as </p>
  
  <pre><code>#group
  group jenkinsgroup do
    system true
  end
  # creates user
  user jenkinsuser do
    gid jenkinsgroup
    system true
  end
  </code></pre>
  
  <p>but what will happen if the user and group exist already in node (where I am trying to install jenkins) 
  Does my resource do nothing as a user and group exists and go for next steps or will it throw an error as user exists?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-05-19T16:49:03.030Z
Comments: Why don't you try it? Wouldn't have taken longer than writing this, right?
Comments: StephenKing
Comments: CC BY-SA 3.0
Comments: 2017-05-19T16:50:31.933Z
Comments: With chef, you define the desired state (e.g. a group exists). Therefore, it does nothing, if the system is already in the desired state.
Comments: StephenKing
Tags: <chef>
Title: User management using chef
UserDisplayName: pandey
ThreadText: # User management using chef
  
  (Asked by: username_0 on 2017-05-19)
  
  I need to install a jenkins on a server using a user jenkinsuser and group jenkinsgroup. so in my recipe I defined as
  
  ```
  #group
  group jenkinsgroup do
    system true
  end
  # creates user
  user jenkinsuser do
    gid jenkinsgroup
    system true
  end
  
  ```
  
  but what will happen if the user and group exist already in node (where I am trying to install jenkins)
  Does my resource do nothing as a user and group exists and go for next steps or will it throw an error as user exists?
  
  **Tags:** chef
  
  > **Comments:**
  > **username_1**: Why don't you try it? Wouldn't have taken longer than writing this, right?  
  > **username_1**: With chef, you define the desired state (e.g. a group exists). Therefore, it does nothing, if the system is already in the desired state.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-05-19. Score: 6
  
  It does nothing. A huge part of the purpose of Chef is that converges are *[idempotent](https://en.wiktionary.org/wiki/idempotent)*, meaning you can run them repeatedly with no cumulative effects. I highly recommend consulting the [Chef documentation](https://docs.chef.io/) as it will provide an excellent foundation for understanding how and why Chef works.
  
  
  ---
  
  