Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostname: Add GNUCoreutilsStrategy and VoidHostname #54496

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@nilium
Copy link

nilium commented Mar 28, 2019

SUMMARY
  • Add a GNUCoreutilsStrategy to update the host's /etc/hostname file
    and then invoke the hostname command with the new hostname. This is
    mostly the same as the AlpineStrategy, except the hostname command
    line differs.

  • Add a VoidHostname implementation to support Void Linux's use of GNU
    coreutils.

This is done entirely to support Void Linux on managed nodes, though the
GNUCoreutilsStrategy likely has applications outside just Void.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

hostname

ADDITIONAL INFORMATION

This likely won't work on Ansible 2.7 -- I've only used this on the devel branch. This is because 2.7 and earlier use platform.linux_distribution to get the managed node's distribution, which will produce an empty string on Void and likely other unsupported distributions. Since devel / 2.8 doesn't use this anymore, it's now possible to implement this.

Before
$ ansible -b -m hostname -a name=new-hostname test-host

test-host | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "msg": "hostname module cannot be used on platform Linux (Void)"
}
After
$ ansible -b -m hostname -a name=new-hostname test-host

test-host | CHANGED => {
    "ansible_facts": {
        "ansible_domain": "",
        "ansible_fqdn": "new-hostname",
        "ansible_hostname": "new-hostname",
        "ansible_nodename": "new-hostname",
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "name": "new-hostname"
}
hostname: Add GNUCoreutilsStrategy and VoidHostname
- Add a GNUCoreutilsStrategy to update the host's /etc/hostname file
  and then invoke the hostname command with the new hostname. This is
  mostly the same as the AlpineStrategy, except the hostname command
  line differs.

- Add a VoidHostname implementation to support Void Linux's use of GNU
  coreutils.
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.