The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys.
1and1 >= 1.2.0
The module requires the 1&1 api_token to be provided. The server should also be assigned a public LAN, a private LAN, or both along with SSH key pairs.
Set up the cloud configuration at /etc/salt/cloud.providers
or
/etc/salt/cloud.providers.d/oneandone.conf
:
my-oneandone-config:
driver: oneandone
# The 1&1 api token
api_token: <your-token>
# SSH private key filename
ssh_private_key: /path/to/private_key
# SSH public key filename
ssh_public_key: /path/to/public_key
my-oneandone-profile:
provider: my-oneandone-config
# Either provide fixed_instance_size_id or vcore, cores_per_processor, ram, and hdds.
# Size of the ID desired for the server
fixed_instance_size: S
# Total amount of processors
vcore: 2
# Number of cores per processor
cores_per_processor: 2
# RAM memory size in GB
ram: 4
# Hard disks
hdds:
-
is_main: true
size: 20
-
is_main: false
size: 20
# ID of the appliance image that will be installed on server
appliance_id: <ID>
# ID of the datacenter where the server will be created
datacenter_id: <ID>
# Description of the server
description: My server description
# Password of the server. Password must contain more than 8 characters
# using uppercase letters, numbers and other special symbols.
password: P4$$w0rD
# Power on server after creation - default True
power_on: true
# Firewall policy ID. If it is not provided, the server will assign
# the best firewall policy, creating a new one if necessary.
# If the parameter is sent with a 0 value, the server will be created with all ports blocked.
firewall_policy_id: <ID>
# IP address ID
ip_id: <ID>
# Load balancer ID
load_balancer_id: <ID>
# Monitoring policy ID
monitoring_policy_id: <ID>
Set deploy
to False if Salt should not be installed on the node.
my-oneandone-profile:
deploy: False
Create an SSH key
sudo salt-cloud -f create_ssh_key my-oneandone-config name='SaltTest' description='SaltTestDescription'
Create a block storage
sudo salt-cloud -f create_block_storage my-oneandone-config name='SaltTest2'
description='SaltTestDescription' size=50 datacenter_id='5091F6D8CBFEF9C26ACE957C652D5D49'
Return a list of the server appliances that are on the provider
List available locations/datacenters for 1&1
Return a dict of all available VM sizes on the cloud provider with relevant data.
Create a single VM from a data dict
Create a block storage
Create an ssh key
destroy a server by name
name -- name given to the server
call -- call value in this case is 'action'
array of booleans , true if successfully stopped and true if successfully removed
CLI Example:
salt-cloud -d vm_name
Return the first configured instance.
Return a conn object for the passed VM data
Warn if dependencies are not met.
Return the image object to use
Check SSH private key file and return absolute path if exists.
Return a node for the named VM
Return the VM's size object
Return the wait_for_timeout for resource provisioning.
Return a list of VMs that are on the provider
Return a list of the VMs that are on the provider, with all fields
Return a list of the VMs that are on the provider, with select fields
Load the public key file if exists.
reboot a server by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a reboot vm_name
Return the script deployment object
Show the details from the provider concerning an instance
start a server by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a start vm_name
stop a server by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
CLI Example:
salt-cloud -a stop vm_name