Commit 194d5010 by John Jarvis

adding play to set the hostname to the deploy host

parent d7b11536
# This is a utility play to set a hostname
# on a server
- name: Set hostname
hosts: all
sudo: True
gather_facts: False
tasks:
- fail: msg="you must pass a hostname_fqdn var into this play"
when: hostname_fqdn is not defined
- name: Set hostname
hostname: name={{ hostname_fqdn.split('.')[0] }}
- name: Update /etc/hosts
lineinfile: >
dest=/etc/hosts
regexp="^127\.0\.1\.1"
line="127.0.1.1{{'\t'}}{{ hostname_fqdn.split('.')[0] }}{{'\t'}}{{ hostname_fqdn }}{{'\t'}}localhost"
state=present
......@@ -179,4 +179,7 @@ fi
# deploy the edx_ansible role
ansible-playbook edx_ansible.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu
# set the hostname
ansible-playbook set_hostname.yml -i "${deploy_host}," -e hostname_fqdn=${deploy_host} --user ubuntu
rm -f "$extra_vars_file"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment