[ansible-project] Re: Downgrading apt packages safely

2016-03-02 Thread Alexey Vazhnov
Your playbook gave me an error too:

fatal: [localhost]: FAILED! => {"cache_update_time": 0, "cache_updated": 
false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o 
\"Dpkg::Options::=--force-downgrade\"   install 'haproxy=1.4.24-2'' failed: 
E: There are problems and -y was used without --force-yes\n", "stderr": "E: 
There are problems and -y was used without --force-yes\n", "stdout": "Reading 
package lists...\nBuilding dependency tree...\nReading state 
information...\nSuggested packages:\n  vim-haproxy\nThe following packages 
will be DOWNGRADED:\n  haproxy\n0 upgraded, 0 newly installed, 1 
downgraded, 0 to remove and 0 not upgraded.\nNeed to get 453 kB of 
archives.\nAfter this operation, 403 kB disk space will be freed.\n", 
"stdout_lines": ["Reading package lists...", "Building dependency tree...", 
"Reading 
state information...", "Suggested packages:", "  vim-haproxy", "The 
following packages will be DOWNGRADED:", "  haproxy", "0 upgraded, 0 newly 
installed, 1 downgraded, 0 to remove and 0 not upgraded.", "Need to get 453 
kB of archives.", "After this operation, 403 kB disk space will be freed."]}

But I added parameter "force: yes" and package downgraded successfully.
Resulted playbook:

---
- hosts: all
  tasks:
- name: install haproxy
  apt:
name: haproxy=1.4.24-2
force: yes
dpkg_options: force-downgrade
  sudo: yes

I used Ansible v. 2.0.1.0 on Ubuntu 14.04 amd64. I tested with this command:
ansible-playbook -s --ask-sudo-pass -i inventory/testing/localhost 
--limit=localhost 
--connection=local downgrading.yml

On Wednesday, March 2, 2016 at 9:27:24 PM UTC+5, jan.w...@codilime.com 
wrote:
>
> Hello,
>
> in my ansible playbook I want to ensure a specific version of a package is 
> installed, even if that would mean downgrading it.  I know that I can 
> specify version together with package name, like this: haproxy=1.4.24-2.  
> However, this is not enough in case of downgrading: this playbook
>
> - hosts: all
>   tasks:
> - name: install haproxy
>   apt:
> name: haproxy=1.4.24-2
>   sudo: yes
>
> will fail if a newer version of haproxy is installed.  I know that I can 
> use "force" attribute, but that would also disable some useful security 
> checks - for example, with force=yes Ansible would install a package even 
> if it couldn't be authenticated.  Is there a better way?
>
> I thought that "dpkg_options" may help me, but this playbook also fails on 
> downgrade:
>
> - hosts: all
>   tasks:
> - name: install haproxy
>   apt:
> name: haproxy=1.4.24-2
> dpkg_options: force-downgrade
>   sudo: yes
>
> Is this a bug?
> Maybe I should approach this problem in an altogether different way?
>
> best,
> Jan
>

-- 
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/9bdc8673-9d80-4cb8-8564-8f2c1becada5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible docker module does not allow me to use bind mode :Z

2016-03-02 Thread ishan jain
Thanks chris. Can you please share the links to this documentation ?

Also, i was trying to find the Ansible version 2.1. Can you help me here 
also ?

On Tuesday, 1 March 2016 00:35:51 UTC+5:30, Chris Houseknecht wrote:
>
> What version of ansible are you running? 
>
> According to the doc strings in the docker.py module:
>
> volumes:
>
>   description:
>
> - List of volumes to mount within the container
>
> - 'Use docker CLI-style syntax: C(/host:/container[:mode])’
>
> - You can specify a read mode for the mount with either C(ro) or 
> C(rw). Starting at version 2.1, SELinux hosts can 
>
>   additionally use C(z) or C(Z) mount options to use a shared or 
> private label for the volume.
>
>
> If I'm understanding the above correctly, options z and Z became available 
> for SE Linux hosts in Ansible 2.1.
>
> Also, I wonder if the format of ` - /mydata/folder:/opt/mydata/:Z` might 
> be incorrect? I would remove the last '/', changing it to ` - 
> /mydata/folder:/opt/mydata:Z`
>
>
>
> --Chris
>
>
> On Monday, February 29, 2016 at 6:29:35 AM UTC-5, ishan jain wrote:
>>
>> When i try to run the following task:
>>
>> - name: start docker container
>>   docker:
>> name: container
>> image: img
>> state: started
>>expose:
>>   - 8301:8182
>>volumes:
>>   - /mydata/folder:/opt/mydata/:Z
>>
>>
>> Ansible poses an error - {"changed": false, "failed": true, "msg": "bind 
>> mode needs to either be \"ro\" or \"rw\""}
>>
>> I was facing a lot of issues with volumes earlier when i was using :ro 
>> (manual deployment) which went away after simply using :Z. Now ansible is 
>> not letting me use it and the same images are posing errors when starting. 
>> Can you please tell me why it is not allowed and how to come around this 
>> thing ?
>>
>

-- 
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/7f96b054-0a65-4ccb-8544-90af03c3f0fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Skip the hosts when one host is exectued task successfully

2016-03-02 Thread Balaji Sunku
My Playbook:
---
- hosts: web
  vars:
increaseCount: 0
  remote_user: root
  tasks:
  - name: Verifying HTTP endpoint
uri:
  url: "http://{{inventory_hostname}}:{{httpd_port}}/Test";
  method: PUT
  body: "{{ lookup('file',test.json') }}"
  status_code: 200
  body_format: json
  return_content: yes
register: http_verify_out
failed_when: http_verify_out.status != 200


My scenario:
I am using ansible 2.0.1
In playbook hosts: web will be having multiple hosts.
If one host is executed the task successfully i want to skip the other 
hosts to execute the tasks.

Is there away to achieve this ?. If yes please let me know the solution 

Thanks in advance :)

-- 
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/aaa363d2-473c-4839-985b-5558b656ebd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] cloudformation create_stack() got an unexpected keyword argument 'stack_policy_body'

2016-03-02 Thread John G
Hi,

I am getting this error on Ubuntu 14.04.4 LTS. Any idea what is causing it?

$ ansible-playbook go_cloud.yml  - 
Using /home/johng/Documents/ansible/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
Loaded callback unnamed of type old, v1.0
1 plays in go_cloud.yml

PLAY 
***

TASK [setup] 
***
ESTABLISH LOCAL CONNECTION FOR USER: johng
127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1456960430.23-151711803624276 `" && echo "` 
echo $HOME/.ansible/tmp/ansible-tmp-1456960430.23-151711803624276 `" )'
127.0.0.1 PUT /tmp/tmpt7aQZU TO /home/johng/.ansible/tmp/ansible-tmp-
1456960430.23-151711803624276/setup
127.0.0.1 EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python 
/home/johng/.ansible/tmp/ansible-tmp-1456960430.23-151711803624276/setup; 
rm -rf 
"/home/johng/.ansible/tmp/ansible-tmp-1456960430.23-151711803624276/" > 
/dev/null 2>&1'
ok: [localhost]

TASK [Push hello-app cloudformation stack] 
*
task path: /home/johng/Documents/ansible/ansible/go_cloud.yml:5
ESTABLISH LOCAL CONNECTION FOR USER: johng
127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1456960431.07-114836551388786 `" && echo "` 
echo $HOME/.ansible/tmp/ansible-tmp-1456960431.07-114836551388786 `" )'
127.0.0.1 PUT /tmp/tmp4Pac7s TO /home/johng/.ansible/tmp/ansible-tmp-
1456960431.07-114836551388786/cloudformation
127.0.0.1 EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python 
/home/johng/.ansible/tmp/ansible-tmp-1456960431.07-114836551388786/cloudformation;
 
rm -rf 
"/home/johng/.ansible/tmp/ansible-tmp-1456960431.07-114836551388786/" > 
/dev/null 2>&1'
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, 
"invocation": {"module_args": {"aws_access_key": "", 
"aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "disable_rollback": 
false, "ec2_url": null, "notification_arns": null, "profile": null, "region"
: "us-east-1", "security_token": null, "stack_name": "ittest7", 
"stack_policy": null, "state": "present", "tags": null, "template": 
"EC2InstanceWithSecurityGroupSample.template", "template_format": "json", 
"template_parameters": {"InstanceType": "t2.micro", "KeyName": 
"sysadmin-key"}, "template_url": null, "validate_certs": true}, 
"module_name": "cloudformation"}, "msg": "create_stack() got an unexpected 
keyword argument 'stack_policy_body'"}

msg: create_stack() got an unexpected keyword argument 'stack_policy_body'

NO MORE HOSTS LEFT 
*
to retry, use: --limit @go_cloud.retry

PLAY RECAP 
*
localhost  : ok=1changed=0unreachable=0failed=1



$ ansible --version
ansible 2.0.1.0
  config file = /home/johng/Documents/ansible/ansible/ansible.cfg
  configured module search path = /usr/share/ansible
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"


---
- hosts: localhost
  tasks:
- name: Push hello-app cloudformation stack
  cloudformation:
aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID')  }}"
aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY')  }}"
stack_name: "ittest7"
state: present
region: "us-east-1"
template: "EC2InstanceWithSecurityGroupSample.template"
template_parameters:
  InstanceType: "t2.micro"
  KeyName: "sysadmin-key"




Works OK on CentOS 7 with ansible 2.0.0.2.

$ ansible-playbook go_cloud.yml 
[WARNING]: log file at /var/log/ansible.log is not writeable, aborting

 [WARNING]: provided hosts list is empty, only localhost is available


PLAY 
***

TASK [setup] 
***
ok: [localhost]

TASK [Push hello-app cloudformation stack] 
*
ok: [localhost]

PLAY RECAP 
*
localhost  : ok=2changed=0unreachable=0failed=0 
  

$ ansible --version
[WARNING]: log file at /var/log/ansible.log is not writeable, aborting

ansible 2.0.0.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = /usr/share/ansible
$ cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 



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 v

Re: [ansible-project] delegate_to a whole group: is it sequential or parallel?

2016-03-02 Thread Florin Andrei
Makes sense, thanks. But is there a way to parallelize delegate_to somehow? 
All looping methods I'm aware of are based on with_ and that's, as you 
said, serial.


On Wednesday, March 2, 2016 at 3:50:21 PM UTC-8, Brian Coca wrote:
>
> delegate_to is not inherently parallel or serial, there is no 
> relationships with it and forks. Parallelism depends on the play and task, 
> with_ loops are currently ONLY serial, so if you delegate_to: "{{item}}" it 
> is serial in the loop, but it is parallel across the play hosts.
>
>
> --
> 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/e874c7fd-04b2-4593-9ed7-3ac9e87037ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] setting 'always_run' from a var

2016-03-02 Thread Mike Biancaniello
I have a task that I would like to conditionally run even in check_mode 
(actually I want to set it for an entire role, but I'm seeing the same 
behavior in regular tasks).


The idea is that this would NOT run the task:
ansible-playbook always_run.yml --check

And then to actually execute the task in check_mode:

ansible-playbook always_run.yml -e '{"runit":true}' --check


But that's not the behavior I'm seeing. The problem is that alwasy_run 
always evaluates to 'true'.

Playbook (I've tried a few different variations. The only one that properly 
evaluates always_run is always_run: false):

---
- name: Do cool stuff
  hosts: localhost
  connection: local
  gather_facts: no

  vars:
runit: false

  tasks:
  - name: show runit
debug: var=runit
  - name: show stuff
command: whoami
always_run: "runit == true"
#always_run: "{{runit|default(false)}}"
#always_run: "{{runit}}"
#always_run: runit
#always_run: false
register: me
  - name: show me
debug: var=me.stdout_lines



Actual Results:

mikeb@mikeb-laptop:~/ansible-test$ ansible-playbook always_run.yml --check

PLAY [Do cool stuff] 
***

TASK [show runit] 
**
ok: [localhost] => {
"runit": false
}

TASK [show stuff] 
**
changed: [localhost]

TASK [show me] 
*
ok: [localhost] => {
"me.stdout_lines": [
"mikeb"
]
}

PLAY RECAP 
*
localhost  : ok=5changed=2unreachable=0failed=0

   
Expected Results:

mikeb@mikeb-laptop:~/ansible-test$ ansible-playbook always_run.yml --check

PLAY [Do cool stuff] 
***

TASK [coolrole : show stuff from role] 
*
changed: [localhost]

TASK [show runit] 
**
ok: [localhost] => {
"runit": false
}

TASK [show stuff] 
**
skipping: [localhost]

TASK [show me] 
*
ok: [localhost] => {
"me.stdout_lines": "VARIABLE IS NOT DEFINED!"
}

PLAY RECAP 
*
localhost  : ok=4changed=1unreachable=0failed=0 
  



-- 
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/08a9df18-1be7-4596-ba35-ecce6c8d67bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] delegate_to a whole group: is it sequential or parallel?

2016-03-02 Thread Brian Coca
delegate_to is not inherently parallel or serial, there is no relationships
with it and forks. Parallelism depends on the play and task, with_ loops
are currently ONLY serial, so if you delegate_to: "{{item}}" it is serial
in the loop, but it is parallel across the play hosts.


--
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/CACVha7cSZ3Zk1d_63oEYabH6_kbOYhMmDn5228GNTJH2as3uDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: packages = p['package'].split(',')\r\nAttributeError:

2016-03-02 Thread Brian Coca
that is not a good key=val multiline, do one of these:

  apt:
   pkg: "{{ item }}"
   state: installed
   update_cache: yes

or
  apt:  |
pkg={{ item }}
state=installed
update_cache=yes

On Wed, Mar 2, 2016 at 10:25 AM, Joanna Delaporte  wrote:

