Skip to content

Instantly share code, notes, and snippets.

@rbanffy
Created April 12, 2017 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbanffy/c7cc91575a5b79c71809c1cf71994441 to your computer and use it in GitHub Desktop.
Save rbanffy/c7cc91575a5b79c71809c1cf71994441 to your computer and use it in GitHub Desktop.
Ansible playbook to rename your servers using nsaname (https://www.npmjs.com/package/nsaname)
---
- name: properly name servers
hosts: servers
become_method: sudo
vars:
source: 192.168.57.1
tasks:
- name: create hostname
local_action: command nsaname -h
register: nsaname
- name: set hostname
hostname: name={{ nsaname.stdout }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment