Skip to content

spin provision <environment> creates all servers instead of just <environment> #179

@gkrawiec

Description

@gkrawiec

Current Behavior

spin provision staging
should only create 1 server but creates 2, staging and production

Expected Behavior

I assumed that if I type
spin provision staging
only 1 of the 2 servers should be created.

Steps To Reproduce

I dont know if I am misunderstanding how this is supposed to work, but if i run
spin provision
I get both servers created (staging and production)
and if i then delete servers at hetzner, the ip addresses from spin.yml and known hosts and then run
spin provision staging
I again get the 2 servers created.

servers:
  - server_name: server-stg
    environment: staging
    hardware_profile: hetzner_2c_2gb_ubuntu2404

   - server_name: server-prd
     environment: production
     hardware_profile: hetzner_2c_2gb_ubuntu2404

environments:
  - name: production
  - name: staging
  - name: development
spin provision staging
Preparing Ansible run...
Gathering environment information...
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match 'all'

PLAY [Create servers with the VPS provider of your choice.] ********************************************************

TASK [Ensure providers, servers, and hardware profiles are defined] ************************************************
skipping: [localhost]

TASK [Create servers] **********************************************************************************************
included: serversideup.spin.create_server for localhost

TASK [serversideup.spin.create_server : Validate servers configuration] ********************************************
ok: [localhost] => (item={'server_name': 'server-stg', 'environment': 'staging', 'hardware_profile': 'hetzner_2c_2gb_ubuntu2404'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "environment": "staging",
        "hardware_profile": "hetzner_2c_2gb_ubuntu2404",
        "server_name": "server-stg"
    },
    "msg": "All assertions passed"
}
ok: [localhost] => (item={'server_name': 'server-prd', 'environment': 'production', 'hardware_profile': 'hetzner_2c_2gb_ubuntu2404'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "environment": "production",
        "hardware_profile": "hetzner_2c_2gb_ubuntu2404",
        "server_name": "server-prd"
    },
    "msg": "All assertions passed"
}

TASK [serversideup.spin.create_server : Check if any servers are missing an address] *******************************
ok: [localhost] => (item={'server_name': 'server-stg', 'environment': 'staging', 'hardware_profile': 'hetzner_2c_2gb_ubuntu2404'})
ok: [localhost] => (item={'server_name': 'server-prd', 'environment': 'production', 'hardware_profile': 'hetzner_2c_2gb_ubuntu2404'})

TASK [serversideup.spin.create_server : Create servers if any addresses are missing] *******************************
included: /etc/ansible/collections/ansible_collections/serversideup/spin/roles/create_server/tasks/create-servers.yml for localhost

TASK [serversideup.spin.create_server : Gather sudo users with their SSH keys] *************************************
ok: [localhost]

TASK [serversideup.spin.create_server : Get unique providers from servers] *****************************************
ok: [localhost]

...
...
...
RUNNING HANDLER [serversideup.spin.linux_common : Restart ssh] *****************************************************
changed: [254.156.128.206]
changed: [128.128.128.202]

RUNNING HANDLER [serversideup.spin.linux_common : Run newaliases] **************************************************
changed: [254.156.128.206]
changed: [128.128.128.202]

RUNNING HANDLER [serversideup.spin.docker : Enable ufw] ************************************************************
changed: [254.156.128.206]
changed: [128.128.128.202]

RUNNING HANDLER [serversideup.spin.docker : Restart docker] ********************************************************
changed: [128.128.128.202]
changed: [254.156.128.206]

PLAY RECAP *********************************************************************************************************
128.128.128.202            : ok=52   changed=35   unreachable=0    failed=0    skipped=5    rescued=0    ignored=0   
254.156.128.206            : ok=53   changed=35   unreachable=0    failed=0    skipped=10   rescued=0    ignored=0   
localhost                  : ok=16   changed=3    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0   
server-prd                   : ok=3    changed=1    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0   
server-stg                   : ok=3    changed=1    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0 





Environment

spin debug
Spin Version: 
v3.1.1 [stable] (User Installed)

Operating System Version: 
ProductName:		macOS
ProductVersion:		26.2
BuildVersion:		25C56

Docker Info: 
WARNING: DOCKER_INSECURE_NO_IPTABLES_RAW is set
Client:
 Version:    28.5.2
 Context:    orbstack
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.29.1
    Path:     /Users/myuser/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.40.3
    Path:     /Users/myuser/.docker/cli-plugins/docker-compose

Server:
 Containers: 9
  Running: 9
  Paused: 0
  Stopped: 0
 Images: 12
 Server Version: 28.5.2
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1c4457e00facac03ce1d75f7b6777a7a851e5c41
 runc version: d842d7719497cc3b774fd71620278ac9e17710e0
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.17.8-orbstack-00308-g8f9c941121b1
 Operating System: OrbStack
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.67GiB
 Name: orbstack
 ID: cece5a39-9f6f-40ab-be4e-4a8f57e24070
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
 Default Address Pools:
   Base: 192.168.97.0/24, Size: 24
   Base: 192.168.107.0/24, Size: 24
   Base: 192.168.117.0/24, Size: 24
   Base: 192.168.147.0/24, Size: 24
   Base: 192.168.148.0/24, Size: 24
   Base: 192.168.155.0/24, Size: 24
   Base: 192.168.156.0/24, Size: 24
   Base: 192.168.158.0/24, Size: 24
   Base: 192.168.163.0/24, Size: 24
   Base: 192.168.164.0/24, Size: 24
   Base: 192.168.165.0/24, Size: 24
   Base: 192.168.166.0/24, Size: 24
   Base: 192.168.167.0/24, Size: 24
   Base: 192.168.171.0/24, Size: 24
   Base: 192.168.172.0/24, Size: 24
   Base: 192.168.181.0/24, Size: 24
   Base: 192.168.183.0/24, Size: 24
   Base: 192.168.186.0/24, Size: 24
   Base: 192.168.207.0/24, Size: 24
   Base: 192.168.214.0/24, Size: 24
   Base: 192.168.215.0/24, Size: 24
   Base: 192.168.216.0/24, Size: 24
   Base: 192.168.223.0/24, Size: 24
   Base: 192.168.227.0/24, Size: 24
   Base: 192.168.228.0/24, Size: 24
   Base: 192.168.229.0/24, Size: 24
   Base: 192.168.237.0/24, Size: 24
   Base: 192.168.239.0/24, Size: 24
   Base: 192.168.242.0/24, Size: 24
   Base: 192.168.247.0/24, Size: 24
   Base: fd07:b51a:cc66:d000::/56, Size: 64

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions