Hey Toshio! Thanks for your reply.

Since these are production machines, I can only use 1.7.2 at the moment. 
However, I installed the newest ppa version (1.9.2) on a VM cluster to test.
The error stills pops up. The error happens when it tries running the first 
task from the second playbook. However, commenting that task out just makes 
the error pop up in the next task. So I believe it's already carrying it 
from the first playbook, after completing the "Check if new upstart job is 
needed" task. 

The LC and LANG settings are "en_US.UTF-8" in the remote box.

-vvvv doesn't give me much new info. Here's the compressed output when the 
error occurs:

*ok: [anakin] => {"changed": false, "gid": 0, "group": "root", "mode": 
"0644", "owner": "root", "path": "/etc/init/syslog-ng.conf", "size": 615, 
"state": "file", "uid": 0}*

*TASK: [syslog-client | debug var=upstart] ********************************
*<anakin> ESTABLISH CONNECTION FOR USER: *******
*ok: [anakin] => {*
*    "var": {*
*        "upstart_times": {*
*            "changed": false,*
*            "gid": 0,*
*            "group": "root",*
*            "invocation": {*
*                "module_args": "src=syslog-ng-upstart.conf.j2 
dest=/etc/init/syslog-ng.conf owner=root group=root mode=0644 backup=yes",*
*                "module_name": "template"*
*            },*
*            "mode": "0644",*
*            "owner": "root",*
*            "path": "/etc/init/syslog-ng.conf",*
*            "size": 615,*
*            "state": "file",*
*            "uid": 0*
*        }*
*    }*
*}*

*TASK: [syslog-client | Stop the syslog-ng service before upgrading to 
upstart] ****
*Traceback (most recent call last):*
*  File "/usr/bin/ansible-playbook", line 324, in <module>*
*    sys.exit(main(sys.argv[1:]))*
*  File "/usr/bin/ansible-playbook", line 264, in main*
*    pb.run()*
*  File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 
348, in run*
*    if not self._run_play(play):*
*  File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 
789, in _run_play*
*    if not self._run_task(play, task, False):*
*  File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 
497, in _run_task*
*    results = self._run_task_internal(task, include_failed=include_failed)*
*  File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 
439, in _run_task_internal*
*    results = runner.run()*
*  File "/usr/lib/pymodules/python2.7/ansible/runner/__init__.py", line 
1493, in run*
*    results = [ self._executor(h, None) for h in hosts ]*
*  File "/usr/lib/pymodules/python2.7/ansible/runner/__init__.py", line 
590, in _executor*
*    msg = str(ae)*
*UnicodeEncodeError: 'ascii' codec can't encode characters in position 
40-41: ordinal not in range(128)*

--------------

I noticed the error happens regardless of the variable.changed being true 
or false.

Let me know what other info you might need.

Thanks a lot for your help!





