diff --git a/releasenotes/notes/relax-add-host-6eeccd37bfa414ce.yaml b/releasenotes/notes/relax-add-host-6eeccd37bfa414ce.yaml new file mode 100644 index 0000000000..3e66e8baf8 --- /dev/null +++ b/releasenotes/notes/relax-add-host-6eeccd37bfa414ce.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The restriction on using ``add_host`` in playbooks has been lifted. diff --git a/zuul/ansible/action/add_host.py b/zuul/ansible/action/add_host.py deleted file mode 100644 index d4b24aa555..0000000000 --- a/zuul/ansible/action/add_host.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2016 Red Hat, Inc. -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see . - -from zuul.ansible import paths -add_host = paths._import_ansible_action_plugin("add_host") - - -class ActionModule(add_host.ActionModule): - - def run(self, tmp=None, task_vars=None): - - return dict( - failed=True, - msg="Adding hosts to the inventory is prohibited") diff --git a/zuul/ansible/paths.py b/zuul/ansible/paths.py index dc624b945b..da031ea49c 100644 --- a/zuul/ansible/paths.py +++ b/zuul/ansible/paths.py @@ -176,10 +176,6 @@ def _is_localhost_task(task): # # localhost is special, since it's not in the inventory but instead is # added directly by ansible. - # - # The only way a user could supply a remote_addr with arbitrary ipv6 - # values is if they used add_host - which we don't let unprivileged code - # do. if (task._play_context.connection == 'local' or task._play_context.remote_addr == 'localhost'