Created
June 13, 2013 17:07
-
-
Save ScottSturdivant/5775443 to your computer and use it in GitHub Desktop.
setting hostname via ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Set the hostname in rc.conf | |
lineinfile: dest=/etc/rc.conf regexp="^hostname" line='hostname="{{ hostname }}"' | |
register: hostname | |
- name: Set the hostname | |
shell: hostname {{ hostname }} | |
when: hostname.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK: [Set the hostname in rc.conf] ******************************************* | |
changed: [admin] => {"changed": true, "item": "", "msg": "line replaced"} | |
TASK: [Set the hostname] ****************************************************** | |
failed: [admin] => {"changed": true, "cmd": "hostname {u'msg': u'line replaced', 'item': '', u'changed': True, 'invocation': {'module_name': 'lineinfile', 'module_args': u'dest=/etc/rc.conf regexp=\"^hostname\" line=\\'hostname=\"foobar.network.local\"\\''}} ", "delta": "0:00:00.001940", "end": "2013-06-13 10:02:25.053085", "item": "", "rc": 2, "start": "2013-06-13 10:02:25.051145"} | |
stderr: Syntax error: Unterminated quoted string | |
FATAL: all hosts have already failed -- aborting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment