Skip to content
Snippets Groups Projects
Commit 4d4528fe authored by Benguria Elguezabal, Gorka's avatar Benguria Elguezabal, Gorka
Browse files

adds host to the etc/hosts

parent b7130ea6
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,7 @@ Vagrant.configure("2") do |config|
subconfig.vm.provision "shell", name: "Install ansible", path: File.expand_path('../scripts/ansible/install.sh', __FILE__), run: 'once'
subconfig.vm.provision "shell", name: "ansible", inline: "/bin/sh /kubernetes-vagrant/ansible/install.sh", run: 'never'
subconfig.vm.provision "shell", name: "addHostsToEtcHosts", inline: "/bin/sh /kubernetes-vagrant/ansible/addHostsToEtcHosts.sh", run: 'never', privileged: false
end
vms.nodes.each do |node_hash|
......
......@@ -9,5 +9,4 @@ SCRIPT_DIR=$(dirname "$0")
cd $SCRIPT_DIR
export ANSIBLE_CONFIG=$SCRIPT_DIR/ansible.cfg
ansible-playbook $SCRIPT_DIR/hosts-from-inventory/site.yaml
- hosts: all
pre_tasks:
- name: Print all available facts
debug:
var: groups['all']
- name: Print management facts
debug:
var: hostvars['management']['ip']
- name: Check inventory
debug:
msg: "{{ hostvars[item]['ip'] }} {{item}}"
when: hostvars[item]['ip'] is defined
with_items:
- "{{ groups['all'] }}"
tasks:
- name: Add the inventory into /etc/hosts
become: yes
......
#!/bin/bash
set -e
# check if docker-compose is available if it is installed exist
hash docker-compose > /dev/null 2>&1 && exit 0 || true
echo Provisioning ansible...
SCRIPT_DIR=$(dirname "$0")
cd $SCRIPT_DIR
export ANSIBLE_CONFIG=$SCRIPT_DIR/ansible.cfg
# ansible-playbook -u $user site.yaml
ansible-playbook site.yaml --extra-vars "$1"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment