[ansible-project] Re: Unable to install python-minimal

2017-09-22 Thread Eric
However, it works when run manually:

ansible -i all.yml -m raw -a "apt install -y python-minimal"


On Friday, September 22, 2017 at 6:28:07 PM UTC-7, Eric wrote:
>
>
> I'm running an Ansible playbook to use the raw module, to install 
> python-minimal.
>
> The host is reachable.
> The host can be SSH'ed into as root.
>
> However, when running the playbook below, it fails.
>
> It gives the error:
>
> "module_stdout": "bash: warning: setlocale: LC_ALL: cannot change 
> locale (en_US.UTF-8)\r\n/bin/sh: 1: /usr/bin/python: not found\r\n",
>
>
> ---
> # https://gist.github.com/gwillem/4ba393dceb55e5ae276a87300f6b8e6f
> - hosts: all
>
>   tasks:
>   - name: install python 2
> raw: test -e /usr/bin/python || (apt -y update && apt install -y 
> python-minimal)
>
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6600a1e1-e360-4a6f-baa6-b2d7edc6200f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to install python-minimal

2017-09-22 Thread Eric

I'm running an Ansible playbook to use the raw module, to install 
python-minimal.

The host is reachable.
The host can be SSH'ed into as root.

However, when running the playbook below, it fails.

It gives the error:

"module_stdout": "bash: warning: setlocale: LC_ALL: cannot change 
locale (en_US.UTF-8)\r\n/bin/sh: 1: /usr/bin/python: not found\r\n",


---
# https://gist.github.com/gwillem/4ba393dceb55e5ae276a87300f6b8e6f
- hosts: all

  tasks:
  - name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y 
python-minimal)


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/511efad2-f78c-4917-99bb-d21d401199dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to signal an error from a Jinja expression?

2017-09-22 Thread Brian Coca
You cannot, but you can do this:

- command: 
  when: ansible_system is defined

- fail: msg=' you did not define ansible_system!"
  when: not ansible_system is defined


-
--
Brian Coca

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cXtJL%2BjV%2Bd54-goxrdRHkAD1QqyMi15eukgkkzwhC-ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] network_cli.py help

2017-09-22 Thread coolcps
Would anyone happen to know if the ansible_port variable is accessible 
anywhere in this module?  I'd like to make an update (for personal use) 
that differentiates an action based on port.  Thanks for any info!

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48e457f9-62e0-473f-8996-71df4b06c1f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ping is not working with ansible in max os

2017-09-22 Thread Ahmed Ali
it works fine,
really appreciate the fast reply

AHMALI-M-K035:ansible ahmali$ ansible localhost -m ping

localhost | SUCCESS => {

"changed": false,

"failed": false,

"ping": "pong"

}

AHMALI-M-K035:ansible ahmali$



On Fri, Sep 22, 2017 at 11:39 PM, Toshio Kuratomi 
wrote:

> Do you have nonascii characters in your path to the ssh binary?  If
> so, that would do it.  I can put in a fix for that for 2.4.1.
>
> On Fri, Sep 22, 2017 at 10:23 AM,   wrote:
> > Hi,
> > I have mac OS and already installed ansible, this is my first time to try
> > it. I started it by using a simple ping to the local host, but it is not
> > working please check below the output
> >
> >
> > AHMALI-M-K035:~ ahmali$ ansible localhost -m ping
> >
> > An exception occurred during task execution. To see the full traceback,
> use
> > -vvv. The error was: UnicodeDecodeError: 'ascii' codec can't decode byte
> > 0xe2 in position 0: ordinal not in range(128)
> >
> > localhost | FAILED! => {
> >
> > "failed": true,
> >
> > "msg": "Unexpected failure during module execution.",
> >
> > "stdout": ""
> >
> > }
> >
> > AHMALI-M-K035:~ ahmali$ ansible localhost -m ping -vvv
> >
> > ansible 2.4.0.0
> >
> >   config file = None
> >
> >   configured module search path =
> > [u'/Users/ahmali/.ansible/plugins/modules',
> > u'/usr/share/ansible/plugins/modules']
> >
> >   ansible python module location =
> > /Users/ahmali/anaconda/lib/python2.7/site-packages/ansible
> >
> >   executable location = /Users/ahmali/anaconda/bin/ansible
> >
> >   python version = 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2
> 2016,
> > 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
> > 2336.11.00)]
> >
> > No config file found; using defaults
> >
> > Parsed /etc/ansible/hosts inventory source with ini plugin
> >
> > META: ran handlers
> >
> > The full traceback is:
> >
> > Traceback (most recent call last):
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/executor/task_executor.py",
> > line 88, in run
> >
> > items = self._get_loop_items()
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/executor/task_executor.py",
> > line 181, in _get_loop_items
> >
> > self._play_context.update_vars(play_context_vars)
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/playbook/play_context.py",
> > line 667, in update_vars
> >
> > var_val = getattr(self, prop)
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/playbook/base.py",
> > line 58, in _generic_g_method
> >
> > return getattr(self, method)()
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/playbook/play_context.py",
> > line 686, in _get_attr_connection
> >
> > if not check_for_controlpersist(self.ssh_executable):
> >
> >   File
> > "/Users/ahmali/anaconda/lib/python2.7/site-packages/
> ansible/utils/ssh_functions.py",
> > line 38, in check_for_controlpersist
> >
> > cmd = subprocess.Popen([ssh_executable, '-o', 'ControlPersist'],
> > stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> >
> >   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 711,
> in
> > __init__
> >
> > errread, errwrite)
> >
> >   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 1343,
> in
> > _execute_child
> >
> > raise child_exception
> >
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0:
> > ordinal not in range(128)
> >
> >
> > localhost | FAILED! => {
> >
> > "failed": true,
> >
> > "msg": "Unexpected failure during module execution.",
> >
> > "stdout": ""
> >
> > }
> >
> > AHMALI-M-K035:~ ahmali$
> >
> > --
> > 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 ansible-project+unsubscr...@googlegroups.com.
> > To post to this group, send email to ansible-project@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/ansible-project/
> de08ea00-7978-4da6-9b6d-d3e54bda80bf%40googlegroups.com.
> > 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/inZcQamnqkk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAPrnkaQmonNr5shZgiqg8XNQMxL7d
> 31Q2kzYm2UHDEGOuvkp7A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received 

Re: [ansible-project] ping is not working with ansible in max os

2017-09-22 Thread Toshio Kuratomi
Please give this PR a try to see if it solves the issue for you:
https://github.com/ansible/ansible/pull/30779

On Fri, Sep 22, 2017 at 1:39 PM, Toshio Kuratomi  wrote:
> Do you have nonascii characters in your path to the ssh binary?  If
> so, that would do it.  I can put in a fix for that for 2.4.1.
>
> On Fri, Sep 22, 2017 at 10:23 AM,   wrote:
>> Hi,
>> I have mac OS and already installed ansible, this is my first time to try
>> it. I started it by using a simple ping to the local host, but it is not
>> working please check below the output
>>
>>
>> AHMALI-M-K035:~ ahmali$ ansible localhost -m ping
>>
>> An exception occurred during task execution. To see the full traceback, use
>> -vvv. The error was: UnicodeDecodeError: 'ascii' codec can't decode byte
>> 0xe2 in position 0: ordinal not in range(128)
>>
>> localhost | FAILED! => {
>>
>> "failed": true,
>>
>> "msg": "Unexpected failure during module execution.",
>>
>> "stdout": ""
>>
>> }
>>
>> AHMALI-M-K035:~ ahmali$ ansible localhost -m ping -vvv
>>
>> ansible 2.4.0.0
>>
>>   config file = None
>>
>>   configured module search path =
>> [u'/Users/ahmali/.ansible/plugins/modules',
>> u'/usr/share/ansible/plugins/modules']
>>
>>   ansible python module location =
>> /Users/ahmali/anaconda/lib/python2.7/site-packages/ansible
>>
>>   executable location = /Users/ahmali/anaconda/bin/ansible
>>
>>   python version = 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016,
>> 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
>> 2336.11.00)]
>>
>> No config file found; using defaults
>>
>> Parsed /etc/ansible/hosts inventory source with ini plugin
>>
>> META: ran handlers
>>
>> The full traceback is:
>>
>> Traceback (most recent call last):
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
>> line 88, in run
>>
>> items = self._get_loop_items()
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
>> line 181, in _get_loop_items
>>
>> self._play_context.update_vars(play_context_vars)
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
>> line 667, in update_vars
>>
>> var_val = getattr(self, prop)
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/base.py",
>> line 58, in _generic_g_method
>>
>> return getattr(self, method)()
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
>> line 686, in _get_attr_connection
>>
>> if not check_for_controlpersist(self.ssh_executable):
>>
>>   File
>> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/utils/ssh_functions.py",
>> line 38, in check_for_controlpersist
>>
>> cmd = subprocess.Popen([ssh_executable, '-o', 'ControlPersist'],
>> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>
>>   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 711, in
>> __init__
>>
>> errread, errwrite)
>>
>>   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 1343, in
>> _execute_child
>>
>> raise child_exception
>>
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0:
>> ordinal not in range(128)
>>
>>
>> localhost | FAILED! => {
>>
>> "failed": true,
>>
>> "msg": "Unexpected failure during module execution.",
>>
>> "stdout": ""
>>
>> }
>>
>> AHMALI-M-K035:~ ahmali$
>>
>> --
>> 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 ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/de08ea00-7978-4da6-9b6d-d3e54bda80bf%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPrnkaTcH_v%3DsE5L-6x9owc%2B3Pw271A65L%3D95b_n1BHdfr-SQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ping is not working with ansible in max os

2017-09-22 Thread Toshio Kuratomi
Do you have nonascii characters in your path to the ssh binary?  If
so, that would do it.  I can put in a fix for that for 2.4.1.

On Fri, Sep 22, 2017 at 10:23 AM,   wrote:
> Hi,
> I have mac OS and already installed ansible, this is my first time to try
> it. I started it by using a simple ping to the local host, but it is not
> working please check below the output
>
>
> AHMALI-M-K035:~ ahmali$ ansible localhost -m ping
>
> An exception occurred during task execution. To see the full traceback, use
> -vvv. The error was: UnicodeDecodeError: 'ascii' codec can't decode byte
> 0xe2 in position 0: ordinal not in range(128)
>
> localhost | FAILED! => {
>
> "failed": true,
>
> "msg": "Unexpected failure during module execution.",
>
> "stdout": ""
>
> }
>
> AHMALI-M-K035:~ ahmali$ ansible localhost -m ping -vvv
>
> ansible 2.4.0.0
>
>   config file = None
>
>   configured module search path =
> [u'/Users/ahmali/.ansible/plugins/modules',
> u'/usr/share/ansible/plugins/modules']
>
>   ansible python module location =
> /Users/ahmali/anaconda/lib/python2.7/site-packages/ansible
>
>   executable location = /Users/ahmali/anaconda/bin/ansible
>
>   python version = 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016,
> 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
> 2336.11.00)]
>
> No config file found; using defaults
>
> Parsed /etc/ansible/hosts inventory source with ini plugin
>
> META: ran handlers
>
> The full traceback is:
>
> Traceback (most recent call last):
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
> line 88, in run
>
> items = self._get_loop_items()
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
> line 181, in _get_loop_items
>
> self._play_context.update_vars(play_context_vars)
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
> line 667, in update_vars
>
> var_val = getattr(self, prop)
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/base.py",
> line 58, in _generic_g_method
>
> return getattr(self, method)()
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
> line 686, in _get_attr_connection
>
> if not check_for_controlpersist(self.ssh_executable):
>
>   File
> "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/utils/ssh_functions.py",
> line 38, in check_for_controlpersist
>
> cmd = subprocess.Popen([ssh_executable, '-o', 'ControlPersist'],
> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>
>   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 711, in
> __init__
>
> errread, errwrite)
>
>   File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 1343, in
> _execute_child
>
> raise child_exception
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0:
> ordinal not in range(128)
>
>
> localhost | FAILED! => {
>
> "failed": true,
>
> "msg": "Unexpected failure during module execution.",
>
> "stdout": ""
>
> }
>
> AHMALI-M-K035:~ ahmali$
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/de08ea00-7978-4da6-9b6d-d3e54bda80bf%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPrnkaQmonNr5shZgiqg8XNQMxL7d31Q2kzYm2UHDEGOuvkp7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Template module. MODE all wrong when using loop

2017-09-22 Thread Toshio Kuratomi
let me explain this a little better

You want to set the mode to octal 0600  which is the same as decimal
420.  So either of these would be fine:

  mode: 0600
  mode: 420

Ansible's template module also accepts string versions of the mode.
The strings are similar to what chmod would accept on the commandline.
So this is fine:

  mode: "0600"

Since chmod accepts a string "600" as a synonym for the above, if
Ansible gets that string it will also accept it:
  mode: "600"

Now, for your second example, you aren't giving ansible any of the
above values.  Let me show you what's happening.

First, the mode is set in your data structure as 0600 octal.  Which is
420 decimal as Kai said.  Then the value is getting substituted into
the task parameters like this:
  mode: "{{ item.mode }}"

So you end up with:
  mode: "420"

This is the string, 420.  not the decimal number 420.  And that's why
Ansible sets the mode to the wrong value.

-Toshio


On Thu, Sep 21, 2017 at 11:17 AM, John Harmon  wrote:
> Actually, that brings up a follow-up question.   why doesn't it treat it
> that way in the first example, when I don't use a loop?
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/dbda728f-73ff-4665-80b3-45e0799b2cab%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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPrnkaQhk_sTwii65EesBPvmgyeGqvrerbN423LVVfL8cJiTUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Issue with 'when' conditional

2017-09-22 Thread Dave Florek
Hi,

I keep getting errors related to my 'when' conditionals in my following 
playbook:

---
- hosts: all

  become: yes

  vars_prompt:
   - name: "remove_user"
 prompt: "Type name of user to delete:"
 private: no
# when: remove_user != "root"

  tasks:

   - name: Create new user account
 command: "userdel {{ remove_user }}"
when: "{{remove_user}}" != "root"

Ansible prompts me that my not equals indicator needs to be in quotes but I 
know that's wrong. I'm trying to add a check to where the playbook won't 
execute if the root account is specified. Any ideas?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e16c9991-a005-4f51-8fc1-6376c356c146%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ping is not working with ansible in max os

2017-09-22 Thread ahmali2377
Hi, 
I have mac OS and already installed ansible, this is my first time to try 
it. I started it by using a simple ping to the local host, but it is not 
working please check below the output 


AHMALI-M-K035:~ ahmali$ ansible localhost -m ping

An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: UnicodeDecodeError: 'ascii' codec can't decode byte 
0xe2 in position 0: ordinal not in range(128)

localhost | FAILED! => {

"failed": true, 

"msg": "Unexpected failure during module execution.", 

"stdout": ""

}

AHMALI-M-K035:~ ahmali$ ansible localhost -m ping -vvv

ansible 2.4.0.0

  config file = None

  configured module search path = 
[u'/Users/ahmali/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']

  ansible python module location = 
/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible

  executable location = /Users/ahmali/anaconda/bin/ansible

  python version = 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 
17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 
2336.11.00)]

No config file found; using defaults

Parsed /etc/ansible/hosts inventory source with ini plugin

META: ran handlers

The full traceback is:

Traceback (most recent call last):

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
 
line 88, in run

items = self._get_loop_items()

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py",
 
line 181, in _get_loop_items

self._play_context.update_vars(play_context_vars)

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
 
line 667, in update_vars

var_val = getattr(self, prop)

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/base.py", 
line 58, in _generic_g_method

return getattr(self, method)()

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py",
 
line 686, in _get_attr_connection

if not check_for_controlpersist(self.ssh_executable):

  File 
"/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/utils/ssh_functions.py",
 
line 38, in check_for_controlpersist

cmd = subprocess.Popen([ssh_executable, '-o', 'ControlPersist'], 
stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 711, in 
__init__

errread, errwrite)

  File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 1343, in 
_execute_child

raise child_exception

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: 
ordinal not in range(128)


localhost | FAILED! => {

"failed": true, 

"msg": "Unexpected failure during module execution.", 

"stdout": ""

}

AHMALI-M-K035:~ ahmali$ 

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/de08ea00-7978-4da6-9b6d-d3e54bda80bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Targeting Windows & Linux Machines from One Role

2017-09-22 Thread Heather Luna
Thank you! :)

On Fri, Sep 22, 2017 at 7:40 AM, 'J Hawkesworth' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> I'd back this up I have win- roles and linux- roles
>
> Bear in mind you can run multiple plays in one playbook, targeting
> different host groups.  Also since a linux host isn't ever also a windows
> host you can probably run playbooks in parallel, even if they are
> installing the same 'thing' such as the splunk forwarder.
>
> Hope this helps,
>
> Jon
>
> On Thursday, September 21, 2017 at 11:09:05 PM UTC+1, Jordan Borean wrote:
>>
>> In your main.yml put in include_tasks: windows.yml when the host is
>> Windows and include_tasks: unix.yml when it is not. You can use the
>> gathered facts to do this or you can have a variable that can be set when
>> running on Windows by the end user.
>>
>> Personally I think you should still split the role into 2, Windows is
>> really not interoperable with the Unix side and they use their own modules.
>> You would get quite a large and messy role when trying to handle both and
>> it could become quite complex when implementing and documenting features
>> that one supports and the other doesn't. I had a lot of success doing this
>> previously where there would be a java role and I would create a win-java
>> role which tried to implement the same functionality where I could.
>>
> --
> 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/x9RCdzBOgAU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/28efd301-c3bc-4a1e-95a9-8fc7f07874f4%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
All my best,

Heather Luna
DjangoCon US Sponsorship Chair
P. 267-838-7076
@h34th3r329

*The DjangoCon conference is organized by DEFNA
, a non-profit 501(c)(3) organization, so
your sponsorship is tax-deductible. *

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CABOQ31zg9fSFN_3pJm6UtdfoP9QKMPTS3xHVWXx%2BnGAm%3D3fKfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Targeting Windows & Linux Machines from One Role

2017-09-22 Thread Heather Luna
Thank you! :)

On Thu, Sep 21, 2017 at 3:09 PM, Jordan Borean  wrote:

> In your main.yml put in include_tasks: windows.yml when the host is
> Windows and include_tasks: unix.yml when it is not. You can use the
> gathered facts to do this or you can have a variable that can be set when
> running on Windows by the end user.
>
> Personally I think you should still split the role into 2, Windows is
> really not interoperable with the Unix side and they use their own modules.
> You would get quite a large and messy role when trying to handle both and
> it could become quite complex when implementing and documenting features
> that one supports and the other doesn't. I had a lot of success doing this
> previously where there would be a java role and I would create a win-java
> role which tried to implement the same functionality where I could.
>
> --
> 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/x9RCdzBOgAU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/f776c1bc-3b75-4ce8-b7bc-c0b4571df329%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
All my best,

Heather Luna
DjangoCon US Sponsorship Chair
P. 267-838-7076
@h34th3r329

*The DjangoCon conference is organized by DEFNA
, a non-profit 501(c)(3) organization, so
your sponsorship is tax-deductible. *

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CABOQ31zMzz%2BtU9%3D16XXPLtRkETK4RytsVOFbR_8CnETZmAqREA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] list of variables in YAML inventory

2017-09-22 Thread Bundy Boy
Hi, 

I am running Ansible from a python script and I want to iterate over a 
dynamic list created in the python script. The inventory is also 
dynamically created in this script. The list is different for each host 
Ansible is connecting to. I don't want to put the list into the host_vars 
where I want to keep only static variables. So I tried to put these 
variables in my dynamically created yaml inventory for each host. This does 
not seem to work, ansible says the list is not defined. However if I put 
the list in the group, it is working: 

*this is not working*
ma:
  hosts:
maman1-lab:
  vars:
devicesids:
- d46798753
maman2-lab:
  vars:
devicesids:
- d46798752

*But this is working (but not what I want)*

ma:
  hosts:
maman1-lab:
maman2-lab:
  vars:
devicesids:
- d46798752
- d46798753


Is it possible to associate a list of vars to a single host and not to an 
entire group? 


thanks

Bundy

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8d5e5c85-9475-419d-bacd-016b370dfe4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] regexp help.....

