Open miskolc opened 7 years ago
Hello @miskolc,
Could you please run a pre_task
with the debug
module to print the contents of the erlang_packages_force
variable? It should be defined by the vars/main.yml
file, maybe something is overwriting it.
Thank you!
Hi @mtpereira,
I changed to this
- name: Erlang Installation
hosts: web
gather_facts: false
tags:
- erlang
pre_tasks:
- debug:
var: erlang_packages_force
roles:
- role: mtpereira.erlang
erlang_additional_packages:
- erlang-doc
- erlang-manpages
- erlang-mode
become: yes
Got this:
PLAY [Erlang Installation] *****************************************************
TASK [debug] *******************************************************************
ok: [local-web-2] => {
"erlang_packages_force": "VARIABLE IS NOT DEFINED!"
}
TASK [mtpereira.erlang : main - assert that required variables are defined] ****
fatal: [local-web-2]: FAILED! => {
"assertion": "erlang_packages_force is defined",
"changed": false,
"evaluated_to": false,
"failed": true
}
@miskolc Could you please verify that the vars/main.yml
file is in place and has that variable defined? Thank you.
Yes it is and it has the same contents like the one on github, however the role was installed in /etc/ansible/roles
and not in the directory where the playbook using it exists.
Later Edit: Removed Gloval role and Installed it locally and I still get the same
TASK [debug] *******************************************************************
ok: [local-web-2] => {
"erlang_packages_force": "VARIABLE IS NOT DEFINED!"
}
TASK [mtpereira.erlang : main - assert that required variables are defined] ****
fatal: [local-web-2]: FAILED! => {
"assertion": "erlang_packages_force is defined",
"changed": false,
"evaluated_to": false,
"failed": true
}
So this doesn't seem to be the cause. Also note that the vars/main.yml
is located in the roles/mtpereira.erlang/vars/main.yml
Well, that should be okay, since it obviously can find the role, otherwise it wouldn't even run the task.
I'll need to replicate this issue. Can you please tell me more about your setup, i.e., Ansible version, operating system, any peculiarity of the setup, etc?
Thank you.
Manuel Tiago Pereira
On 27 Jan 2017 1:31 p.m., "Dragos" notifications@github.com wrote:
Yes it is and it has the same contents like the one on github, however the role was installed in /etc/ansible/roles and not in the directory where the playbook using it exists.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mtpereira/ansible-erlang/issues/5#issuecomment-275665481, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeJQIbRxop4iU1fVy6Q6YppbvYCU76kks5rWfGbgaJpZM4LvJHA .
$ ansible --version ansible 2.2.0.0 config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides
Local OS Ubuntu 15.10 Remote Machine is a Vagrant virtualbox VM hosting Ubuntu Xenial The Vagrant file looks like this
Vagrant.configure("2") do |config|
MAX_WEB = 3
(2..MAX_WEB).each do |machine_id|
machine_name = "web-#{machine_id}"
config.vm.define machine_name do |machine|
machine.vm.box = "xcoo/xenial64"
machine.vm.hostname = machine_name
machine.vm.network "private_network", ip: "192.168.33.#{20+machine_id}"
machine.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
# Only execute once the Ansible provisioner,
# when all the machines are up and ready.
if machine_id == MAX_WEB
machine.vm.provision :ansible do |ansible|
# Disable default limit to connect to all the machines
# ansible.limit = "all"
ansible.playbook = "webservers.yml"
end
end
end
end
end
Also note that the deployer user I use didn't came with the VM, I created it myself. The VM contains just the vagrant
user like most Vagrant Machines and a root user that can be access only after logging in as the vagrant user.
Hey @miskolc ,
So, I've been able to reproduce this with your particular setup but I could not understand what's happening. Furthermore, I've tried changing the current testing setup of this role to be more similar to yours (importing the role instead of importing the individual tasks and vars files) and it still worked fine.
I'm wondering if there could be anything on your VMs that is causing this, although that doesn't make much sense to me, since we're running Ansible from outside of them, with a local installation.
I've updated the role to change the way we're testing it locally with Vagrant, as well as on travis. Could you please try running these local tests with Vagrant on your machine?
Thank you.
I installed the role with
ansible-galaxy install mtpereira.erlang
Wrote this in my playbook
Run the playbook
ansible-playbook webservers.yml --tag=erlang
Got thisAny ideas why?