Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salt Pillar and State roots not moved to final location #17150

Closed
jcockhren opened this issue Jan 21, 2018 · 4 comments · Fixed by #17151
Closed

Salt Pillar and State roots not moved to final location #17150

jcockhren opened this issue Jan 21, 2018 · 4 comments · Fixed by #17151

Comments

@jcockhren
Copy link

jcockhren commented Jan 21, 2018

If you define a minion_config_file, the step that moves directories uploaded via the local_state_tree and local_pillar_roots variables to their final destinations, remote_state_tree and remote_pillar_roots, respectively, does not perform the copy. This is due the final values of remote_state_tree and remote_pillar_roots being empty once the run starts.

Terraform Version

0.11.2

Terraform Configuration Files

resource "aws_instance" "test" {                                                
  ami = "${module.ami.base_image}"                                              
  instance_type = "t2.micro"                                                    
  subnet_id = "${aws_default_subnet.main.id}"                                   
  associate_public_ip_address = true                                               
  key_name = "yubi"                                                                
  vpc_security_group_ids = [                                                       
    "${module.sg.ssh}",                                                            
    "${module.sg.http}",                                                           
    "${module.sg.ssl}"                                                             
  ]                                                                                
  provisioner "file" {                                                             
    source = "./pillar"                                                            
    destination = "/tmp/pillar"                                                    
    connection {                                                                   
      user = "admin"                                                               
      agent = true                                                                 
    }                                                                              
  }                                                                                
  provisioner "salt-masterless" {                                                  
    local_state_tree = "../salt/states"                                            
    local_pillar_roots = "../salt/pillar"                                          
    minion_config_file = "minion"                                                  
    connection {                                                                   
      user = "admin"                                                               
      agent = true                                                                 
    }                                                                              
  }                                                                                
}                                        

Expected Behavior

aws_instance.test (salt-masterless):  *  INFO: Salt installed!
aws_instance.test (salt-masterless): Creating remote temporary directory: /tmp/salt
aws_instance.test (salt-masterless): Creating directory: /tmp/salt
aws_instance.test (salt-masterless): Uploading minion config: minion
aws_instance.test (salt-masterless): Make sure directory /etc/salt exists
aws_instance.test (salt-masterless): Creating directory: /etc/salt
aws_instance.test (salt-masterless): Moving /tmp/salt/minion to /etc/salt/minion
aws_instance.test (salt-masterless): Uploading local state tree: ../salt/states
aws_instance.test (salt-masterless): Creating directory: /tmp/salt/states
aws_instance.test (salt-masterless): Removing directory: /srv/salt
aws_instance.test (salt-masterless): Moving /tmp/salt/states to /srv/salt
aws_instance.test (salt-masterless): Uploading local pillar roots: ../salt/pillar
aws_instance.test (salt-masterless): Creating directory: /tmp/salt/pillar
aws_instance.test: Still creating... (1m10s elapsed)
aws_instance.test (salt-masterless): Removing directory: /srv/pillar
aws_instance.test (salt-masterless): **Moving /tmp/salt/pillar to /srv/pillar**

Actual Behavior

selection_012

Arrows point to where the directories are missing.

Steps to Reproduce

With the configuration above (assuming you've configured your provider),

  1. Define paths for the local_state_tree and local_pillar_roots variables that exists.
  2. create a file for the minion_config_file variable that exists.
  3. terraform apply

Additional Context

The docs state that you cannot use minion_config_file with defining either remote_pillar_roots or remote_state_tree. Given none of the remote_* variables are defined in the configuration above, that caveat does not apply to this issue.

@dawidmalina
Copy link

I've just experienced the same issue.

* null_resource.bootstrap_nodes[1]: Unable to move /tmp/salt/states to : error executing "sudo mv /tmp/salt/states ": Process exited with status 1

Workarround is not possible as we can't provide remote_state_tree:

Error: null_resource.bootstrap_nodes: remote_state_tree and remote_pillar_roots only apply when minion_config_file is not used

Do you know when this can be fixed?

@leslitagordita
Copy link

leslitagordita commented Dec 19, 2018

If you define the arguments remote_pillar_roots and remote_state_tree in your provisioner "salt-masterless" {} block, you will not encounter this error. It seems as if there is not an actual default set for these two arguments as noted in the documentation. Perhaps until the provisioner is updated to provide default directory locations, the documentation can be updated to reflect the actual behavior.

@leslitagordita
Copy link

I submitted a PR, which I think will solve the issue of no defined defaults as indicated in the documentation: #19712

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants