{"id":14109687,"url":"https://github.com/nl2go/ansible-role-hetzner_installimage","last_synced_at":"2025-08-01T09:31:19.891Z","repository":{"id":51105164,"uuid":"220274918","full_name":"nl2go/ansible-role-hetzner_installimage","owner":"nl2go","description":"An Ansible Role that manages the OS image installation lifecycle of Hetzner servers using Hetzner Robot API.","archived":false,"fork":true,"pushed_at":"2021-05-23T18:53:23.000Z","size":132,"stargazers_count":20,"open_issues_count":3,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-14T10:15:23.991Z","etag":null,"topics":["ansible-role","hetzner","hetzner-robot-api","molecule"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/nl2go/hetzner_installimage","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"andrelohmann/ansible-role-hetzner_installimage","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nl2go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-07T15:58:44.000Z","updated_at":"2024-04-05T14:22:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nl2go/ansible-role-hetzner_installimage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nl2go%2Fansible-role-hetzner_installimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nl2go%2Fansible-role-hetzner_installimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nl2go%2Fansible-role-hetzner_installimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nl2go%2Fansible-role-hetzner_installimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nl2go","download_url":"https://codeload.github.com/nl2go/ansible-role-hetzner_installimage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228360201,"owners_count":17907873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible-role","hetzner","hetzner-robot-api","molecule"],"created_at":"2024-08-14T10:02:26.907Z","updated_at":"2024-12-05T19:30:43.502Z","avatar_url":"https://github.com/nl2go.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/nl2go/ansible-role-hetzner_installimage.svg?branch=master)](https://travis-ci.com/nl2go/ansible-role-hetzner_installimage)\n[![Codecov](https://img.shields.io/codecov/c/github/nl2go/ansible-role-hetzner_installimage)](https://codecov.io/gh/nl2go/ansible-role-hetzner_installimage)\n[![Ansible Galaxy](https://img.shields.io/badge/role-nl2go.hetzner_installimage-blue.svg)](https://galaxy.ansible.com/nl2go/hetzner_installimage/)\n[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/nl2go/ansible-role-hetzner_installimage)](https://galaxy.ansible.com/nl2go/hetzner_installimage)\n[![Ansible Galaxy Downloads](https://img.shields.io/ansible/role/d/44642.svg?color=blue)](https://galaxy.ansible.com/nl2go/hetzner_installimage/)\n\n# Ansible Role: Hetzner Installimage\n\nAn Ansible Role that manages the OS image installation lifecycle of [Hetzner servers](https://robot.your-server.de/server) using [Hetzner Robot API](https://robot.your-server.de/doc/webservice/en.html#preface).\n\n## Prerequisites\n\n- Existing [Hetzner Online GmbH Account](https://accounts.hetzner.com).\n- Configured [Hetzner Robot Webservice Account](https://robot.your-server.de/preferences).\n- Present SSH public key within [Hetzner Robot Key Management](https://robot.your-server.de/key/index).\n\n## Requirements\n\n| Name | Type | Version | Location |\n|---|---|---|---|\n| [ansible-filter](https://github.com/nl2go/ansible-filter) | Python package | 1.0.1 | Control node |\n\n## Config Variables\n\nThe following variables are suggested to be set within your ansible.cfg file\n\n    [defaults]\n    inventory = __YOUR_INVENTORY__\n    forks = 1\n    host_key_checking = false\n    private_key_file = __YOUR_HETZNER_PROVISIONING_KEY__\n    remote_user = root\n    roles_path = __PATH_TO_YOUR_GALAXY_ROLES__\n    [ssh_connection]\n    pipelining = True\n    scp_if_ssh = True\n    control_path = %(directory)s/%%h-%%r\n\n## Role Variables\n\nThe default set of variables defines the installimage and needs at best to be overwritten in group_vars/host_vars\n\n    hetzner_installimage_install_bootloader: grub\n    hetzner_installimage_install_hostname: your-server-name-here\n    hetzner_installimage_install_partitions:\n    - PART swap swap 32G\n    - PART /boot ext4 1G\n    - PART / ext4 all\n    hetzner_installimage_install_image: Ubuntu-1604-xenial-64-minimal.tar.gz\n\nThe role includes an autodetection of RAID values and setup. It will configure no RAID if one disk is found and\nRAID1 if 2 disks are found. The automatic RAID config can be overwritten with the following variables:\n\n    hetzner_installimage_install_drives:\n    - DRIVE1 /dev/sda\n    - DRIVE2 /dev/sdb\n    hetzner_installimage_install_raid:\n    - SWRAID 1\n    - SWRAIDLEVEL 0\n\nIt is also possible to just set `hetzner_installimage_install_raid` and let the autodetection find the respective disks.\n\nThe following mandatory variables need to be set in group_vars/host_vars or as extra vars to allow communication with \nthe webservice and deployment of the public key:\n\n    hetzner_installimage_webservice_username: username\n    hetzner_installimage_webservice_password: password\n\nThe following variable can be set optionally, to set the hostname within the hetzner robot\n\n    hetzner_installimage_server_name: __YOUR_SERVER_NAME__\n\nIf `hetzner_installimage_key_fingerprints`is set, only the selected keys will be installed during the image installation\nprocess from the [Hetzner Robot Key Management](https://robot.your-server.de/key/index). Otherwise all existing\nkeys will be provisioned.\n\n    hetzner_installimage_key_fingerprints:\n        - 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff\n\nWhen executing the playbook successfully the role creates a flag file on the respective server under \n`/etc/hetzner_installimage_provisioned.flag`. In the beginning of the role it checks if that file exists on the host and skips the further\ntasks. This behaviour can be avoided by using the variable `hetzner_installimage_ignore_provisioned_flag`:\n\n    --extra-vars \"{ hetzner_installimage_ignore_provisioned_flag: yes }\"\n    \nSetting this variable to `true` will skip checking the flag file.\n\n## Example Playbook\n\n    - hosts: hetzner\n      gather_facts: no\n      roles:\n         - nl2go.hetzner_installimage\n      vars:\n        hetzner_installimage_webservice_username: \"{{ hetzner_robot_api_user}}\"\n        hetzner_installimage_webservice_password: \"{{ hetzner_robot_api_pass}}\"\n        hetzner_installimage_server_name: \"{{ inventory_hostname }}\"\n\n**Important note:** The role must be executed with `gather_facts: no` as the hosts where you want to install a new \noperating system usually have no ssh access configured and `gather_facts` will directly try to access the host. \n\nSee more examples in the playbooks of the different test scenarios inside the test folder.\n\nThe role will ask for a confirmation from the user to wipe all data for all hosts in the play. This can be overwritten\nby using the variable `hetzner_installimage_skip_confirmation` set to `yes`.\n\nAn example for the extra vars would look like this:\n\n    --extra-vars \"{ hetzner_installimage_skip_confirmation : yes }\"\n \n## Installation Steps\n\n  * Install a new machine\n    1. Enter your hetzner robot (robot.your-server.de)\n    2. Order a new server\n    3. Select your operating system\n    4. Select your provisioning key\n    5. Run the hetzner_installimage role\n  * Install an existing machine\n    1. Add your provisioning key to hetzner robot via robot.your-server.de\n    2. Run the hetzner_installimage role\n  * Install an already provisioned machine\n    1. Enter the machine\n    2. Delete /etc/hetzner_installimage_provisioned.flag or set \n    3. Run the hetzner_installimage role\n\nIf you are sure, you will not accidentally purge a running machine which is already in use, you can directly run the \nrole with the extra variable `hetzner_installimage_ignore_provisioned_flag`:\n\n    --extra-vars \"{ hetzner_installimage_ignore_provisioned_flag: yes }\"\n\nThis way the role will not check the machine for an existing `/etc/hetzner_installimage_provisioned.flag` file but will also not prevent the machine from \nbeing purged accidentally!\n\n## Available images\n\nThe OS images are located in the folder `/root/.oldroot/nfs/images/` inside the rescue system. The\nfollowing images are available at 25 Mar 2020:\n\n* Archlinux-2017-64-minimal.tar.gz\n* archlinux-latest-64-minimal.tar.gz\n* CentOS-76-64-minimal.tar.gz\n* CentOS-77-64-minimal.tar.gz\n* CentOS-80-64-minimal.tar.gz\n* CentOS-81-64-minimal.tar.gz\n* CoreOS-1298-64-production.bin.bz2\n* Debian-103-buster-64-LAMP.tar.gz\n* Debian-103-buster-64-minimal.tar.gz\n* Debian-811-jessie-64-minimal.tar.gz\n* Debian-911-stretch-64-minimal.tar.gz\n* Debian-912-stretch-64-minimal.tar.gz\n* Ubuntu-1604-xenial-64-minimal-no-hwe.tar.gz\n* Ubuntu-1604-xenial-64-minimal.tar.gz\n* Ubuntu-1804-bionic-64-minimal.tar.gz\n* Ubuntu-1804-bionic-64-nextcloud.tar.gz\n* Ubuntu-1910-eoan-64-minimal.tar.gz\n\nOlder images are located in the `/root/.oldroot/nfs/images.old/` inside the rescue system. The role\nwill check if an image exists in the folder with the current images first and afterwards check if\nan image exists in the folder with the older images and use it from the place where it was found first.\nThis way it is possible to keep the operating system consistent amongst hosts even if the latest image\nof an operating system is updated at some point.\n\nIf none of these images work for you it is possible to use a custom image by leveraging\nthe `hetzner_installimage_custom_image_url` variable. The image will be downloaded from\nthe given url and used during the installation process.\n\n## Maintainers\n\n- [dirkaholic](https://github.com/dirkaholic)\n- [build-failure](https://github.com/build-failure)\n\n## License\n\nSee the [LICENSE.md](LICENSE.md) file for details\n\n## Author Information\n\nThis role was initially created by/forked from [andrelohmann](https://github.com/andrelohmann).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnl2go%2Fansible-role-hetzner_installimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnl2go%2Fansible-role-hetzner_installimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnl2go%2Fansible-role-hetzner_installimage/lists"}