2017-09-22 Thread John Harmon
Kai Stian Olstad, thank you!  You are right, that worked. 
I tried my previous one at https://regex101.com/ and selected Python, but I 
guess it isn't 100% the same.  I will have to keep that in mind.

On Thursday, September 21, 2017 at 11:53:37 PM UTC-6, Kai Stian Olstad 
wrote:
>
> On 22. sep. 2017 01:08, John Harmon wrote: 
> > This works under a regexp tester, but fails under ansible.  I don't know 
> > how to correct it. 
>
> You need to use a Python based one, since Ansible is using Python re. 
>
>
> > Basically, it finds the lines starting with passwd or group, looks in 
> the 
> > lines for sss, and appends if it isn't found. 
> > 
> > - name: Update nsswitch.conf 
> >replace: 
> >  path: /etc/nsswitch.conf 
> >  regexp: "{{item.regexp}}" 
> >  replace: "{{item.replace}}" 
> >with_items: 
> >  - {regexp: '^(?:passwd):\s+(?:(?!sss).)+$', replace: '\0 sss'} 
> >  - {regexp: '^(?:group):\s+(?:(?!sss).)+$', replace: '\0 sss'} 
>
> \0 is interpreted as octal in Python re. 
>
> Try this instead 
>
>- {regexp: '(^(?:passwd):\s+(?:(?!sss).)+$)', replace: '\1 sss'} 
>- {regexp: '(^(?:group):\s+(?:(?!sss).)+$)', replace: '\1 sss'} 
>
> I added a parenthesis around the whole expression and references that as 
> \1 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/789ca263-5331-4f4b-b447-6ea295539359%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] jenkins ansible integration

2017-09-22 Thread Sreekuttan Sree
hi ,
i wrote ansible playbook for deploying war file in tomcat server.Now i want
to  run the playbook jenkins.How can configure it in jenkins. i installed
plugins  but while running job in jenkins its showing password
authentification.


how can i reslove it.
it will be appreciated.

thanks

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAELaYEx-MY%2BOjULqMBbqzGurh%2B2VYGT30WTmYDRCagPoxB7-Rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] "Group a does not exist" when adding groups to an existing user

2017-09-22 Thread leam hall
I'm trying to add the long list of groups to the oracle user and getting 
"Group a does not exist." as a failure msg. Not trying to add an "a" group, 
and the groups I am adding exist on the host. Is there a way to get more 
detail on what is going on?

Thanks!

Leam

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c96f0324-c73d-4fb1-83f9-61b6b84e051c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to use lookup on the remote machine?

2017-09-22 Thread Cev Ing


Am Freitag, 22. September 2017 16:31:45 UTC+2 schrieb Brian Coca:
>
> You don't, only tasks execute on the remote, 'lookup' is a 'controller 
> side function'. You can fetch/slurp the remote file or need a module 
> that can query the information on the remote file. 
>
>
Thanks.

I just found the getent module. That works fine instead.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c935166a-2cd1-4e30-9498-cecd5afa241f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to use lookup on the remote machine?

2017-09-22 Thread Brian Coca
You don't, only tasks execute on the remote, 'lookup' is a 'controller
side function'. You can fetch/slurp the remote file or need a module
that can query the information on the remote file.


-- 
--
Brian Coca

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cE3Fqq_BRDX1t3eY0vxdrEH_iWrjmgxJxmEiuXYMpJzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to use lookup on the remote machine?

2017-09-22 Thread Cev Ing
I use the following lookup to read a password hash:

  vars:
get_password_hash: " file=/etc/shadow delimiter={{ ':' }} col=1"
  tasks:
   - set_fact:
password: "{{ lookup('csvfile', 'nobody' + get_password_hash) }}"

But this throws an permission error although I run it with "become".

   Permission denied: u'/etc/shadow'

It seems to me that the lookup is not done on the remote machine, but on 
the local machine.

How can I run the lookup on the remote machine?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d85cfee9-e467-4464-a1b2-d77d950e7281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to signal an error from a Jinja expression?

2017-09-22 Thread Cev Ing
I have the following task in a role:

  command: >-
passwd -
{%- if ansible_system == 'SunOS' %}N
{%- elif ansible_system == 'Linux' %}l
{%- else %}
{{ "Unknown OS"/0 }}
{%- endif -%}

How to throw an error for the unknown ansible_system from within the role?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2ec8360d-e6e8-4687-b7ca-499452bd4279%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using yum module to install/update to defined version of a package-X.

2017-09-22 Thread Rui Goncalves
Thanks Kai.

On Friday, September 22, 2017 at 8:30:56 AM UTC+1, Kai Stian Olstad wrote:
>
> On 21.09.2017 18:55, Rui Goncalves wrote: 
> > I'd like to install or update a package specifying  the major.minor 
> > version. I.e, upgrade only if there's a bugfix package available.  I've 
> > tried using state=*latest* and *present*, but does not work as I 
> > expected. 
> > 
> > Using:  yum: name=nginx-debuginfo-1.6* state=latest 
> >> Suffix "-1.6*" is ignored, and version nginx-debuginfo-1.10 (which is 
> >> the 
> > latest available version on the repo) gets installed. I want to remain 
> > on 
> > 1.6.* version. 
> > 
> > Using: yum: name=nginx-debuginfo-1.6* state=present 
> >> If the host already contains nginx-debuginfo-1.6.1 installed and 
> >> there's 
> > a new version nginx-debuginfo-1.6.2 available on the repo, the package 
> > is 
> > not updated. 
>
> As you have experienced yum doesn't support this, you should look into 
> yum versionlock. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4d25c5a2-dbb3-4081-81d6-6ecb1bbc5b4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using yum module to install/update to defined version of a package-X.

2017-09-22 Thread Kai Stian Olstad

On 21.09.2017 18:55, Rui Goncalves wrote:

I'd like to install or update a package specifying  the major.minor
version. I.e, upgrade only if there's a bugfix package available.  I've
tried using state=*latest* and *present*, but does not work as I 
expected.


Using:  yum: name=nginx-debuginfo-1.6* state=latest
Suffix "-1.6*" is ignored, and version nginx-debuginfo-1.10 (which is 
the
latest available version on the repo) gets installed. I want to remain 
on

1.6.* version.

Using: yum: name=nginx-debuginfo-1.6* state=present
If the host already contains nginx-debuginfo-1.6.1 installed and 
there's
a new version nginx-debuginfo-1.6.2 available on the repo, the package 
is

not updated.


As you have experienced yum doesn't support this, you should look into 
yum versionlock.



--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c6aba81139cf1ba32c1068605b6a0435%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] yum module localinstall many rpms from directory possible?

2017-09-22 Thread Kai Stian Olstad

On 22.09.2017 02:00, daddyocruzer wrote:

Success 

Some Learning Assumptions:
===

So, this section I think I kinda get - it sets up 'r' to iterate 
through

the 'patterns' matches found beneath 'paths'.


register: r  register the output of the find in the variable called r.
r can be anything, like result.

To see what the variable r contains you can use debug.

- debug: var=r

One of the returns is files, files is a list of all files find found.
Each list is a array with a lot of information about the file.

If you only want to show this list you can use debug

- debug: var=r.files



  - yum:
   name: "{{ r.files | map(attribute='path') | list }}"


As you can see if you run the debug above you'll see that each list item 
has many attributes, one of them is path.

Map filter gather all of them for each entry in the list r.files.

Map returns a object as you can see with

- debug: var="r.files | map(attribute='path')"

so we need to filter it to something useful, and since the yum module 
support list we make it a list.


- debug: var="r.files | map(attribute='path') | list"


Another use of debug is with msg.

- debug: msg="All files in a list - {{ r.files | map(attribute='path') | 
list }}"




This must iterate through each match and install it?Assumptions:

   - Install must be a default, since there's no sign of it.
   - map(attribute='path' expands to the absolute path of where the 
match

   is?
  -if so, why is path singlular here, and 'paths' plural is 
used

  above?
  -   how is all this done on a 'name' line?   because default yum
  behavior is install local...?
   - list iterates through matches registered to 'r' lets yum default
   install it?


I think the above answer all the questions.

--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b1201dde0aad77fc1652ee45261ed68b%40olstad.com.
For more options, visit https://groups.google.com/d/optout.