Didn't realize 1.6 was gold, nice work. I'd pulled a day or so ago so the issue was still there then. I've tracked down what the issue is and have a patch. If its still there in the 1.6 branch I'll issue a patch.
thanks. Steve. On Thu, May 29, 2014 at 7:04 PM, Michael DeHaan <[email protected]> wrote: > Per the above, 1.6 is already released. If you have a bug in 1.6 please > file it and include the most minimal reproducer possible along with it. > > We will not be updating the 1.5.X series. > > > > > On Wed, May 28, 2014 at 5:33 PM, Stephen Gargan <[email protected]> > wrote: > >> Hi, >> >> I've finally had a chance to circle back around to verifying this is >> fixed and I noticed there was a bug in my gist. The all file should be in a >> group_vars folder. When I move the vars file there the failure returns. It >> seems as you suspected that the cluster_name from there is still being >> resolved too early, even with the fix for >> https://github.com/ansible/ansible/issues/6677 >> >> I've tracked it down to the following, _executor_internal is run in the >> runner module to execute the debug task, this calls on 564 >> >> module_vars = template.template(self.basedir, self.module_vars, >> module_vars_inject) >> >> and the module vars sent in for templating are only the vars extracted >> from the hosts file, not the combined set >> >> {'cluster_name': 'dev', 'inventory_hostname': '127.0.0.1', >> 'inventory_hostname_short': '127', 'ansible_python_interpreter': >> '/usr/local/bin/python', 'group_names': ['localhost']} >> >> So even though the task output shows the variables resolved and templated >> correctly using the combined set >> >> TASK: [debug msg="creating instance for cluster 'stage' '{'cluster_name': >> u'stage', 'hostname': 'blah_server1', 'ansible_groups': [u'stage', >> 'blah-servers']}' "] *** >> >> the execution is using the incomplete set and resolves to >> >> ok: [127.0.0.1] => { >> "item": "", >> "msg": "creating instance for cluster 'stage' '{'cluster_name': >> u'dev', 'hostname': 'blah_server1', 'ansible_groups': [u'dev', >> 'blah-servers']}' " >> } >> >> I'm going to see if I can't get it to pass the combined set in here, if I >> can I'll create a patch. Should I open a bug for this? >> >> regards, >> >> Steve. >> >> >> On Tue, Apr 15, 2014 at 11:53 PM, Michael DeHaan <[email protected]> >> wrote: >> >>> Excellent. Sounded a bit familiar :) >>> >>> >>> >>> >>> On Tue, Apr 15, 2014 at 6:44 PM, Garrett Plasky <[email protected]> >>> wrote: >>> >>>> This appears to be the same issue as >>>> https://github.com/ansible/ansible/issues/6677 which has ben fixed and >>>> should roll out with 1.6. >>>> >>>> On Wednesday, April 9, 2014 8:50:39 AM UTC-7, Stephen Gargan wrote: >>>>> >>>>> I'm seeing an issue with variable substitution between versions 1.5.3 >>>>> and 1.5.4. >>>>> >>>>> I have an include file that I use to create vm instances, >>>>> create_instance.yml and a playbook create_cluster.yml that I use to spin >>>>> up >>>>> all the instances for the cluster in one go. I have variables in my >>>>> group_vars that I use to configure the cluster e.g. the cluster_name and >>>>> when I spin up a new cluster I usually override these using the extras >>>>> vars >>>>> switch -e >>>>> >>>>> the create_cluster looks something like the following >>>>> >>>>> - hosts: localhost >>>>> connection: local >>>>> gather_facts: False >>>>> >>>>> tasks: >>>>> - {include: create_instance.yml, >>>>> tags: { >>>>> hostname: 'blah_server1', >>>>> ansible_groups: ["{{cluster_name}}", 'blah-servers'], >>>>> cluster_name: "{{cluster_name}}" >>>>> } >>>>> } >>>>> >>>>> create_instance.yml looks like >>>>> >>>>> - debug: msg="creating instance for cluster '{{ cluster_name }}' >>>>> '{{tags}}' " >>>>> >>>>> >>>>> group_vars/all >>>>> >>>>> cluster_name: dev >>>>> >>>>> For instance to spin up a new 'qa' cluster, I would issue >>>>> >>>>> ansible-playbook -i hosts create_cluster.yml -e cluster_name=qa >>>>> >>>>> Up until recently this would correctly override the cluster_name >>>>> variable as expected and produce the output below. (Specifically notice >>>>> how >>>>> the cluster_name is set to qa in the debug message) >>>>> >>>>> >>>>> PLAY [localhost] ****************************** >>>>> ******************************** >>>>> >>>>> TASK: [debug msg="creating instance for cluster 'qa' '{'cluster_name': >>>>> u'qa', 'hostname': 'blah_server1', 'ansible_groups': [u'qa', >>>>> 'blah-servers']}' "] *** >>>>> ok: [127.0.0.1] => { >>>>> "item": "", >>>>> "msg": "creating instance for cluster 'qa' '{'cluster_name': >>>>> u'qa', 'hostname': 'blah_server1', 'ansible_groups': [u'qa', >>>>> 'blah-servers']}' " >>>>> } >>>>> >>>>> Between 1.5.3 and 1.5.4 this behavior has changed, running it with >>>>> 1.5.4 produces. >>>>> >>>>> PLAY [localhost] ****************************** >>>>> ******************************** >>>>> >>>>> TASK: [debug msg="creating instance for cluster 'qa' '{'cluster_name': >>>>> u'qa', 'hostname': 'blah_server1', 'ansible_groups': [u'qa', >>>>> 'blah-servers']}' "] *** >>>>> ok: [127.0.0.1] => { >>>>> "item": "", >>>>> "msg": "creating instance for cluster 'qa' '{'cluster_name': >>>>> u'dev', 'hostname': 'blah_server1', 'ansible_groups': [u'dev', >>>>> 'blah-servers']}' " >>>>> } >>>>> >>>>> Notice how the variable is correctly substituted in the task listing, >>>>> but in the msg it is not overridden correctly at all and is still 'dev'. >>>>> This causes me to spin up instances into the wrong cluster and in other >>>>> playbooks that configure the cluster it applies changes to incorrect >>>>> machines. >>>>> >>>>> The changes between 1.5.3 and 1.5.4 are very limited, I think its >>>>> related to the split from SETUP_CACHE into VARS_CACHE, but I've not >>>>> tracked >>>>> it down yet. Anyone any insight into what might have happened? >>>>> >>>>> A gist of the files can be found here >>>>> >>>>> https://gist.github.com/10285167 >>>>> >>>>> Thanks, >>>>> >>>>> Steve. >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ansible Project" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> To post to this group, send email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/ansible-project/7277838a-d2ea-4dcd-8cfb-b8e03d1b61bc%40googlegroups.com >>>> <https://groups.google.com/d/msgid/ansible-project/7277838a-d2ea-4dcd-8cfb-b8e03d1b61bc%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Ansible Project" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/ansible-project/feCFkDW12Bo/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> >>> To post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwLcajmRuRFbiBxnpnZBi3dRLc7tcMx8y5HmNH-Hx_wRw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwLcajmRuRFbiBxnpnZBi3dRLc7tcMx8y5HmNH-Hx_wRw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAPe9%3DrAampjY3p7B9mTcUhJ1_vp5DES0P4K81f8nTXGk1SFA0g%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAPe9%3DrAampjY3p7B9mTcUhJ1_vp5DES0P4K81f8nTXGk1SFA0g%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/feCFkDW12Bo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyaa2x2mk1F5dupvdde5Ngr9AERcLOd1vrz-JAQ2mGyAA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyaa2x2mk1F5dupvdde5Ngr9AERcLOd1vrz-JAQ2mGyAA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPe9%3DrBtuQzw1cc5t%2Bj7d%3DtJE18eix0%3DFdvOySULLF_28yopvQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
