GithubHelp home page GithubHelp logo

ansible-collections / community.hrobot Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 15.0 3.72 MB

Hetzner Robot Collection

Home Page: https://galaxy.ansible.com/ui/repo/published/community/hrobot/

License: GNU General Public License v3.0

Python 100.00%
ansible-collection hetzner hetzner-robot-api hacktoberfest

community.hrobot's Introduction

Community Hetzner Robot Collection

CI Codecov

This repository contains the community.hrobot Ansible Collection. The collection includes modules to work with Hetzner's Robot.

You can find documentation for the modules and plugins in this collection here.

Please note that this collection does not support Windows targets.

Tested with Ansible

Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, ansible-core 2.15, ansible-core 2.16, and ansible-core 2.17 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.

External requirements

A Hetzner Robot account.

Collection Documentation

Browsing the latest collection documentation will show docs for the latest version released in the Ansible package, not the latest version of the collection released on Galaxy.

Browsing the devel collection documentation shows docs for the latest version released on Galaxy.

We also separately publish latest commit collection documentation which shows docs for the latest commit in the main branch.

If you use the Ansible package and do not update collections independently, use latest. If you install or update this collection directly from Galaxy, use devel. If you are looking to contribute, use latest commit.

Included content

  • community.hrobot.failover_ip module
  • community.hrobot.failover_ip_info module
  • community.hrobot.firewall module
  • community.hrobot.firewall_info module
  • community.hrobot.robot inventory plugin

You can find documentation for the modules and plugins in this collection here.

Using this collection

Before using the General community collection, you need to install the collection with the ansible-galaxy CLI:

ansible-galaxy collection install community.hrobot

You can also include it in a requirements.yml file and install it via ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: community.hrobot

See Ansible Using collections for more details.

Contributing to this collection

If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured COLLECTIONS_PATH, and work on it there.

You can find more information in the developer guide for collections, and in the Ansible Community Guide.

Release notes

See the changelog.

More information

Licensing

This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.

See LICENSES/GPL-3.0-or-later.txt for the full text.

Parts of the collection are licensed under the BSD 2-Clause license.

All files have a machine readable SDPX-License-Identifier: comment denoting its respective license(s) or an equivalent entry in an accompanying .license file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in .reuse/dep5. This conforms to the REUSE specification.

community.hrobot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

community.hrobot's Issues

Failed to parse robot.yml "Invalid empty host name provided"

SUMMARY

Hello,

I am unable to parse my robot inventory file as discribed in the docs.
I always get an empty response.
Failed to parse /home/**/github_ansible/inventory/test.robot.yml with ansible_collections.community.hrobot.plugins.inventory.robot plugin: Invalid empty host name provided: None
When I try with curl:
curl -u user:password https://robot-ws.your-server.de/server
i get the disered result.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Inventory Plugin community.hrobot.robot

