From 4d4528fea07fcbf2873e7a46b47b812ca865d01a Mon Sep 17 00:00:00 2001 From: Gorka Benguria Elguezabal <gorka.benguria@tecnalia.com> Date: Mon, 24 May 2021 00:41:50 +0200 Subject: [PATCH] adds host to the etc/hosts --- Vagrantfile | 2 +- .../install.sh => addHostsToEtcHosts.sh} | 1 - ansible/hosts-from-inventory/site.yaml | 13 ------------- ansible/install.sh | 13 ------------- 4 files changed, 1 insertion(+), 28 deletions(-) rename ansible/{kubernetes/install.sh => addHostsToEtcHosts.sh} (99%) delete mode 100755 ansible/install.sh diff --git a/Vagrantfile b/Vagrantfile index 0edbede..50c0178 100755 --- a/Vagrantfile +++ b/Vagrantfile @@ -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| diff --git a/ansible/kubernetes/install.sh b/ansible/addHostsToEtcHosts.sh similarity index 99% rename from ansible/kubernetes/install.sh rename to ansible/addHostsToEtcHosts.sh index 84dd819..5cdc525 100755 --- a/ansible/kubernetes/install.sh +++ b/ansible/addHostsToEtcHosts.sh @@ -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 diff --git a/ansible/hosts-from-inventory/site.yaml b/ansible/hosts-from-inventory/site.yaml index 623fd67..d848069 100755 --- a/ansible/hosts-from-inventory/site.yaml +++ b/ansible/hosts-from-inventory/site.yaml @@ -1,17 +1,4 @@ - 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 diff --git a/ansible/install.sh b/ansible/install.sh deleted file mode 100755 index d33f58d..0000000 --- a/ansible/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/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 -- GitLab