> That looks okay, unless you are also running Ansible from the Github repo.
>
> Can you paste the full play here, including the variables that are being
> read into the play?
>
> Thanks!
> Joanna
>
> On Wednesday, March 2, 2016 at 2:34:34 AM UTC-6, hilali lui wrote:
>>
>> Thank yoou for your reponse  I found
>>
>> ahilali@ahilali-desktop:~$ python -c "import sys; print sys.path"
>> ['', '/usr/local/lib/python2.7/dist-packages/ansible-2.0.0.2-py2.7.egg',
>> '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7',
>> '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
>> '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
>> '/usr/local/lib/python2.7/dist-packages',
>> '/usr/lib/python2.7/dist-packages/PILcompat',
>> '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7',
>> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
>>
>>
>> Le mercredi 2 mars 2016 00:06:38 UTC+1, Joanna Delaporte a écrit :
>>>
>>> I just had a few weird attribute errors that were caused by having
>>> multiple installations of Ansible. I had a system install and I was trying
>>> to use a Github clone of Ansible.
>>>
>>> You can use the following command to see where your system Ansible
>>> locations might be (thanks to Matt Martz):
>>> $ python -c "import sys; print sys.path"
>>>
>>> On Tuesday, March 1, 2016 at 3:33:22 PM UTC-6, hilali lui wrote:

 Hello,


 When I use this:

 - name: Install {{ install_name }} required tools
   apt:  pkg={{ item }}
 state=installed
 update_cache=yes


 I found this error :

 failed: [192.168.8.123] => (item=[u'sudo', u'vim', u'tree', u'git',
 u'gcc', u'iotop', u'htop', u'build-essential', u'xfonts-base',
 u'xfonts-encodings', u'xfonts-75dpi', u'xfonts-utils', u'libfontenc1',
 u'libffi-dev', u'libssl-dev', u'libevent-dev', u'libgeos-dev',
 u'libldap2-dev', u'libsasl2-dev', u'libxfont1', u'libxml2', u'libxml2-dev',
 u'libxslt1.1', u'libxslt1-dev', u'libxslt-dev', u'node-clean-css',
 u'node-less']) => {"failed": true, "invocation": {"module_name": "apt"},
 "item": ["sudo", "vim", "tree", "git", "gcc", "iotop", "htop",
 "build-essential", "xfonts-base", "xfonts-encodings", "xfonts-75dpi",
 "xfonts-utils", "libfontenc1", "libffi-dev", "libssl-dev", "libevent-dev",
 "libgeos-dev", "libldap2-dev", "libsasl2-dev", "libxfont1", "libxml2",
 "libxml2-dev", "libxslt1.1", "libxslt1-dev", "libxslt-dev",
 "node-clean-css", "node-less"], "module_stderr": "OpenSSH_6.6.1, OpenSSL
 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data
 /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying
 options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3
 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version
 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0
 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3:
 mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive:
 done pid = 20859\r\ndebug3: mux_client_request_session: session request
 sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3:
 mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received
 exit status from master 0\r\nShared connection to 192.168.8.123
 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n
 File \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\",
 line 2407, in \r\nmain()\r\n  File
 \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", line
 448, in main\r\np'list' object has no attribute 'split'\r\n", "msg":
 "MODULE FAILURE", "parsed": false}

>>> --
> 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/14f4593b-69b5-414f-b552-adfa26f0f504%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
--
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-proje

Re: [ansible-project] Uri module uses CONNECT instead of GET when going through a proxy and fails

2016-03-02 Thread Benoit Tremblay
Thanks!

Benoit

-- 
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/fa925c6b-e7e5-4c6c-928f-e9847bdde680%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Python - ValueError: I/O operation on closed file

2016-03-02 Thread Slim Slam
Looks like this issue was fixed today:   
 https://github.com/ansible/ansible/pull/14755

On Tuesday, March 1, 2016 at 5:02:05 PM UTC-6, Slim Slam wrote:
>
> Looking at the code for the pause module:
>
> if seconds is not None:
># setup the alarm handler
>signal.signal(signal.SIGALRM, timeout_handler)
>signal.alarm(seconds)
># show the prompt
>display.display("Pausing for %d seconds" % seconds)
>display.display("(ctrl+C then 'C' = continue early, ctrl+C then 'A' = 
> abort)\r"),
> else:
>   display.display(prompt)
>
> Even if you only want pause to wait some amount of time, the module still 
> expects STDIN to be available after prompting for ctrl+C.
>
> So, this worked:
>
> $ nohup ansible-playbook -vv build.yml 0
> It keeps STDIN open but provides no input. 
>
> On Tuesday, March 1, 2016 at 8:09:37 AM UTC-6, Slim Slam wrote:
>>
>> I guess I don't even understand why the Ansible "pause" module would care 
>> about stdout.
>>
>> J
>>
>> On Monday, February 29, 2016 at 5:51:08 PM UTC-6, Slim Slam wrote:
>>>
>>> Ansible 2.0.1 
>>>
>>> When I ssh into a Linux server and run:
>>>
>>> $ ansible-playbook -vv build.yml
>>>
>>> it runs fine. 
>>>
>>> But if I ssh into the Linux server and run:
>>>
>>> $ nohup ansible-playbook -vv build.yml
>>>
>>> or
>>>
>>> $ ansible-playbook -vv build.yml > output &
>>>
>>> or
>>>
>>> $ nohup ansible-playbook -vv build.yml > nohup.out
>>>
>>> or
>>>
>>> $ nohup ansible-playbook -vv build.yml > nohup.out 2>&1 &
>>>
>>>
>>> it always fails on this task:
>>>
>>> - name: wait for something to happen
>>>   pause: seconds=15
>>>
>>> Like this:
>>>
>>> TASK [wait for something to happen] 
>>> **
>>> task path: /build.yml:94
>>> Pausing for 15 seconds
>>> (ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
>>> An exception occurred during task execution. The full traceback is:
>>> Traceback (most recent call last):
>>>   File "/usr/local/lib/python2.7/site-packages/ansible/executor/
>>> task_executor.py", line 120, in run
>>> res = self._execute()
>>>   File "/usr/local/lib/python2.7/site-packages/ansible/executor/
>>> task_executor.py", line 418, in _execute
>>> result = self._handler.run(task_vars=variables)
>>>   File "/usr/local/lib/python2.7/site-packages/ansible/plugins/action/
>>> pause.py", line 123, in run
>>> fd = self._connection._new_stdin.fileno()
>>> ValueError: I/O operation on closed file
>>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "Unexpected 
>>> failure during module execution.", "stdout": ""}
>>>
>>> I'm pretty sure it has something to do with STDOUT not being available 
>>> but I'm not sure of the workaround. Anyone
>>> have a suggestion?
>>>
>>> ===
>>>
>>>

-- 
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/beeb47c2-e452-49c1-8b09-bb48944fd33f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible_env is undefined

2016-03-02 Thread Ben Cohen
There are a lot of good reasons you might want to only change the search
path rather than "set" it.  And there are also reasons you might want to
have this mutated value for an environment variable be used only in the
context of a playbook run.

It would be very convenient to be able to _augment_ the environment
variables for a play (rather than only set) ...  Could ansible support
something like this maybe?

environment:
  PATH:"$PATH:/some/special/searchdir/for/this/play/"


The alternatives I can see are:
(1) repeat yourself a whole lot with environment declarations per task
(2) mutate the environment variable via the underlying shell environment
initialization system.
(3) fully specify the values for the mutated variable ...

The first option requires lots of repetition.  The second option spreads
the mutation requirements to other aspects of the system rather keeping
this changed behavior localized within the playbook execution context --
frequently you might not want this as you might be deliberately only using
some alternate search path during a particular play.  I'd say there is also
a fair amount of not cross-platform 'make-busy-work' to actually go through
the process of modifying the shell environment variables initialization
configuration in a persistent way...  Mutating shell environment
initialization this way will very probably hide/obscure a pretty meaningful
mutation behind someone's back rather than clearly declaring it up front as
part of the play's execution contract ...

Option 3 seems like the only approach that can work.  However it's not as
clean to me and requires manually managing the correct default system
search PATH values which are not necessarily the same across
systems/os/user accounts (etc).  Definitely introduces undesirable
consequences that are not possible to avoid ...

On Wed, Mar 2, 2016 at 10:52 AM, Ben Cohen  wrote:

> Thanks -- what's a good pattern to the PATH environment variable during a
> play?
>
> On Mon, Feb 29, 2016 at 7:42 PM, Brian Coca  wrote:
>
>> As per https://github.com/ansible/ansible/blob/devel/CHANGELOG.md
>>
>> "Fix to make implicit fact gathering task correctly inherit settings from
>> play, this might cause an error if settings environment on play depending
>> on 'ansible_env' which was previously ignored"
>>
>> On Mon, Feb 29, 2016 at 7:44 PM, Ben Cohen  wrote:
>>
>>> After upgrading ansible versions:
>>>
>>> ncohen@breathe ~/s/f/fn-ansible (master)> ansible --version
>>>
>>> ansible 2.0.1.0
>>>
>>>   config file = /Users/ncohen/software/face/fn-ansible/ansible.cfg
>>>
>>>   configured module search path = Default w/o overrides
>>>
>>> I'm getting an error on first usage of ansible_env variable
>>>
>>> ```
>>> - hosts: local
>>>   environment:
>>> PATH: "{{ ansible_env.PATH }}:/usr/local/bin"
>>>   tasks:
>>>   ...
>>> ```
>>>
>>>
>>> Error looks like this:
>>>
>>> ```
>>> PLAY
>>> ***
>>>
>>>
>>> TASK [setup]
>>> ***
>>>
>>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible_env' is
>>> undefined"}
>>>
>>>
>>> NO MORE HOSTS LEFT
>>> *
>>>
>>> to retry, use: --limit @
>>>
>>> PLAY RECAP
>>> *
>>>
>>> localhost  : ok=0changed=0unreachable=0
>>> failed=1
>>> ```
>>>
>>> Anyone have any idea what's going on?  This worked on 2.0.0.1 without
>>> issue ...
>>>
>>>
>>> --
>>> 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/CABUBibsio9cKH7r8-CR%2Bd8xCJSe0SBC1jFGP2F3L%2B%3DLXCba5dw%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> --
>> 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/CACVha7f61cUZwLjm-%3DBEPmJB-EPDJK5x%3DPBf4Y3%2B%2BNJTcuqUfQ%40mail.gmail.com
>> 

[ansible-project] OS_TOKEN environment variable with os_* modules

2016-03-02 Thread Curtis
Hi,

I'm having a hard time getting the os_user (and I would imagine other
modules) to work just using a service token, ie. there are no users in
keystone yet, so need to create them using the service token.

How would I do that with the os_* modules? I can get the openstack
python client to work with just OS_TOKEN and OS_URL environment
variables also using V3 of the identity API, but can't get the os_user
module to work with the same, setting environment variables in the
playbook.

I'm on ansible 2.0.1.0.

Thanks for any help,
Curtis.

-- 
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/CAJ_JamB6zrxrE4vh2APSo7voSoN%2BFMBXqSizJGZNYZfiFMjrog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible_env is undefined

2016-03-02 Thread Ben Cohen
Thanks -- what's a good pattern to the PATH environment variable during a
play?

On Mon, Feb 29, 2016 at 7:42 PM, Brian Coca  wrote:

> As per https://github.com/ansible/ansible/blob/devel/CHANGELOG.md
>
> "Fix to make implicit fact gathering task correctly inherit settings from
> play, this might cause an error if settings environment on play depending
> on 'ansible_env' which was previously ignored"
>
> On Mon, Feb 29, 2016 at 7:44 PM, Ben Cohen  wrote:
>
>> After upgrading ansible versions:
>>
>> ncohen@breathe ~/s/f/fn-ansible (master)> ansible --version
>>
>> ansible 2.0.1.0
>>
>>   config file = /Users/ncohen/software/face/fn-ansible/ansible.cfg
>>
>>   configured module search path = Default w/o overrides
>>
>> I'm getting an error on first usage of ansible_env variable
>>
>> ```
>> - hosts: local
>>   environment:
>> PATH: "{{ ansible_env.PATH }}:/usr/local/bin"
>>   tasks:
>>   ...
>> ```
>>
>>
>> Error looks like this:
>>
>> ```
>> PLAY
>> ***
>>
>>
>> TASK [setup]
>> ***
>>
>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible_env' is
>> undefined"}
>>
>>
>> NO MORE HOSTS LEFT
>> *
>>
>> to retry, use: --limit @
>>
>> PLAY RECAP
>> *
>>
>> localhost  : ok=0changed=0unreachable=0
>> failed=1
>> ```
>>
>> Anyone have any idea what's going on?  This worked on 2.0.0.1 without
>> issue ...
>>
>>
>> --
>> 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/CABUBibsio9cKH7r8-CR%2Bd8xCJSe0SBC1jFGP2F3L%2B%3DLXCba5dw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> --
> 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/CACVha7f61cUZwLjm-%3DBEPmJB-EPDJK5x%3DPBf4Y3%2B%2BNJTcuqUfQ%40mail.gmail.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/CABUBibvJZhfwNnyri0KOnkdxpx1EfsSR%3DKqwuiPMNWq6ajH2Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Docker container always reloaded

2016-03-02 Thread Guy Knights
I have a particular task that starts a docker container, and for some 
reason every time it runs it reloads the container. The task definition is 
below:

docker:
name: zabbix
image: "zabbix/zabbix-{{ zabbix.version }}"
state: reloaded
pull: always
expose:
  - 80
  - 10051
ports:
  - "80:80"
  - "10051:10051"
env:
  TZ: "{{ timezone }}"
  ENVIRONMENT: "{{ env }}"
  ZS_DBHost: "{{ zabbix.db.host }}"
  ZS_DBUser: "{{ zabbix.db.user }}"
  ZS_DBPassword: "{{ zabbix.db.password }}"

None of the above options have changed between runs so I'm not sure why it 
decides to reload every time. I have other docker tasks that (correctly) 
only reload the container when the parameters have changed.

I saw a thread about adding 'net: bridge' to stop this behaviour which I 
tried, but it didn't work. Does anyone have any suggestions as to how I can 
make it operate correctly?

Thanks,
Guy

-- 
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/e87059bc-08a0-491a-9e30-d8c62aa5ee49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible win_regedit error: {"failed": true, "msg": "'dict object' has no attribute 'datatype'"}"

2016-03-02 Thread a akin
Hi J,

Thanks, your syntax for listing the items under the "with_items' section 
did the trick. 
I wonder why listing as:
{location: 'WindowsUpdate', value: 'WUServer', data: '
http://x.x.x.x:8530 ', datatype: 'string'}
was throwing an error.

Thanks again.
a.


-- 
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/8bfaeb9e-09d6-4594-9a5e-24f8eb297536%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Uri module uses CONNECT instead of GET when going through a proxy and fails

2016-03-02 Thread Matt Martz
I think this is likely fixed in devel/2.1.

The `uri` module previously relied on httplib2.  That dependency has been
removed and `uri` now utilizes the shared code from
`ansible.module_utils.urls` that `get_url` and many other modules have been
using for some time now.

On Wed, Mar 2, 2016 at 11:00 AM, Benoit Tremblay 
wrote:

> I have a problem using uri when behind a proxy.  There is an exception in
> the python module.
> This works well when not going through a proxy.  But fails when a proxy is
> set.
>
>  - uri: url="http://www.google.com"; dest="/tmp/tempfile"
>
> fatal: [h39]: FAILED! => {"changed": false, "failed": true, "invocation":
> {"module_name": "uri"}, "module_stderr": "", "module_stdout": "Traceback
> (most recent call last):\r\n  File
> \"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line
> 2439, in \r\nmain()\r\n  File
> \"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line
> 453, in main\r\nresp, content, dest = uri(module, url, dest, user,
> password, body, body_format, method, dict_headers, redirects,
> socket_timeout, validate_certs)\r\n  File
> \"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line
> 340, in uri\r\nresp, content = h.request(url, method=method, body=body,
> headers=headers) \r\n  File
> \"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1609,
> in request\r\n(response, content) = self._request(conn, authority, uri,
> request_uri, method, body, headers, redirections, cachekey)\r\n  File
> \"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1351,
> in _request\r\n(response, content) = self._conn_request(conn,
> request_uri, method, body, headers)\r\n  File
> \"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1272,
> in _conn_request\r\nconn.connect()\r\n  File
> \"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 916,
> in connect\r\nself.sock.connect((self.host, self.port) + sa[2:])\r\n
> File \"/usr/local/lib/python2.7/dist-packages/httplib2/socks.py\", line
> 424, in connect\r\nself.__negotiatehttp(destpair[0], destpair[1])\r\n
> File \"/usr/local/lib/python2.7/dist-packages/httplib2/socks.py\", line
> 390, in __negotiatehttp\r\nraise HTTPError((statuscode,
> statusline[2]))\r\nhttplib2.socks.HTTPError: (403, 'Forbidden')\r\n",
> "msg": "MODULE FAILURE", "parsed": false}
>
>
> When listening on my proxy server, I realized that uri is trying to HTTP
> CONNECT to google, rather that using GET.  I compared with what wget or
> curl are doing and both of them are sending GET to the proxy.
>
> Anyone has faced the same issue?
>
> I am using version 2.0.0.1 of Ansible.
> The remote node is running ubuntu 14.04.04
>
> --
> 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/c836f0b1-b919-4c67-84cd-cba507900062%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v9VFkCV%2Bg%3Dj%3DMsoNr8obSo8QRcZ%2BcmO_HsW5AYStcDjfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Uri module uses CONNECT instead of GET when going through a proxy and fails

2016-03-02 Thread Benoit Tremblay
I have a problem using uri when behind a proxy.  There is an exception in 
the python module.
This works well when not going through a proxy.  But fails when a proxy is 
set. 

 - uri: url="http://www.google.com"; dest="/tmp/tempfile"

fatal: [h39]: FAILED! => {"changed": false, "failed": true, "invocation": 
{"module_name": "uri"}, "module_stderr": "", "module_stdout": "Traceback 
(most recent call last):\r\n  File 
\"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line 
2439, in \r\nmain()\r\n  File 
\"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line 
453, in main\r\nresp, content, dest = uri(module, url, dest, user, 
password, body, body_format, method, dict_headers, redirects, 
socket_timeout, validate_certs)\r\n  File 
\"/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri\", line 
340, in uri\r\nresp, content = h.request(url, method=method, body=body, 
headers=headers) \r\n  File 
\"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1609, 
in request\r\n(response, content) = self._request(conn, authority, uri, 
request_uri, method, body, headers, redirections, cachekey)\r\n  File 
\"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1351, 
in _request\r\n(response, content) = self._conn_request(conn, 
request_uri, method, body, headers)\r\n  File 
\"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 1272, 
in _conn_request\r\nconn.connect()\r\n  File 
\"/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py\", line 916, 
in connect\r\nself.sock.connect((self.host, self.port) + sa[2:])\r\n  
File \"/usr/local/lib/python2.7/dist-packages/httplib2/socks.py\", line 
424, in connect\r\nself.__negotiatehttp(destpair[0], destpair[1])\r\n  
File \"/usr/local/lib/python2.7/dist-packages/httplib2/socks.py\", line 
390, in __negotiatehttp\r\nraise HTTPError((statuscode, 
statusline[2]))\r\nhttplib2.socks.HTTPError: (403, 'Forbidden')\r\n", 
"msg": "MODULE FAILURE", "parsed": false}


When listening on my proxy server, I realized that uri is trying to HTTP 
CONNECT to google, rather that using GET.  I compared with what wget or 
curl are doing and both of them are sending GET to the proxy.

Anyone has faced the same issue?

I am using version 2.0.0.1 of Ansible.
The remote node is running ubuntu 14.04.04

-- 
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/c836f0b1-b919-4c67-84cd-cba507900062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to delete multiple lines after a match?

2016-03-02 Thread Weiwen Chen
I end up with replace module with pattern ':' in it.

On Friday, February 26, 2016 at 1:31:37 PM UTC-7, Weiwen Chen wrote:
>
> Hello Expert,
>
> Is there a way in ansible to delete multiple lines after a pattern matched?
>
>
> For example, I have a file with following contents, and need to delete 
> lines 'bb', 'cc'. However I really do not know what are those two 
> lines as they are generated dynamically. I only know line ':'
>
> ---
> start contents
> :
> bb
> cc
> other contents
>
>

-- 
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/291134d6-13ce-4d1e-8282-4302814299c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Boto(ec2) documentation confusing, ec2_vpc_net_facts

2016-03-02 Thread Stephen Granger
I spent some time trying to use this module and had trouble finding
documentation for the filters to pass in. E.g isDefault is actually
is_default, vpc_id, id is actually vpc-d, and even though most of the
documentation points to is_default being a boolean I had to pass it in as a
string e.g.


# Get the vpc id
- name: Get the VPC net details
  ec2_vpc_net_facts:
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
filters:
  is_default: "true"
  register: returned_vpc

- name: The VPC id
  debug:
var: returned_vpc.vpcs[0].id

http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcs.html
http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeVpcs.html
http://boto.cloudhackers.com/en/latest/ref/vpc.html#boto.vpc.VPCConnection.get_all_vpcs

There seems to be conflicting variable names and types used through out.

Is there something I'm missing in regards what filters to pass? how
variables are set? their types? It all seems pretty confusing and
inconsistent, what (documentation/reference) am I missing?

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 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/CA%2BemtqvXhMq-k7gWxSyPSVJPzU3KoXr2SitzhrxPO4pJZBO2%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Downgrading apt packages safely

2016-03-02 Thread jan . warchol
Hello,

in my ansible playbook I want to ensure a specific version of a package is 
installed, even if that would mean downgrading it.  I know that I can 
specify version together with package name, like this: haproxy=1.4.24-2.  
However, this is not enough in case of downgrading: this playbook

- hosts: all
  tasks:
- name: install haproxy
  apt:
name: haproxy=1.4.24-2
  sudo: yes

will fail if a newer version of haproxy is installed.  I know that I can 
use "force" attribute, but that would also disable some useful security 
checks - for example, with force=yes Ansible would install a package even 
if it couldn't be authenticated.  Is there a better way?

I thought that "dpkg_options" may help me, but this playbook also fails on 
downgrade:

- hosts: all
  tasks:
- name: install haproxy
  apt:
name: haproxy=1.4.24-2
dpkg_options: force-downgrade
  sudo: yes

Is this a bug?
Maybe I should approach this problem in an altogether different way?

best,
Jan

-- 
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/67ae437b-cd6d-4b40-8821-1608c5ce4258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Not Passing Domain

2016-03-02 Thread navarone52
I do have python-kerberos installed. 

On Wednesday, March 2, 2016 at 10:34:40 AM UTC-5, J Hawkesworth wrote:
>
> My guess would be that you don't have the python kerberos library 
> installed as it looks like ansible is making a plaintext connection rather 
> than a kerberos one.
>
> from the command line on your ansible controller, start python and enter
>
>import kerberos
>
> if you don't have kerberos you will get a python traceback, if you do you 
> don't get an error.
>
> Hope this helps,
>
> Jon
>
>
>
> On Wednesday, 2 March 2016 14:46:56 UTC, navar...@gmail.com wrote:
>>
>> Also it's ansible 1.9.4
>>
>> On Wednesday, March 2, 2016 at 9:46:07 AM UTC-5, navar...@gmail.com 
>> wrote:
>>>
>>> I'm trying to get Ansible working with Windows Systems. I'm currently 
>>> testing it against 2k8 box. 
>>>
>>> Run: ansible windows -m win_ping -v  (I have one system in the 
>>> windows group)
>>>
>>> Returns:
>>>
>>>  ESTABLISH WINRM CONNECTION FOR USER: ansible_user 
>>> on PORT 5986 TO System.DOMAIN.COM
>>>  WINRM CONNECT: transport=plaintext endpoint=
>>> https://System.DOMAIN.COM:5986/wsman
>>>  WINRM CONNECTION ERROR: 401 Unauthorized. basic 
>>> auth failed
>>> System.DOMAIN.COM | FAILED => 401 Unauthorized. basic auth failed
>>>
>>>
>>> My windows.yml looks like this
>>>
>>> ansible_ssh_user: ansibl...@domain.com
>>> ansible_ssh_pass: PASSWORD
>>> ansible_ssh_port: 5986
>>> ansible_connection: winrm
>>>
>>> So the error seems pretty straight forward and the event viewer on the 
>>> system shows the same issue as you can see below. Looking at the below log 
>>> when the failure happens the Account Domain is showing up as the local 
>>> system name. It appears the domain portion over the username is not being 
>>> sent to the windows system. Can anyone provide assistance to what I may be 
>>> doing wrong here? 
>>>
>>> An account failed to log on.
>>>
>>> Subject:
>>> Security ID: NETWORK SERVICE
>>> Account Name: System$
>>> Account Domain: Domain
>>> Logon ID: 0x3e4
>>>
>>> Logon Type: 3
>>>
>>> Account For Which Logon Failed:
>>> Security ID: NULL SID
>>> Account Name: ansible_user
>>> Account Domain: System
>>>
>>> Failure Information:
>>> Failure Reason: Unknown user name or bad password.
>>> Status: 0xc06d
>>> Sub Status: 0xc064
>>>
>>> Process Information:
>>> Caller Process ID: 0x4e8
>>> Caller Process Name: C:\Windows\System32\svchost.exe
>>>
>>> Network Information:
>>> Workstation Name: System
>>> Source Network Address: -
>>> Source Port: -
>>>
>>> Detailed Authentication Information:
>>> Logon Process: Advapi  
>>> Authentication Package: Negotiate
>>> Transited Services: -
>>> Package Name (NTLM only): -
>>> Key Length: 0
>>>
>>>
>>> Also krb is setup and kinit ansibl...@domain.com  does work correctly. 
>>>
>>>

-- 
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/46e7c42e-1167-4156-b55b-46f655aa5dff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Executing a command remotely using ansible

2016-03-02 Thread Akash John
Hi Jeff, yes but i think there we cannot find the similar method as i 
shared earlier for linux. Could you please guide me if I missed anything on 
that page?

On Wednesday, March 2, 2016 at 8:28:44 PM UTC+5:30, Jeff L wrote:
>
> Have you looked at this? 
> http://docs.ansible.com/ansible/intro_windows.html
>
>
> On Wednesday, March 2, 2016 at 9:40:53 AM UTC-5, Akash John wrote:
>>
>> Hi Team,
>>
>> I would like to execute a command on a remote windows host as we are 
>> performing on Linux Machines *ansible webserver -s -m shell -a 
>> "/etc/init.d/httpd status" -u user1 -k*  
>>
>> Some could you please help me how can we execute the command on Windows 
>> remote host. Most probably we need to find a module to replace shell on the 
>> above mentioned command line. 
>>
>> Could you please guide me how can we achieve this?
>>
>> Thanks,
>> Akash John 
>>
>

-- 
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/1f4746d3-0e9b-4605-816a-2a8b3d400c94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Problem in exuting ConfigureRemotingForAnsible.ps1 in windows 7

2016-03-02 Thread 'J Hawkesworth' via Ansible Project
The script has changed a bit since Chris's message (over a year ago).

Can you confirm you have upgraded to powershell 3 or 4 on the machines 
before running ConfigureRemotingForAnsible.ps1

It would help if you provide the exact error message.

Hope this helps,

Jon




On Wednesday, 2 March 2016 13:39:56 UTC, Fahd Ajmal wrote:
>
> Hi Chris, 
>
> I am getting similar error while running {ConfigureRemotingForAnsible.ps1} 
> on some machines. I tried to look for L135 in the script but that is 
> already a comment. can you please mention the exact line (code) that needs 
> to be commented out? 
>
>
> { # Create the hashtables of settings to be used.
> $valueset = @{} $valueset.Add('Hostname', $SubjectName) $valueset.Add(
> 'CertificateThumbprint', $thumbprint)} 
>
>
>
>
>
>
> Regards,
> Fahd
>
> On Wednesday, 10 December 2014 00:32:00 UTC+11, Chris Church wrote:
>>
>> That error is coming from the attempt to connect back to localhost.  'd 
>> made changes to some of the error handling recently; previously the script 
>> would write an error message but continue to run.
>>
>> Try commenting out line 135 (
>> https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L135)
>>  
>> to let the script continue past the error: Throw "Unable to establish an 
>> HTTP or HTTPS remoting session."
>>
>> Please let me know if that change works for you.
>>
>>
>> On Tue, Dec 9, 2014 at 6:44 AM, youmarva  wrote:
>>
>>> I want to exécute  in a windows 7 machine to allow connexion with 
>>> Ansible.
>>>
>>> In some Machines I have this error when executing 
>>> ConfigureRemotingForAnsible.ps1 (as admin) :
>>>
>>> PS C:\Users\adminsifast\Documents\Ansible> 
>>> .\ConfigureRemotingForAnsible.ps1
>>>
>>> WinRM has been updated to receive requests.
>>> The type of the WinRM service was successfully modified. 
>>>
>>>
>>> *or (**WinRM is already configured to receive this request**)*
>>>
>>> C:\Users\adminsifast\Documents\Ansible\ConfigureRemotingForAnsible.ps1 : 
>>> Could not establish session on either HTTP or
>>> HTTPS. Breaking
>>> Au caractère Ligne:1 : 1
>>> + .\ConfigureRemotingForAnsible.ps1
>>> + ~
>>> + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
>>> + FullyQualifiedErrorId : 
>>> Microsoft.PowerShell.Commands.WriteErrorException,ConfigureRemotingForAnsible.ps1
>>>
>>>
>>> I searched this error but I have not find a solution to it.
>>> for some pc when I execute ConfigureRemotingForAnsible.ps1 I have no 
>>> problem but on the other the proplem persists.
>>>
>>> if you have an idea thank you to orient me, I really need a solution to 
>>> communicate with Ansible.
>>>
>>> thank you
>>>
>>> -- 
>>> 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-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/cb6bbb28-bc6c-4485-b3de-8d2b67376768%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/b17f2c95-039b-4497-9774-e9ea79d609a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible win_regedit error: {"failed": true, "msg": "'dict object' has no attribute 'datatype'"}"

2016-03-02 Thread 'J Hawkesworth' via Ansible Project
I think you are on the right track.

I suspect you don't want 'item.datatype' in your with_items list - you only 
need item. when you are dereferencing the variable.

Not tested, but I think maybe something like this is what you are after.  I 
changed subkey to location as it seems subkey has a special meaning in yaml.

Incidentally I use yamllint.com or a yaml-aware editor such as notepad++ to 
help get my syntax straight, that might help here.

--- 
- 
  name: "Insert Updates needed for WSUS"
  win_regedit: 
data: "{{item.data}}"
datatype: "{{item.datatype}}"
key: "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\{{item.location}}"
value: "{{item.value}}"
  with_items: 
- location: WindowsUpdate 
  data: "http://x.x.x.x:8530";
  datatype: string
  value: WUServer
- location: SomeOtherLocation 
  data: "http://x.x.x.x:8530";
  datatype: string
  value: WUServer

Hope this helps,

Jon

On Wednesday, 2 March 2016 14:21:30 UTC, a akin wrote:
>
> Ok, got some help from the docs and doing this now, better but probably 
> still not the best:
>
> - name: Insert Updates needed for WSUS
>   win_regedit:
> key: HKLM:\SOFTWARE\Policies\
> Microsoft\Windows\{{item.subkey}}
> value: "{{item.value}}"
> data: "{{item.data}}"
> datatype: "{{item.datatype}}"
>   with_items:
> - {subkey: 'WindowsUpdate', value: 'WUServer', data: '
> http://x.x.x.x:8530 ', item.datatype: 'string'}
>
> but I am getting this error:
> "fatal: [172.x.x.x]: FAILED! => {"failed": true, "msg": "'dict object' 
> has no attribute 'datatype'"}"
>
> No error if I comment out " datatype: "{{item.datatype}}"" but the values 
> are being created as default datatype (string). 
>
> I am on Ansible 2.0.1.0.
>
> Any help appreciated.
>

-- 
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/bf8032ee-8cae-4b97-8e00-9fc015e31a9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows 7 Ansible 2.0

2016-03-02 Thread 'J Hawkesworth' via Ansible Project
I think Windows 7 comes with powershell 2.0 - Ansible needs powershell 3.0 
or later.  Have you upgraded to powershell 3 or 4, (or Windows Management 
Framework 3.0 or 4.0)?

I suggest using the windows hostname rather than ip, just to rule that out 
too.

Hope this helps,

Jon
On Wednesday, 2 March 2016 14:40:53 UTC, sja...@counsyl.com wrote:
>
> I have a Windows 7 Enterprise VM that I cannot get to function with 
> Ansible 2.0
>
> Control Server: Centos 7
> Ansible Version: ansible 2.0.1.0 and previously 1.9.4
>
> I have followed the setup guide, run the Prep-Script on Windows, verified 
> that WinRM is functional
>
> When running: ansible windows -m setup - I get the following:
>
> Loaded callback minimal of type stdout, v2.0
> <192.168.2.191> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 
> 5986 TO 192.168.2.191
> <192.168.2.191> EXEC Set-StrictMode -Version Latest
> (New-Item -Type Directory -Path $env:temp -Name 
> "ansible-tmp-1456880843.77-137909747715611").FullName | Write-Host 
> -Separator '';
> 192.168.2.191 | UNREACHABLE! => {
> "changed": false,
> "msg": "Authentication or permission failure. In some cases, you may 
> have been able to authenticate and did not have permissions on the remote 
> directory. Consider changing the remote temp path in ansible.cfg to a path 
> rooted in \"/tmp\". Failed command was: PowerShell -NoProfile 
> -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand 
> UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAoAE4AZQB3AC0ASQB0AGUAbQAgAC0AVAB5AHAAZQAgAEQAaQByAGUAYwB0AG8AcgB5ACAALQBQAGEAdABoACAAJABlAG4AdgA6AHQAZQBtAHAAIAAtAE4AYQBtAGUAIAAiAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAA1ADYAOAA4ADAAOAA0ADMALgA3ADcALQAxADMANwA5ADAAOQA3ADQANwA3ADEANQA2ADEAMQAiACkALgBGAHUAbABsAE4AYQBtAGUAIAB8ACAAVwByAGkAdABlAC0ASABvAHMAdAAgAC0AUwBlAHAAYQByAGEAdABvAHIAIAAnACcAOwA=,
>  
> exited with result 1",
> "unreachable": true
>
> However, I have run this on both 2008 R2 and Windows 2012 R2 and it works 
> flawlessly.
>
> Whatever it is it seems to be unique to Win 7
>

-- 
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/10daae61-a86d-49b7-83d6-06018f79c7f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Not Passing Domain

2016-03-02 Thread 'J Hawkesworth' via Ansible Project
My guess would be that you don't have the python kerberos library installed 
as it looks like ansible is making a plaintext connection rather than a 
kerberos one.

from the command line on your ansible controller, start python and enter

   import kerberos

if you don't have kerberos you will get a python traceback, if you do you 
don't get an error.

Hope this helps,

Jon



On Wednesday, 2 March 2016 14:46:56 UTC, navar...@gmail.com wrote:
>
> Also it's ansible 1.9.4
>
> On Wednesday, March 2, 2016 at 9:46:07 AM UTC-5, navar...@gmail.com wrote:
>>
>> I'm trying to get Ansible working with Windows Systems. I'm currently 
>> testing it against 2k8 box. 
>>
>> Run: ansible windows -m win_ping -v  (I have one system in the 
>> windows group)
>>
>> Returns:
>>
>>  ESTABLISH WINRM CONNECTION FOR USER: ansible_user on 
>> PORT 5986 TO System.DOMAIN.COM
>>  WINRM CONNECT: transport=plaintext endpoint=
>> https://System.DOMAIN.COM:5986/wsman
>>  WINRM CONNECTION ERROR: 401 Unauthorized. basic auth 
>> failed
>> System.DOMAIN.COM | FAILED => 401 Unauthorized. basic auth failed
>>
>>
>> My windows.yml looks like this
>>
>> ansible_ssh_user: ansibl...@domain.com 
>> ansible_ssh_pass: PASSWORD
>> ansible_ssh_port: 5986
>> ansible_connection: winrm
>>
>> So the error seems pretty straight forward and the event viewer on the 
>> system shows the same issue as you can see below. Looking at the below log 
>> when the failure happens the Account Domain is showing up as the local 
>> system name. It appears the domain portion over the username is not being 
>> sent to the windows system. Can anyone provide assistance to what I may be 
>> doing wrong here? 
>>
>> An account failed to log on.
>>
>> Subject:
>> Security ID: NETWORK SERVICE
>> Account Name: System$
>> Account Domain: Domain
>> Logon ID: 0x3e4
>>
>> Logon Type: 3
>>
>> Account For Which Logon Failed:
>> Security ID: NULL SID
>> Account Name: ansible_user
>> Account Domain: System
>>
>> Failure Information:
>> Failure Reason: Unknown user name or bad password.
>> Status: 0xc06d
>> Sub Status: 0xc064
>>
>> Process Information:
>> Caller Process ID: 0x4e8
>> Caller Process Name: C:\Windows\System32\svchost.exe
>>
>> Network Information:
>> Workstation Name: System
>> Source Network Address: -
>> Source Port: -
>>
>> Detailed Authentication Information:
>> Logon Process: Advapi  
>> Authentication Package: Negotiate
>> Transited Services: -
>> Package Name (NTLM only): -
>> Key Length: 0
>>
>>
>> Also krb is setup and kinit ansibl...@domain.com   does 
>> work correctly. 
>>
>>

-- 
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/a166dad9-7781-43a4-a2fe-59faa3663e44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: packages = p['package'].split(',')\r\nAttributeError:

2016-03-02 Thread Joanna Delaporte
That looks okay, unless you are also running Ansible from the Github repo. 

Can you paste the full play here, including the variables that are being 
read into the play?

Thanks!
Joanna

On Wednesday, March 2, 2016 at 2:34:34 AM UTC-6, hilali lui wrote:
>
> Thank yoou for your reponse  I found 
>
> ahilali@ahilali-desktop:~$ python -c "import sys; print sys.path"
> ['', '/usr/local/lib/python2.7/dist-packages/ansible-2.0.0.2-py2.7.egg', 
> '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', 
> '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', 
> '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', 
> '/usr/local/lib/python2.7/dist-packages', 
> '/usr/lib/python2.7/dist-packages/PILcompat', 
> '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', 
> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
>
>
> Le mercredi 2 mars 2016 00:06:38 UTC+1, Joanna Delaporte a écrit :
>>
>> I just had a few weird attribute errors that were caused by having 
>> multiple installations of Ansible. I had a system install and I was trying 
>> to use a Github clone of Ansible.
>>  
>> You can use the following command to see where your system Ansible 
>> locations might be (thanks to Matt Martz):
>> $ python -c "import sys; print sys.path"
>>
>> On Tuesday, March 1, 2016 at 3:33:22 PM UTC-6, hilali lui wrote:
>>>
>>> Hello,
>>>
>>>
>>> When I use this:
>>>
>>> - name: Install {{ install_name }} required tools
>>>   apt:  pkg={{ item }}
>>> state=installed
>>> update_cache=yes
>>>
>>>
>>> I found this error :
>>>
>>> failed: [192.168.8.123] => (item=[u'sudo', u'vim', u'tree', u'git', 
>>> u'gcc', u'iotop', u'htop', u'build-essential', u'xfonts-base', 
>>> u'xfonts-encodings', u'xfonts-75dpi', u'xfonts-utils', u'libfontenc1', 
>>> u'libffi-dev', u'libssl-dev', u'libevent-dev', u'libgeos-dev', 
>>> u'libldap2-dev', u'libsasl2-dev', u'libxfont1', u'libxml2', u'libxml2-dev', 
>>> u'libxslt1.1', u'libxslt1-dev', u'libxslt-dev', u'node-clean-css', 
>>> u'node-less']) => {"failed": true, "invocation": {"module_name": "apt"}, 
>>> "item": ["sudo", "vim", "tree", "git", "gcc", "iotop", "htop", 
>>> "build-essential", "xfonts-base", "xfonts-encodings", "xfonts-75dpi", 
>>> "xfonts-utils", "libfontenc1", "libffi-dev", "libssl-dev", "libevent-dev", 
>>> "libgeos-dev", "libldap2-dev", "libsasl2-dev", "libxfont1", "libxml2", 
>>> "libxml2-dev", "libxslt1.1", "libxslt1-dev", "libxslt-dev", 
>>> "node-clean-css", "node-less"], "module_stderr": "OpenSSH_6.6.1, OpenSSL 
>>> 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data 
>>> /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying 
>>> options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 
>>> setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 
>>> 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 
>>> remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: 
>>> mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: 
>>> done pid = 20859\r\ndebug3: mux_client_request_session: session request 
>>> sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: 
>>> mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received 
>>> exit status from master 0\r\nShared connection to 192.168.8.123 
>>> closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  
>>> File \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", 
>>> line 2407, in \r\nmain()\r\n  File 
>>> \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", line 
>>> 448, in main\r\np'list' object has no attribute 'split'\r\n", "msg": 
>>> "MODULE FAILURE", "parsed": false}
>>>
>>

-- 
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/14f4593b-69b5-414f-b552-adfa26f0f504%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Cloned Ansible from github, now ad-hoc fails with the error: 'module' object has no attribute 'COLOR_ERROR'

2016-03-02 Thread Joanna Delaporte
Hi Brian, 

Thanks! It turns out I had a system installation still hanging around in 
addition to the github clone. So, I pip uninstalled to remove the system 
installation of Ansible and now everything works again. 


On Wednesday, March 2, 2016 at 8:21:33 AM UTC-6, Brian Coca wrote:
>
> run 'make clean' on the github repo, it seems you are mixing old files 
> with the new code. You'll need to run . hacking/env-setup again.
>
>
> --
> 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/fd40985c-de90-4f08-aeec-1ae8d9513d29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Executing a command remotely using ansible

2016-03-02 Thread Jeff L
Have you looked at this? http://docs.ansible.com/ansible/intro_windows.html


On Wednesday, March 2, 2016 at 9:40:53 AM UTC-5, Akash John wrote:
>
> Hi Team,
>
> I would like to execute a command on a remote windows host as we are 
> performing on Linux Machines *ansible webserver -s -m shell -a 
> "/etc/init.d/httpd status" -u user1 -k*  
>
> Some could you please help me how can we execute the command on Windows 
> remote host. Most probably we need to find a module to replace shell on the 
> above mentioned command line. 
>
> Could you please guide me how can we achieve this?
>
> Thanks,
> Akash John 
>

-- 
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/5a917f99-01af-406d-8605-ff91b0f365de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Not Passing Domain

2016-03-02 Thread navarone52
Also it's ansible 1.9.4

On Wednesday, March 2, 2016 at 9:46:07 AM UTC-5, navar...@gmail.com wrote:
>
> I'm trying to get Ansible working with Windows Systems. I'm currently 
> testing it against 2k8 box. 
>
> Run: ansible windows -m win_ping -v  (I have one system in the windows 
> group)
>
> Returns:
>
>  ESTABLISH WINRM CONNECTION FOR USER: ansible_user on 
> PORT 5986 TO System.DOMAIN.COM
>  WINRM CONNECT: transport=plaintext endpoint=
> https://System.DOMAIN.COM:5986/wsman
>  WINRM CONNECTION ERROR: 401 Unauthorized. basic auth 
> failed
> System.DOMAIN.COM | FAILED => 401 Unauthorized. basic auth failed
>
>
> My windows.yml looks like this
>
> ansible_ssh_user: ansible_u...@domain.com
> ansible_ssh_pass: PASSWORD
> ansible_ssh_port: 5986
> ansible_connection: winrm
>
> So the error seems pretty straight forward and the event viewer on the 
> system shows the same issue as you can see below. Looking at the below log 
> when the failure happens the Account Domain is showing up as the local 
> system name. It appears the domain portion over the username is not being 
> sent to the windows system. Can anyone provide assistance to what I may be 
> doing wrong here? 
>
> An account failed to log on.
>
> Subject:
> Security ID: NETWORK SERVICE
> Account Name: System$
> Account Domain: Domain
> Logon ID: 0x3e4
>
> Logon Type: 3
>
> Account For Which Logon Failed:
> Security ID: NULL SID
> Account Name: ansible_user
> Account Domain: System
>
> Failure Information:
> Failure Reason: Unknown user name or bad password.
> Status: 0xc06d
> Sub Status: 0xc064
>
> Process Information:
> Caller Process ID: 0x4e8
> Caller Process Name: C:\Windows\System32\svchost.exe
>
> Network Information:
> Workstation Name: System
> Source Network Address: -
> Source Port: -
>
> Detailed Authentication Information:
> Logon Process: Advapi  
> Authentication Package: Negotiate
> Transited Services: -
> Package Name (NTLM only): -
> Key Length: 0
>
>
> Also krb is setup and kinit ansible_u...@domain.com  does work correctly. 
>
>

-- 
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/8fd61ebe-7ced-444d-80a4-f4b2ca29a0d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Not Passing Domain

2016-03-02 Thread navarone52
I'm trying to get Ansible working with Windows Systems. I'm currently 
testing it against 2k8 box. 

Run: ansible windows -m win_ping -v  (I have one system in the windows 
group)

Returns:

 ESTABLISH WINRM CONNECTION FOR USER: ansible_user on 
PORT 5986 TO System.DOMAIN.COM
 WINRM CONNECT: transport=plaintext 
endpoint=https://System.DOMAIN.COM:5986/wsman
 WINRM CONNECTION ERROR: 401 Unauthorized. basic auth 
failed
System.DOMAIN.COM | FAILED => 401 Unauthorized. basic auth failed


My windows.yml looks like this

ansible_ssh_user: ansible_u...@domain.com
ansible_ssh_pass: PASSWORD
ansible_ssh_port: 5986
ansible_connection: winrm

So the error seems pretty straight forward and the event viewer on the 
system shows the same issue as you can see below. Looking at the below log 
when the failure happens the Account Domain is showing up as the local 
system name. It appears the domain portion over the username is not being 
sent to the windows system. Can anyone provide assistance to what I may be 
doing wrong here? 

An account failed to log on.

Subject:
Security ID: NETWORK SERVICE
Account Name: System$
Account Domain: Domain
Logon ID: 0x3e4

Logon Type: 3

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: ansible_user
Account Domain: System

Failure Information:
Failure Reason: Unknown user name or bad password.
Status: 0xc06d
Sub Status: 0xc064

Process Information:
Caller Process ID: 0x4e8
Caller Process Name: C:\Windows\System32\svchost.exe

Network Information:
Workstation Name: System
Source Network Address: -
Source Port: -

Detailed Authentication Information:
Logon Process: Advapi  
Authentication Package: Negotiate
Transited Services: -
Package Name (NTLM only): -
Key Length: 0


Also krb is setup and kinit ansible_u...@domain.com  does work correctly. 

-- 
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/d1758c98-0b4e-4935-be82-40e7505e3bec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Windows 7 Ansible 2.0

2016-03-02 Thread sjacobs
I have a Windows 7 Enterprise VM that I cannot get to function with Ansible 
2.0

Control Server: Centos 7
Ansible Version: ansible 2.0.1.0 and previously 1.9.4

I have followed the setup guide, run the Prep-Script on Windows, verified 
that WinRM is functional

When running: ansible windows -m setup - I get the following:

Loaded callback minimal of type stdout, v2.0
<192.168.2.191> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 
5986 TO 192.168.2.191
<192.168.2.191> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name 
"ansible-tmp-1456880843.77-137909747715611").FullName | Write-Host 
-Separator '';
192.168.2.191 | UNREACHABLE! => {
"changed": false,
"msg": "Authentication or permission failure. In some cases, you may 
have been able to authenticate and did not have permissions on the remote 
directory. Consider changing the remote temp path in ansible.cfg to a path 
rooted in \"/tmp\". Failed command was: PowerShell -NoProfile 
-NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand 
UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAoAE4AZQB3AC0ASQB0AGUAbQAgAC0AVAB5AHAAZQAgAEQAaQByAGUAYwB0AG8AcgB5ACAALQBQAGEAdABoACAAJABlAG4AdgA6AHQAZQBtAHAAIAAtAE4AYQBtAGUAIAAiAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAA1ADYAOAA4ADAAOAA0ADMALgA3ADcALQAxADMANwA5ADAAOQA3ADQANwA3ADEANQA2ADEAMQAiACkALgBGAHUAbABsAE4AYQBtAGUAIAB8ACAAVwByAGkAdABlAC0ASABvAHMAdAAgAC0AUwBlAHAAYQByAGEAdABvAHIAIAAnACcAOwA=,
 
exited with result 1",
"unreachable": true

However, I have run this on both 2008 R2 and Windows 2012 R2 and it works 
flawlessly.

Whatever it is it seems to be unique to Win 7

-- 
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/0f3ae625-8131-4764-a664-35ca37e2d683%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Executing a command remotely using ansible

2016-03-02 Thread Akash John
Hi Team,

I would like to execute a command on a remote windows host as we are 
performing on Linux Machines *ansible webserver -s -m shell -a 
"/etc/init.d/httpd status" -u user1 -k*  

Some could you please help me how can we execute the command on Windows 
remote host. Most probably we need to find a module to replace shell on the 
above mentioned command line. 

Could you please guide me how can we achieve this?

Thanks,
Akash John 

-- 
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/0ebe2157-f4d2-4469-b64f-ba9a41f4e562%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible win_regedit error: {"failed": true, "msg": "'dict object' has no attribute 'datatype'"}"

2016-03-02 Thread a akin
Ok, got some help from the docs and doing this now, better but probably 
still not the best:

- name: Insert Updates needed for WSUS
  win_regedit:
key: HKLM:\SOFTWARE\Policies\
Microsoft\Windows\{{item.subkey}}
value: "{{item.value}}"
data: "{{item.data}}"
datatype: "{{item.datatype}}"
  with_items:
- {subkey: 'WindowsUpdate', value: 'WUServer', data: '
http://x.x.x.x:8530 ', item.datatype: 'string'}

but I am getting this error:
"fatal: [172.x.x.x]: FAILED! => {"failed": true, "msg": "'dict object' 
has no attribute 'datatype'"}"

No error if I comment out " datatype: "{{item.datatype}}"" but the values 
are being created as default datatype (string). 

I am on Ansible 2.0.1.0.

Any help appreciated.

-- 
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/64b4eb75-6089-4d14-a07d-7c59ed300c12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Cloned Ansible from github, now ad-hoc fails with the error: 'module' object has no attribute 'COLOR_ERROR'

2016-03-02 Thread Brian Coca
run 'make clean' on the github repo, it seems you are mixing old files with
the new code. You'll need to run . hacking/env-setup again.


--
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/CACVha7d7_qqseSz4jPvy0M1UPRBtH2gH%3Dp3m%3D863aAVnD%2BsQLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Loops

2016-03-02 Thread a akin
Ok, got some help from the docs and doing this now, better but probably 
still not the best:

- name: Insert Updates needed for WSUS
  win_regedit:
key: HKLM:\SOFTWARE\Policies\Microsoft\Windows\{{item.subkey}}
value: "{{item.value}}"
data: "{{item.data}}"
datatype: "{{item.datatype}}"
  with_items:
- {subkey: 'WindowsUpdate', value: 'WUServer', data: 
'http://172.30.1.21:8530', item.datatype: 'string'}

but I am getting this error:
"fatal: [172.16.2.136]: FAILED! => {"failed": true, "msg": "'dict 
object' has no attribute 'datatype'"}"

No error if I comment out " datatype: "{{item.datatype}}"" but the values 
are being created as default datatype (string). 

I am on Ansible 2.0.1.0.

Any help appreciated.



-- 
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/dfb5c17d-ffdc-4f22-bfe7-883dc435e75a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How do I pass a password as an argument?

2016-03-02 Thread Gilberto Valentin
Ok, I figured this out. This is how I did it:

---
## This playbook installs and configures AD authentication

- name: Install and configure AD authentication
  hosts: linux
  remote_user: root

  tasks:
- name: install ad_auth required tools
  yum: pkg={{ item }} state=installed
  with_items:
- realmd
- sssd
- oddjob-mkhomedir
- adcli
- samba-common-tools
- python-pip

- name: install pexpect using pip
  shell: /bin/bash -c "pip install pexpect"

- name: discover realm
  shell: /bin/bash -c "/usr/sbin/realm discover AD.DOMAIN.TLD"

- name: join system to UNIX OU
  expect:
command: /bin/bash -c "/usr/sbin/realm join AD.DOMAIN.TLD 
--computer-ou=OU=LINUX,DC=domain,DC=tld --user=admin_user"
responses:
  Password for Administrator: "password123"

- name: modify /etc/sssd/sssd.conf
  template: src=/home/user/git/system_configs/ansible/templates/sssd.j2 
dest=/etc/sssd/sssd.conf
  notify:
- restart sssd

  handlers:
- name: restart sssd
  service: name=sssd state=restarted

Now I just have to figure out how to encrypt the password.

On Monday, February 29, 2016 at 10:43:08 PM UTC-5, Gilberto Valentin wrote:
>
> I have a playbook that installs the appropriate packages for Active 
> Directory Authentication. When it gets to the "join" portion, Ansible just 
> sits there because the join process is asking the user for the password of 
> the account that has access to join the system to Active Directory. How can 
> I pass my password from vars_prompt? I have highlighted where I call the 
> variable but I know that is the wrong place since it's going to try to pass 
> it to my "realm join" command, which isn't supported. I only added it there 
> to show I want to call it after the "realm join" portion is called.
>
> Here is my playbook:
>
> ---
> ## This playbook installs and configures AD authentication
>
> - name: Install and configure AD authentication
>   hosts: linux
>   remote_user: root
>
>   vars_prompt:
> - name: "ad_password"
>   prompt: "Enter AD Domain User Password"
>   private: yes
>
>   tasks:
> - name: install ad_auth required tools
>   yum: pkg={{ item }} state=installed
>   with_items:
> - realmd
> - sssd
> - oddjob-mkhomedir
> - adcli
> - samba-common-tools
>
> - name: discover and join domain
>   shell: realm discover AD.DOMAIN.TLD && realm join AD.DOMAIN.TLD
> --computer-ou=OU=LINUX,DC=DOMAIN,DC=TLD --user=user_name {{ 
> ad_password }}
>
> - name: modify /etc/sssd/sssd.conf
>   template: 
> src=/home/user_name/git/system_configs/ansible/templates/sssd.j2 
> dest=/etc/sssd/sssd.conf
>   notify:
> - restart sssd
>
>   handlers:
> - name: restart sssd
>   service: name=sssd state=restarted
>
> This is the error I get after running it:
>
> [user_name@server_name playbooks]$ ansible-playbook adAuth_asRoot.yaml 
> --user=root --ask-pass
> SSH password:
> Enter AD Domain User Password:
>
> PLAY [Install and configure AD authentication] 
> 
>
> GATHERING FACTS 
> ***
> ok: [ansible]
>
> TASK: [install ad_auth required tools] 
> 
> ok: [ansible] => 
> (item=realmd,sssd,oddjob-mkhomedir,adcli,samba-common-tools)
>
> TASK: [discover and join domain] 
> **
> failed: [ansible] => {"changed": true, "cmd": "realm discover 
> AD.DOMAIN.TLD && realm join AD.DOMAIN.TLD 
> --computer-ou=OU=LINUX,DC=DOMAIN,DC=TLD --user=user_name ad_password", 
> "delta": "0:00:00.053695", "end": "2016-02-29 20:39:40.764101", "rc": 2, 
> "start": "2016-02-29 20:39:40.710406", "warnings": []}
> stderr: realm: Specify one realm to join
> stdout: domain.tld
>   type: kerberos
>   realm-name: DOMAIN.TLD
>   domain-name: domain.tld
>   configured: no
>   server-software: active-directory
>   client-software: sssd
>   required-package: oddjob
>   required-package: oddjob-mkhomedir
>   required-package: sssd
>   required-package: adcli
>   required-package: samba-common
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
> 
>to retry, use: --limit @/home/user_name/adAuth_asRoot.yaml.retry
>
> ansible: ok=2changed=0unreachable=0failed=1
>
> Is there a better way to provide passwords when certain tasks call for it?
>
>

-- 
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

Re: [ansible-project] Re: Ansible pause module fails to abort when more than one host is in inventory list

2016-03-02 Thread Joanna Delaporte
I just upgraded my Ansible to follow development yesterday after seeing a
bug report that had been closed with a patch. I'll test again when I'm on
campus Thursday.

Thanks!
Joanna
On Mar 2, 2016 7:39 AM, "Brian Coca"  wrote:

> I cannot reproduce the issue in 2.0.1, when I hit A it exits the play.
>
>
> --
> Brian Coca
>
> --
> 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/xzetdZ7LA9U/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/CACVha7cZtUObLm3G1SCtV%3DFVwTKqqo78AXnVX%3DC%3DjS%3D45fJE7Q%40mail.gmail.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/CAG5EncLiTGcHATLyC95F79SC%3DnUK32VwAmVvcfPR9Nee1rirnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ERROR! 'expect' is not a valid attribute for a Play

2016-03-02 Thread Brian Coca
expect needs to be correctly indented (line up with the 'n' in name) also
you want to make sure the command and rest of parameters are also indented
farther than the 'e' in expect.


--
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/CACVha7fjnR1yuwJxrU1gbHDVB_WrpdScC6Vr8STGE2JJ1UiGiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Problem in exuting ConfigureRemotingForAnsible.ps1 in windows 7

2016-03-02 Thread Fahd Ajmal
Hi Chris, 

I am getting similar error while running {ConfigureRemotingForAnsible.ps1} 
on some machines. I tried to look for L135 in the script but that is 
already a comment. can you please mention the exact line (code) that needs 
to be commented out? 


{ # Create the hashtables of settings to be used.
$valueset = @{} $valueset.Add('Hostname', $SubjectName) $valueset.Add(
'CertificateThumbprint', $thumbprint)} 






Regards,
Fahd

On Wednesday, 10 December 2014 00:32:00 UTC+11, Chris Church wrote:
>
> That error is coming from the attempt to connect back to localhost.  'd 
> made changes to some of the error handling recently; previously the script 
> would write an error message but continue to run.
>
> Try commenting out line 135 (
> https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1#L135)
>  
> to let the script continue past the error: Throw "Unable to establish an 
> HTTP or HTTPS remoting session."
>
> Please let me know if that change works for you.
>
>
> On Tue, Dec 9, 2014 at 6:44 AM, youmarva  > wrote:
>
>> I want to exécute  in a windows 7 machine to allow connexion with Ansible.
>>
>> In some Machines I have this error when executing 
>> ConfigureRemotingForAnsible.ps1 (as admin) :
>>
>> PS C:\Users\adminsifast\Documents\Ansible> 
>> .\ConfigureRemotingForAnsible.ps1
>>
>> WinRM has been updated to receive requests.
>> The type of the WinRM service was successfully modified. 
>>
>>
>> *or (**WinRM is already configured to receive this request**)*
>>
>> C:\Users\adminsifast\Documents\Ansible\ConfigureRemotingForAnsible.ps1 : 
>> Could not establish session on either HTTP or
>> HTTPS. Breaking
>> Au caractère Ligne:1 : 1
>> + .\ConfigureRemotingForAnsible.ps1
>> + ~
>> + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
>> + FullyQualifiedErrorId : 
>> Microsoft.PowerShell.Commands.WriteErrorException,ConfigureRemotingForAnsible.ps1
>>
>>
>> I searched this error but I have not find a solution to it.
>> for some pc when I execute ConfigureRemotingForAnsible.ps1 I have no 
>> problem but on the other the proplem persists.
>>
>> if you have an idea thank you to orient me, I really need a solution to 
>> communicate with Ansible.
>>
>> thank you
>>
>> -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/cb6bbb28-bc6c-4485-b3de-8d2b67376768%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/ab8448e7-19ee-4fb4-bcae-6c18bfa01b13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Problem running ConfigureRemotingforAnsible.ps1 on Windows Server 2008 R2 SP1

2016-03-02 Thread Fahd Ajmal
Hi All, 

I am try to run {ConfigureAnsibleforRemoting.ps1} on Windows Server 2008 R2 
SP1. it works on most servers but is throwing the following exception on 
some:

PS C:\Windows\system32> E:\staging\ConfigureRemotingForAnsible.ps1
Exception has been thrown by the target of an invocation.
At E:\staging\ConfigureRemotingForAnsible.ps1:46 char:5
+ $key.Create()
+ ~
+ CategoryInfo  : NotSpecified: (:) [], 
TargetInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation

PS C:\Windows\system32>



Please advise what may be causing the error. 

Regards,
Fahd

-- 
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/47b8d8ee-8244-4c29-bb8c-59546ab0e5ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Loops

2016-03-02 Thread a akin
I am trying to update several values under a particular Registry Key name 
for example:

win_regedit:
key: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
value: DetectionFrequency
data: 0001
datatype: dword

  win_regedit:
key: HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
value: NoAUShutdownOption
data: 
datatype: dword

I know this is an inefficient way of doing it (besides it's not working due 
to this error -> found a duplicate dict key (win_regedit).  Using
last defined value only) and same task can be achieved with Loops, and 
updated inside just one 'win_regedit' instance. Can someone help me with 
how I can do this via loops?. 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/430645d8-b776-47ed-8f79-6d8f8ef9ac87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ERROR! 'expect' is not a valid attribute for a Play

2016-03-02 Thread Nor Idzuwan Mohammad
I'm trying to use the expect modules but only getting error

> ansible-playbook -vv --syntax-check passwd.yml

ERROR! 'expect' is not a valid attribute for a Play

The error appears to have been in 
'/home/users/.local/ansible/playbooks/passwd.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- hosts: all
  ^ here

my playbook contain:

---
- hosts: all
  remote_user: admin
  become: yes
  gather_facts: no
  tasks:
  - name: "test"
  expect:
command: passwd username
responses:
  (?i)password: "MySekretPa$$word"

note: this just a test not my actual password/username

-- 
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/1f08a99a-0b80-4fbc-97e6-91beae93d495%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] looping over list to use as role variables

2016-03-02 Thread basnijholt
Hi all,

I would like to use ansible to spawn (and later prune) a list of `jupyter 
notebook` servers.

I now do the following:

---
- hosts: vm1
  roles:
- { role: notebook, port: 8001, name: jup1 }
- { role: notebook, port: 8002, name: jup2 }
- role: jdauphant.nginx
  nginx_sites:
notebooks:
  - listen 8000
  - server_name localhost
  - location /jub1 {proxy_pass http://localhost:8001/tree;}
  - location /jup2 {proxy_pass http://localhost:8002/tree;}



As you see I repeat the port (8001 and 8002) and name (jup1 and jup2) 
twice, which I would like to do in a loop, but I don't know how.

I'm completely new to ansible, so if this is not a smart way of doing it, 
could you please give another suggestion.


Best, Bas Nijholt

-- 
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/17adc425-afae-4725-9d81-fed2b8489aac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible pause module fails to abort when more than one host is in inventory list

2016-03-02 Thread Brian Coca
I cannot reproduce the issue in 2.0.1, when I hit A it exits the play.


--
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/CACVha7cZtUObLm3G1SCtV%3DFVwTKqqo78AXnVX%3DC%3DjS%3D45fJE7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Generating password randomly when user is created

2016-03-02 Thread Deepa Yr
Thanks. Understood what you suggested. It works now.

On Tuesday, March 1, 2016 at 6:35:57 PM UTC+5:30, Matt Martz wrote:
>
> The user module expects the password to already be encrypted.  You will 
> also need to pass encrypt=True to the lookup as well.
>
> On Tuesday, March 1, 2016, Deepa Yr > 
> wrote:
>
>>
>> I am running this task
>>
>> - name: Create users with auto generated password
>>   user: name=deepa state=present password="{{ lookup('password', 
>> '/tmp/deepapassword.txt chars=ascii_letters') }}"
>>
>> It is creating the file /tmp/deepapassword.txt and I see the password
>> But when I try to login as deepa user with that password, it says 
>> incorrect password.
>>
>> Any suggestions here ? 
>>
>> My requirement is to create a user with random password and use this user 
>> credentials in the subsequent tasks. 
>>
>> -- 
>> 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/34ab8268-7cee-4543-b4a3-212c4668cc27%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>
>

-- 
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/f31384c8-41ad-4227-929d-17226a6ba45e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: packages = p['package'].split(',')\r\nAttributeError:

2016-03-02 Thread hilali lui
Thank yoou for your reponse  I found 

ahilali@ahilali-desktop:~$ python -c "import sys; print sys.path"
['', '/usr/local/lib/python2.7/dist-packages/ansible-2.0.0.2-py2.7.egg', 
'/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', 
'/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', 
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', 
'/usr/local/lib/python2.7/dist-packages', 
'/usr/lib/python2.7/dist-packages/PILcompat', 
'/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', 
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']


Le mercredi 2 mars 2016 00:06:38 UTC+1, Joanna Delaporte a écrit :
>
> I just had a few weird attribute errors that were caused by having 
> multiple installations of Ansible. I had a system install and I was trying 
> to use a Github clone of Ansible.
>  
> You can use the following command to see where your system Ansible 
> locations might be (thanks to Matt Martz):
> $ python -c "import sys; print sys.path"
>
> On Tuesday, March 1, 2016 at 3:33:22 PM UTC-6, hilali lui wrote:
>>
>> Hello,
>>
>>
>> When I use this:
>>
>> - name: Install {{ install_name }} required tools
>>   apt:  pkg={{ item }}
>> state=installed
>> update_cache=yes
>>
>>
>> I found this error :
>>
>> failed: [192.168.8.123] => (item=[u'sudo', u'vim', u'tree', u'git', 
>> u'gcc', u'iotop', u'htop', u'build-essential', u'xfonts-base', 
>> u'xfonts-encodings', u'xfonts-75dpi', u'xfonts-utils', u'libfontenc1', 
>> u'libffi-dev', u'libssl-dev', u'libevent-dev', u'libgeos-dev', 
>> u'libldap2-dev', u'libsasl2-dev', u'libxfont1', u'libxml2', u'libxml2-dev', 
>> u'libxslt1.1', u'libxslt1-dev', u'libxslt-dev', u'node-clean-css', 
>> u'node-less']) => {"failed": true, "invocation": {"module_name": "apt"}, 
>> "item": ["sudo", "vim", "tree", "git", "gcc", "iotop", "htop", 
>> "build-essential", "xfonts-base", "xfonts-encodings", "xfonts-75dpi", 
>> "xfonts-utils", "libfontenc1", "libffi-dev", "libssl-dev", "libevent-dev", 
>> "libgeos-dev", "libldap2-dev", "libsasl2-dev", "libxfont1", "libxml2", 
>> "libxml2-dev", "libxslt1.1", "libxslt1-dev", "libxslt-dev", 
>> "node-clean-css", "node-less"], "module_stderr": "OpenSSH_6.6.1, OpenSSL 
>> 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data 
>> /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying 
>> options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 
>> setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 
>> 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 
>> remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: 
>> mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: 
>> done pid = 20859\r\ndebug3: mux_client_request_session: session request 
>> sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: 
>> mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received 
>> exit status from master 0\r\nShared connection to 192.168.8.123 
>> closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  
>> File \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", 
>> line 2407, in \r\nmain()\r\n  File 
>> \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", line 
>> 448, in main\r\np'list' object has no attribute 'split'\r\n", "msg": 
>> "MODULE FAILURE", "parsed": false}
>>
>

-- 
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/aa174616-e884-451c-97f6-273b345e96a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.