ANSIBLE VERSION
ansible --version
ansible [core 2.12.2]
  config file = /home/**/**/ansible.cfg
  configured module search path = ['/home/**/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/**/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 3.0.1
  libyaml = True

COLLECTION VERSION
ansible-galaxy collection list community.hrobot
# /home/**/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.hrobot 1.2.3  

# /usr/lib/python3/dist-packages/ansible_collections
Collection       Version
---------------- -------
community.hrobot 1.2.2  


ansible-galaxy collection verify community.hrobot 
Verifying 'community.hrobot:1.2.3'
CONFIGURATION
ANSIBLE_NOCOLOR(/home/**/github_ansible/ansible.cfg) = False
CALLBACKS_ENABLED(/home/**/github_ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_HOST_LIST(/home/**/github_ansible/ansible.cfg) = ['/home/**/github_ansible/inventory']
DEFAULT_REMOTE_USER(/home/**/github_ansible/ansible.cfg) = root
DEFAULT_VAULT_PASSWORD_FILE(/home/**/github_ansible/ansible.cfg) = /**************
INVENTORY_ENABLED(/home/**/github_ansible/ansible.cfg) = ['community.hrobot.robot']
OS / ENVIRONMENT

WSL Ubuntu 20.04

STEPS TO REPRODUCE

Make a inventory test.robot.yml

---
plugin: community.hrobot.robot
hetzner_password: ************
hetzner_user: ************
ansible-inventory -i test.robot.yml --list
EXPECTED RESULTS

Some kind of inventory

ACTUAL RESULTS
# shortend output with errors
[WARNING]:  * Failed to parse /home/**/github_ansible/inventory/test.robot.yml with ansible_collections.community.hrobot.plugins.inventory.robot plugin: Invalid empty host name provided: None
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/home/**/.ansible/collections/ansible_collections/community/hrobot/plugins/inventory/robot.py", line 130, in parse
    self.populate(servers)
  File "/home/**/.ansible/collections/ansible_collections/community/hrobot/plugins/inventory/robot.py", line 142, in populate
    self.inventory.add_host(server_name)
  File "/usr/lib/python3/dist-packages/ansible/inventory/data.py", line 232, in add_host
    raise AnsibleError("Invalid empty host name provided: %s" % host)
[WARNING]: Unable to parse /home/**/github_ansible/inventory/test.robot.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

Important information for collection maintainers

SUMMARY

Dear maintainers,

This is important for your collections!

  • In accordance with the Community decision, we have created the news-for-maintainers repository for announcements of changes impacting collection maintainers (see the examples) instead of Issue 45 that will be closed soon.

    • To keep yourself well-informed and, therefore, things in your collection working, please subscribe to the repository by using the Watch button in the upper right corner on the repository's home page.
    • If you do not want to get notifications about related discussions, please subscribe only to Issues.
    • Please read the brief guidelines on how the repository should be used.
    • Please avoid unnecessary discussions in issues, use the Discussions feature. Every comment posted will notify a lot of folks!
  • Also we would like to remind you about the Bullhorn contributor newsletter which has recently started to be released weekly. To learn what it looks like, see the past releases. Please subscribe and talk to the Community via Bullhorn!

  • Join us in #ansible-social (for news reporting & chat), #ansible-community (for discussing collection & maintainer topics), and other channels on Matrix/IRC.

  • Help the Community and the Steering Committee to make right decisions by taking part in discussing and voting on the Community Topics that impact the whole project and the collections in particular. Your opinion there will be much appreciated!

Thank you!

New version of Robot Firewall introduced breaking changes

SUMMARY

Hetzner introduced (without prior notification I might add) a breaking change to the robot firewall:

You now have to separately define an outgoing rule. Using the community.hrobot.firewall module results in an unaccessible server as the outgoing rules are left blank.

Secondly you can now refer to ipv4 / ipv6 or wildcard when defining an incoming / outgoing rule. If I read the API correctly https://robot.hetzner.com/doc/webservice/en.html#post-firewall-server-id you need to leave out protocol version in order to attein the wildcard. Again this is not supported msg: 'missing required arguments: ip_version found in rules -> input'

Third: you have the option called ** Filter IPv6 packets ** setting this is also not supported right now.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ommunity.hrobot.firewall

ANSIBLE VERSION
ansible [core 2.14.2]
  config file = /home/silviu/repos/setup-devops/ansible-playbooks/ansible.cfg
  configured module search path = ['/home/silviu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/silviu/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/silviu/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/silviu/.local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /home/xxx/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 6.3.0  

# /home/xxx/.local/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.3.0  
OS / ENVIRONMENT

Ubuntu 22.04 under wsl2

Handle storage boxes as full-fledged objects

SUMMARY

Ability to manage storage boxes

ISSUE TYPE
  • Feature Idea
    It would be nice to manage storage boxes with ansible
COMPONENT NAME
ADDITIONAL INFORMATION

I have some hetzer storage boxes but no server. It would be very nice to manage these things with ansible

It would be an implementaion of this hetzenr api.

I can help testing the thing and create and delete some storage boxes for short timeframes.

Ansible Contributor Summit. Tuesday, April 12, 2022.

Ansible Contributor Summit

We are happy to announce that the registration for the Ansible Contributor Summit is open!

Why
  • This is a great opportunity for interested people to meet, discuss related topics, share their stories and opinions, get the latest important updates and just to hang out together.

  • There will be different announcements & presentations by Community, Core, Cloud, Network, and other teams.

  • Current contributors will be happy to share their stories and experience with newcomers.

  • There will be links to interactive self-passed instruqt scenarios shared during the event that help newcomers learn different aspects of development.

Where/when

Online on Matrix and Youtube. Tuesday, April 12, 2022, 12:00 - 20:00 UTC.

How to join
  • Add the event to your calendar. Use the ical URL (for example, in Google Calendar "Add other calendars" > "Import from URL") instead of importing the .ics file so that any updates to the event will be reflected in your calendar.

  • Check out the Summit page:

    • Add you name to attendees.
    • Suggest summit topics that would be interesting to you to hear about.
    • Vote on and propose changes to topics suggested by others.
    • If you want to be a presenter, please contact the Ansible Community team via [email protected].

We are looking forward to seeing you!:)

hrobot.firewall: Request failed: 400 INVALID_INPUT (invalid input)

SUMMARY

Previous working firewall rules throws error: Request failed: 400 INVALID_INPUT (invalid input)

ISSUE TYPE
  • Bug Report
COMPONENT NAME

hrobot.firewall

ANSIBLE VERSION
ansible [core 2.15.5]
  config file = /Users/xxx/Projects/infrastructure/ansible/hrobot/ansible.cfg
  configured module search path = ['/Users/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/xxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.6 (main, Oct  2 2023, 13:45:54) [Clang 15.0.0 (clang-1500.0.40.1)] (/opt/homebrew/Cellar/ansible/8.5.0_1/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /Users/xxx/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.hrobot 1.8.1  

# /opt/homebrew/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible_collections
Collection       Version
---------------- -------
community.hrobot 1.8.1  
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE

Even dead simple firewall config throws error

- name: Configure hrobot firewall - ensure both ssh ports open
  community.hrobot.firewall:
    hetzner_user: ""
    hetzner_password: ""
    server_ip: "{{ ansible_host }}"
    state: present
    allowlist_hos: yes
    rules:
      input:
        - name: Allow ICMP protocol, so you can ping your server
          ip_version: ipv4
          protocol: icmp
          action: accept
      output:
        - name: Accept everything
          action: accept
  delegate_to: localhost
EXPECTED RESULTS
ACTUAL RESULTS

ssh-key setting for rescue mode gives errors

SUMMARY

Setting ssh-keys with community.hcloud.boot gives errors.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.hrobot.boot

ANSIBLE VERSION

pip-installed ansible 4.9.0 [core 2.11.6] and also for ansible 5.1.0 [core 2.12.1]

COLLECTION VERSION

1.2.1

CONFIGURATION
[defaults]
nocows = 1
stdout_callback = yaml

interpreter_python = auto_silent

library = /usr/share/ansible/library


retry_files_enabled = False
force_handlers = True


[ssh_connection]
pipelining = True
OS / ENVIRONMENT

Debian 11 amd64

STEPS TO REPRODUCE

with playbook:

- hosts: all
  remote_user: root
  gather_facts: false
  vars:
    hetzner_rescue_system_ipv6: "{{hetzner_ipv6_subnet|ansible.netcommon.ipmath(2)}}"
  tasks:

    - name: Add an SSH key
      local_action: community.hrobot.ssh_key
      args:
        hetzner_user: "{{hetzner_robot_api_username}}"
        hetzner_password: "{{hetzner_robot_api_password}}"
        state: present
        name: rescue
        public_key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"

    - name: List all SSH keys
      local_action: community.hrobot.ssh_key_info
      args:
        hetzner_user: "{{hetzner_robot_api_username}}"
        hetzner_password: "{{hetzner_robot_api_password}}"
      register: hrobot_ssh_key_info

    - name: Enable a rescue system (64bit Linux) for the next boot
      local_action: community.hrobot.boot
      args:
        server_number: "{{hetzner_server_number}}"
        hetzner_user: "{{hetzner_robot_api_username}}"
        hetzner_password: "{{hetzner_robot_api_password}}"
        rescue:
          os: linux
          authorized_keys: "{{ hrobot_ssh_key_info | json_query('ssh_keys[*].fingerprint') }}"
EXPECTED RESULTS
TASK [Enable a rescue system (64bit Linux) for the next boot] *********************************************************************************************************************************
ok: [s1 -> localhost] => changed=false 
  configuration_type: rescue
  password: xxx
changed: [s2 -> localhost] => changed=true 
  configuration_type: rescue
  password: xxx
changed: [s3 -> localhost] => changed=true 
  configuration_type: rescue
  password: xxx
ACTUAL RESULTS
TASK [Enable a rescue system (64bit Linux) for the next boot] *********************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: '<' not supported between instances of 'dict' and 'dict'
fatal: [s1 -> localhost]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/ka/.ansible/tmp/ansible-tmp-1640722028.009722-72412-92687179374263/AnsiballZ_boot.py", line 100, in <module>
        _ansiballz_main()
      File "/home/ka/.ansible/tmp/ansible-tmp-1640722028.009722-72412-92687179374263/AnsiballZ_boot.py", line 92, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/ka/.ansible/tmp/ansible-tmp-1640722028.009722-72412-92687179374263/AnsiballZ_boot.py", line 40, in invoke_module
        runpy.run_module(mod_name='ansible_collections.community.hrobot.plugins.modules.boot', init_globals=dict(_module_fqn='ansible_collections.community.hrobot.plugins.modules.boot', _modlib_path=modlib_path),
      File "/usr/lib/python3.9/runpy.py", line 210, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_community.hrobot.boot_payload_oaq5ye2n/ansible_community.hrobot.boot_payload.zip/ansible_collections/community/hrobot/plugins/modules/boot.py", line 430, in <module>
      File "/tmp/ansible_community.hrobot.boot_payload_oaq5ye2n/ansible_community.hrobot.boot_payload.zip/ansible_collections/community/hrobot/plugins/modules/boot.py", line 397, in main
    TypeError: '<' not supported between instances of 'dict' and 'dict'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1
fatal: [s2 -> localhost]: FAILED! => changed=false 
  msg: 'Request failed: 400 INVALID_INPUT (invalid input)'
fatal: [s3 -> localhost]: FAILED! => changed=false 
  msg: 'Request failed: 400 INVALID_INPUT (invalid input)'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.