On Wednesday, September 2, 2015 at 2:36:49 PM UTC-5, tkuratomi wrote:
>
> There have been sporadic UnicodeErrors that crop up from time to time. 
> I've been trying squash them as they come up.  1.7.2 is pretty old so 
> it won't have a lot of those fixes.  Are you able to test (at least 
> the failing task) on a newer version of ansible?  That would tell you 
> if the problem has been fixed already in a newer version. 
>
>  If it's still failing with the newer version, narrowing down the 
> problem would be helpful.  Is it occurring with the first task or the 
> second?  (I'm guessing the first).  What is the output from 
> ansible-playbook -vvvv ? What LC* and LANG settings do you have on the 
> remote box? 
>
> -Toshio 
>
> On Tue, Sep 1, 2015 at 1:03 PM, Eugene Romero <[email protected] 
> <javascript:>> wrote: 
> > Also, I tried changing "module_lang" to "en_US.UTF-8" in 
> > /etc/ansible/ansible.cfg, but it made no difference. I don't have a 
> > ansible.cfg in the playbook directory or .ansible.cfg in the home 
> directory. 
> > 
> > Ansible version is 1.7.2. 
> > 
> > Thanks! 
> > 
> > 
> > On Tuesday, September 1, 2015 at 2:58:35 PM UTC-5, Eugene Romero wrote: 
> >> 
> >> Hi all, 
> >> 
> >> Trying to run a playbook here, but getting a Unicode error. Here's what 
> >> I'm doing: 
> >> 
> >> The plays: 
> >> 
> >> main.yml: 
> >> 
> >> - name: Check if new upstart job is needed 
> >>   template: 
> >>     src=syslog-ng-upstart.conf.j2 
> >>     dest=/etc/init/syslog-ng.conf 
> >>     owner=root 
> >>     group=root 
> >>     mode=0644 
> >>     backup=yes 
> >>   register: upstart 
> >> 
> >> - name: Update upstart configuration 
> >>   include: upstart.yml 
> >>   when: upstart.changed 
> >> 
> >> ------------------------ 
> >> 
> >> 
> >> upstart.yml: 
> >> 
> >> - name: Stop the syslog-ng service before upgrading to upstart 
> >>   service: name=syslog-ng state=stopped 
> >> 
> >> - name: Move old sysV config 
> >>   command: mv /etc/init.d/syslog-ng /etc/init.d/syslog-ng.oldconf 
> >>   ignore_errors: yes 
> >> 
> >> - name: Link the upstart-job script to the syslog-ng job 
> >>   file: 
> >>     src=/lib/init/upstart-job 
> >>     path=/etc/init.d/syslog-ng 
> >>     state=link 
> >> 
> >> - name: Reload initctl config 
> >>   command: sudo initctl reload-configuration 
> >> 
> >> - name: Change perms on lock folder 
> >>   file: 
> >>     path=/var/lib/syslog-ng/ 
> >>     owner=syslog 
> >>     group=syslog 
> >>     mode=0755 
> >>     state=directory 
> >> 
> >> - name: Restart syslog-ng service 
> >>   service: name=syslog-ng state=started 
> >> 
> >> ---------------------- 
> >> 
> >> Not sure if important, but the template file syslog-ng-upstart.conf.j2 
> is: 
> >> 
> >> start on runlevel [2345] 
> >> stop on runlevel [!2345] 
> >> 
> >> nice 0 
> >> 
> >> respawn 
> >> respawn limit 3 15 
> >> 
> >> normal exit 0 
> >> 
> >> console log 
> >> 
> >> # defaults 
> >> env OPT_ARGS='' 
> >> env SYSLOG_GID='syslog' 
> >> env SYSLOG_UID='syslog' 
> >> env THREADS_NUM=5 
> >> 
> >> script 
> >>         # load global defaults file 
> >>         if [ -f /etc/default/syslog-ng ]; then 
> >>                 . /etc/default/syslog-ng 
> >>         fi 
> >>         exec /usr/sbin/syslog-ng ${OPT_ARGS} --foreground 
> --process-mode 
> >> foreground --stderr --worker-threads "${THREADS_NUM}" --user 
> "${SYSLOG_UID}" 
> >> --group "${SYSLOG_GID}" 
> >> end script 
> >> 
> >> ------------------------------------- 
> >> 
> >> 
> >> When I run this job, it errors out with the following message (server 
> >> names edited out): 
> >> 
> >> GATHERING FACTS 
> >> *************************************************************** 
> >> ok: [******] 
> >> 
> >> TASK: [syslog-client | Check if new upstart job is needed] 
> >> ******************** 
> >> changed: [******] 
> >> 
> >> TASK: [syslog-client | Stop the syslog-ng service before upgrading to 
> >> upstart] *** 
> >> fatal: [******] => Traceback (most recent call last): 
> >>   File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
> line 
> >> 561, in _executor 
> >>     exec_rc = self._executor_internal(host, new_stdin) 
> >>   File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
> line 
> >> 666, in _executor_internal 
> >>     return self._executor_internal_inner(host, self.module_name, 
> >> self.module_args, inject, port, complex_args=complex_args) 
> >>   File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
> line 
> >> 756, in _executor_internal_inner 
> >>     if not utils.check_conditional(cond, self.basedir, inject, 
> >> fail_on_undefined=self.error_on_undefined_vars): 
> >>   File "/usr/lib/python2.7/dist-packages/ansible/utils/__init__.py", 
> line 
> >> 255, in check_conditional 
> >>     original = str(conditional).replace("jinja2_compare ","") 
> >> UnicodeEncodeError: 'ascii' codec can't encode characters in position 
> >> 15-16: ordinal not in range(128) 
> >> 
> >> 
> >> FATAL: all hosts have already failed -- aborting 
> >> 
> >> 
> >> I have commented out the play that it errors out on, but the error just 
> >> happens on the next play. So I think the error might have to do with 
> the " 
> >> register: upstart" bit. But I can't figure out where the problem is. 
> >> 
> >> Thanks in advance for any help you can provide. 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/f788e29d-2c2a-40a1-91b9-cd55e85b41ea%40googlegroups.com.
>  
>
> > 
> > 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/d2714a48-89b9-42d8-bb94-0d21b286dcc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to