ansible-collections / hetzner.hcloud

A collection to manage resources on Hetzner Cloud
https://galaxy.ansible.com/ui/repo/published/hetzner/hcloud
GNU General Public License v3.0
105 stars 37 forks source link

create server with protection #135

Closed 78wesley closed 1 year ago

78wesley commented 2 years ago
SUMMARY

When I create a new server and add delete_protection or rebuild_protection I get the error. fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (hcloud_server) module: delete_protection, rebuild_protection Supported parameters include: api_token, backups, datacenter, endpoint, force_upgrade, id, image, labels, location, name, rescue_mode, server_type, ssh_keys, state, upgrade_disk, user_data, volumes"}

ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/sysadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
COLLECTION VERSION
ansible-galaxy collection list x, doesn't work invalid choice: 'list' is the error.
CONFIGURATION
OS / ENVIRONMENT

NAME="Ubuntu" VERSION="20.04.4 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.4 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal

STEPS TO REPRODUCE
- name: create server in Development project at the datacenter location Nuremberg
      hcloud_server:
        api_token: "{{ hcloud_token }}"
        backups: no
        datacenter: nbg1-dc3
        name: "{{ server_name }}"
        endpoint: https://api.hetzner.cloud/v1
        server_type: cx21
        image: debian-10
        state: present
        labels:
          3CX: 3CX
          SSH: SSH
        delete_protection: true
        rebuild_protection: true
        ssh_keys:
          - development
      register: server
EXPECTED RESULTS

It needs to enable protection for the options delete and rebuild. When the server is created.

ACTUAL RESULTS
    "msg": "Unsupported parameters for (hcloud_server) module: delete_protection, rebuild_protection Supported parameters include: api_token, backups, datacenter, endpoint, force_upgrade, id, image, labels, location, name, rescue_mode, server_type, ssh_keys, state, upgrade_disk, user_data, volumes"
resmo commented 2 years ago

ansible 2.9 is way too old, does not include that: see https://docs.ansible.com/ansible/2.9/modules/hcloud_server_module.html

Please update to a more recent ansible version or install the collection manually.

LKaemmerling commented 1 year ago

As resmo already wrote, please update to a recent ansible version or update the collection as it is not supported in the version you use. If you have further questions feel free to reopen this issue or create a new one.