A quick question or to -- what version of Ansible are you trying this on? In your ansible.cfg, is this perhaps an upgrade that does not have "fail on undefined variables" turned on?
Most people have this on now, but not all. It's the default if you don't have an ansible.cfg and your version is new enough. On Mon, Jul 21, 2014 at 2:47 PM, Sean <[email protected]> wrote: > I tried to change one line in a file with lineinfile command, but it looks > like this command does not resolve variables. See my playbook snippet below > > #in my playbook, {{ kibana_doc_root }}, {{ kibana_version }}, > {{kibana_config_file}}, {{elasticsearch_URL}}, {{ elasticsearch_port }} > have been defined > > The following snippet can successfully change the file content in > config.js, but {{elasticsearch_URL}} is not resolved (i.e. the line shows > {{elasticsearch_URL}} as is): > > ----- Snippet 1 ------------- > - name: debug variables > debug: msg=" variable concatication = {{ kibana_doc_root }}/{{ > kibana_version }}/{{kibana_config_file}}" > > - name: Replace the URI of the ElasticSearch service in config.js on > Kibana server > lineinfile: > dest=/var/www/kibana/kibana-3.0.0milestone4/config.js > regexp="(elasticsearch.* \"http.*)$" > state=present > line="elasticsearch':' \" {{ elasticsearch_URL }}:{{ > elasticsearch_port }} \" " > -------------------- > > > > > > > The following snippet cause an error of "failed: [kibana] => {"failed": > true, "item": "", "rc": 257} > msg: Destination > {{kibana_doc_root}}/{{kibana_version}}/{{kibana_config_file}} does not > exist !" > > ----------------- Snippet 2 -------- > - name: debug variables > debug: msg=" variable concatication = {{ kibana_doc_root }}/{{ > kibana_version }}/{{kibana_config_file}}" > > - name: Replace the URI of the ElasticSearch service in config.js on > Kibana server > lineinfile: > dest="{{ kibana_doc_root }}/{{ kibana_version > }}/{{kibana_config_file}}" > regexp="(elasticsearch.* \"http.*)$" > state=present > line="elasticsearch':' \" {{ elasticsearch_URL }}:{{ > elasticsearch_port }} \" " > -------------------------------- > > > -- > 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/c05b0e63-ea8c-4e17-8f13-2968b068ec81%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/c05b0e63-ea8c-4e17-8f13-2968b068ec81%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 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/CA%2BnsWgzya292YaZpwtHZMv6%2B5-2g2O5Gy%2BWW_Ks263oVHVJQpw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
