[ansible-project] Cannot provision VM in Azure using Ansible

2018-03-26 Thread cloudworld79
Team,

Trying to provision VM in Azure Environment using Ansible.
However, getting error while running the command -


$ sudo ansible-playbook azure_create_vm.yml


PLAY [Create Azure VM] 
*

TASK [Gathering Facts] 
*
ok: [localhost]

TASK [Create VM] 
***
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating or 
updating virtual machine myVM1 - Azure Error: InvalidParameter\nMessage: 
Destination path for SSH public keys is currently limited to its default 
value /home/ansibleubuntu_admin/.ssh/authorized_keys  due to a known issue 
in Linux provisioning agent.\nTarget: 
linuxConfiguration.ssh.publicKeys.path"}
to retry, use: --limit 
@/home/ansibleubuntu_admin/azure_create_vm.retry

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

I`ve followed the Ansible article to create the credentials.ini and stored 
the SSH keys.
Wondering what steps to perform to check if any mistake with SSH key.

Please find my azure_create_vm.yml file for details.


$ vim azure_create_vm.yml

- name: Create Azure VM
  hosts: localhost
  connection: local
  tasks:
  - name: Create VM
azure_rm_virtualmachine:
  resource_group: ansible
  name: myVM1
  vm_size: Standard_B2s
  admin_username: ansibleubuntu_admin
  ssh_password_enabled: false
  ssh_public_keys:
- path: /home/ansibleubuntu_admin/.ssh/id_rsa.pub
  key_data: "ssh-rsa 
B3NzaC1yc2EDAQABAAABAQDHlUSOoRcz6ZbQsqIz2Q/vAW6VspvWLounnV4S3c2yTJpK9iHUkcp4oc6Nev4vna84P5BrisDjOkDvnv4eVfCVqB7SYUxGlHdnGi6nnwkLhx6kVZalRi0opdSYDkfk1/q1TCUaLDJp/cErMH/8ItLEJlWsSHuo/ccbkRaKBPvSGJPEKMqmzEJFjTjeUg9MJU3/4EC+NGvLVuoxMrt00WrcdERthVAnAgkbnxIhfbv9+PdjeeCzpWu7SOsHiXQr52xnrLX4VKcEiAXtwYa02kZYcv11ERkjyq7sCiNdcNK+9BXuAgcDcAHV2eXd3NE/qyKfxvTWaHk2esTlwMiH3zsd"
  image:
offer: UbuntuServer
publisher: Canonical
sku: '16.04-LTS'



Any pointer will be deeply 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/498fb4d5-7587-4a33-871e-db8524cb165a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_shell failing since Ansible 2.5 (?)

2018-03-26 Thread Jordan Borean
Sidenote: here is the PR to fix this issue 
https://github.com/ansible/ansible/pull/37968

-- 
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/ce12cc90-0e5d-4755-aca3-14c246963b74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.5 is not accepting dynamic hosts variable

2018-03-26 Thread rummandba
Hi,

I have upgraded to Ansible 2.5 right now and facing an issue with variable 
hosts such as:

---
- hosts: "{{ dbhosts }}"
 gather_facts: false
 vars_prompt:
 - name: dbhosts
 prompt: "Which hosts would you like to run?"
 private: no
 default: all

 tasks:
 - debug:
 var: hostvars


ERROR! The field 'hosts' has an invalid value, which includes an undefined 
variable. The error was: 'dbhosts' is undefined The error appears to have 
been in '/ansible/playbooks/tester.yaml': line 3, column 3, but may be 
elsewhere in the file depending on the exact syntax problem. The offending 
line appears to be: --- - hosts: "{{ dbhosts }}" ^ here We could be wrong, 
but this one looks like it might be an issue with missing quotes. Always 
quote template expression brackets when they start a value. For instance: 
with_items: - {{ foo }} 



The same playbook was running fine with Ansible 2.4.

Is there any specific change that I should follow in Ansible 2.5?

Please advise. 


Thanks & Regards.


-- 
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/4ac1d4db-20fe-4977-ab39-3ef783f46095%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_shell failing since Ansible 2.5 (?)

2018-03-26 Thread Jordan Borean
Thanks for the report, I am able to replicate this on 2.5 and have raised a 
Github issue for it https://github.com/ansible/ansible/issues/37967.

The issue is the path `C:\Program Files\WinZip` does not exist and the 
Test-AnsiblePath method is throwing a different exception in this case 
which we should be catching. If 'C:\Program Files\WinZip' did exist, then 
this would still continue to work but alas it isn't.

I know how to fix it but unfortunately we don't have a workaround apart 
either

* Creating the parent directory in a previous task
* Using a custom win_shell module that did not use 
Ansible.ModuleUtils.FileUtil or stay on the previous version until this is 
fixed.

Thanks

Jordan

-- 
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/c4dafdcf-a475-47d4-bb2c-5d91f713f02a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Error in a installation of CKAN through Ansible in a Ubuntu 14.04 virtual machine.

2018-03-26 Thread Andrea Dell'Amico
Run a task - as root - similar to

- name: Create the pip cache directory with the right permissions
  file: dest={{ ckan_libdir }}/.cache owner={{ ckan_shell_user }} group={{ 
ckan_shell_user }} state=directory

before using pip inside the ckan virtualenv

Best,
Andrea

> On 26 Mar 2018, at 18:49, Antonio Padez de Castro 
>  wrote:
> 
> Hi,
> 
> I'm trying to replicate an installation of CKAN through Ansible in a Ubuntu 
> 14.04 virtual machine.
> 
> But i have this error:
> ---
> # Ansible install/setup ckan
> 
> - hosts: localhost
>   become: true
> 
>   vars:
> my_package_url: http://packaging.ckan.org/python-ckan_2.6-trusty_amd64.deb
> site_url: http://www.mousetech.com/ckan
> tmpdir: '.'
> 
> # Note: site_url should come from environment! Change to your own CKAN site 
> url before.
> 
>   tasks:
> 
> - name: "FIX: Ubuntu 14.04 LTS doesn't come with certain modules, 
> required by ansible"
>   raw: sudo apt-get -y install aptitude
> 
> - name: Update OS
>   apt:
> upgrade: full
> 
> - name: Setup users
>   user: name=admin state=present
> 
> - name: Setup basic packages
>   apt: name={{ item }} state=installed
>   with_items:
> - nginx
> - apache2
> - libapache2-mod-wsgi
> - libpq5
> - wget
> - git
> - acl
> - python-psycopg2
> - python-pip
> - python-dev
> - postgresql
> - pgadmin3
> - libpq-dev
> - python-virtualenv
> - python-pastescript
> 
> - name: Download my_package
>   get_url: url="{{ my_package_url }}" dest="{{ tmpdir 
> }}/python-ckan_2.6-trusty_amd64.deb"
> #  when: vagrant_check_deb.rc == 1
> 
> - name: Install my_package
>   apt: deb="{{ tmpdir }}/python-ckan_2.6-trusty_amd64.deb"
>   become: true
> #  when: vagrant_check_deb.rc == 1
> 
> 
> #
> # PostgreSQL
> #
> 
> - name: PostgreSQL User
>   postgresql_user:
> name: ckan_default
> password: pass
> role_attr_flags: CREATEDB,NOSUPERUSER
>   become: yes
>   become_user: postgres
>   tags:
> - configuration
> 
> - name: PostgreSQL database
>   postgresql_db:
> name: ckan_default
>   become: yes
>   become_user: postgres
> 
> - name: Apache solr
>   apt: name={{ item }} state=installed
>   with_items:
> - solr-jetty
> - libjetty-extra
> - libjetty-extra-java
> - libtomcat7-java
> 
> - name: Jetty configuration
>   lineinfile:
> dest: /etc/default/jetty
> state: present
> regexp: "{{ item.re }}"
> line: "{{ item.line }}"
>   with_items:
> - { re: 'NO_START', line: 'NO_START=0' }
> - { re: 'JETTY_HOST', line: 'JETTY_HOST=127.0.0.1' }
> - { re: 'JETTY_PORT', line: 'JETTY_PORT=8983' }
> 
> - name: Start jetty
>   service:
> name: jetty
> enabled: yes
> 
> - name: Backup solar config
>   become: true
>   command: 'mv /etc/solr/conf/schema.xml 
> /etc/solr/conf/schema.xml.bak'
> 
> - name: Setup xml schema
>   file:
> src: /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml
> dest: /etc/solr/conf/schema.xml
> state: link
> 
> - name: Restart jetty
>   service:
> name: jetty
> state: restarted
> 
> #
> # Database setup
> #
> 
> - name: CKAN configuration
>   ini_file:
> dest: /etc/ckan/default/production.ini
> section: 'app:main'
> option: "{{ item.id }}"
> value: "{{item.value }}"
>   with_items:
> - { id: 'ckan.site_id', value: 'default' }
> - { id: 'ckan.site_url', value: '{{ site_url }}' }
> 
> #
> # Plugins
> #
> 
> 
> - name: CKAN plugin for spatial_query
>   lineinfile:
> dest: /etc/ckan/default/production.ini
> state: present
> regexp: '^(ckan\.plugins)((?!.*\Wresource_proxy\W).*)$'
> line: '\1\2 resource_proxy'
> backrefs: yes
>   tags:
> - config
> 
> - include: datastore.yml
> - include: pdfview.yml
> - include: spatial.yml
> - include: geoview.yml
> - include: harvest.yml
> 
> #

[ansible-project] Re: Ansible vs Ansible Tower ?

2018-03-26 Thread sdoran
A node is a host in inventory that is managed by Tower.

-- 
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/5a9435f8-967d-40d3-b751-d1b4bf5e1b52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Error in a installation of CKAN through Ansible in a Ubuntu 14.04 virtual machine.

2018-03-26 Thread Antonio Padez de Castro
Hi,

I'm trying to replicate an installation of CKAN through Ansible in a Ubuntu 
14.04 virtual machine.

But i have this error: 
---
# Ansible install/setup ckan

- hosts: localhost
  become: true

  vars:
my_package_url: 
http://packaging.ckan.org/python-ckan_2.6-trusty_amd64.deb
site_url: http://www.mousetech.com/ckan 
tmpdir: '.'

# Note: site_url should come from environment! Change to your own CKAN site 
url before.

  tasks:

- name: "FIX: Ubuntu 14.04 LTS doesn't come with certain modules, 
required by ansible"
  raw: sudo apt-get -y install aptitude

- name: Update OS
  apt:
upgrade: full

- name: Setup users
  user: name=admin state=present

- name: Setup basic packages
  apt: name={{ item }} state=installed
  with_items:
- nginx
- apache2
- libapache2-mod-wsgi
- libpq5
- wget
- git
- acl
- python-psycopg2
- python-pip
- python-dev
- postgresql
- pgadmin3
- libpq-dev
- python-virtualenv
- python-pastescript

- name: Download my_package
  get_url: url="{{ my_package_url }}" dest="{{ tmpdir 
}}/python-ckan_2.6-trusty_amd64.deb"
#  when: vagrant_check_deb.rc == 1

- name: Install my_package
  apt: deb="{{ tmpdir }}/python-ckan_2.6-trusty_amd64.deb"
  become: true
#  when: vagrant_check_deb.rc == 1


#
# PostgreSQL
#

- name: PostgreSQL User
  postgresql_user:
name: ckan_default
password: pass
role_attr_flags: CREATEDB,NOSUPERUSER
  become: yes
  become_user: postgres
  tags:
- configuration

- name: PostgreSQL database
  postgresql_db:
name: ckan_default
  become: yes
  become_user: postgres

- name: Apache solr
  apt: name={{ item }} state=installed
  with_items:
- solr-jetty
- libjetty-extra
- libjetty-extra-java
- libtomcat7-java

- name: Jetty configuration
  lineinfile:
dest: /etc/default/jetty
state: present
regexp: "{{ item.re }}"
line: "{{ item.line }}"
  with_items:
- { re: 'NO_START', line: 'NO_START=0' }
- { re: 'JETTY_HOST', line: 'JETTY_HOST=127.0.0.1' }
- { re: 'JETTY_PORT', line: 'JETTY_PORT=8983' }
  
- name: Start jetty
  service:
name: jetty
enabled: yes

- name: Backup solar config
  become: true
  command: 'mv /etc/solr/conf/schema.xml 
/etc/solr/conf/schema.xml.bak'

- name: Setup xml schema
  file:
src: /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml
dest: /etc/solr/conf/schema.xml
state: link

- name: Restart jetty
  service:
name: jetty
state: restarted

#
# Database setup
#

- name: CKAN configuration
  ini_file:
dest: /etc/ckan/default/production.ini
section: 'app:main'
option: "{{ item.id }}"
value: "{{item.value }}"
  with_items:
- { id: 'ckan.site_id', value: 'default' }
- { id: 'ckan.site_url', value: '{{ site_url }}' }

#
# Plugins
#


- name: CKAN plugin for spatial_query
  lineinfile:
dest: /etc/ckan/default/production.ini
state: present
regexp: '^(ckan\.plugins)((?!.*\Wresource_proxy\W).*)$'
line: '\1\2 resource_proxy'
backrefs: yes
  tags:
- config

- include: datastore.yml
- include: pdfview.yml
- include: spatial.yml
- include: geoview.yml
- include: harvest.yml

#
# Init databases and restart servers
#

- hosts: localhost
  tasks:   
- name: CKAN initialize database
  become: true
  command: 'ckan db init'


- name: Install CKAN API
  pip:
name: ckanapi
virtualenv: /usr/lib/ckan/default
  become: true

- name: Restart apache
  service:
name: apache2
state: restarted

- name: Restart nginx
  service:
name: nginx
state: restarted

But i have this error:

TASK [Install Spat

[ansible-project] Re: Ansible vs Ansible Tower ?

2018-03-26 Thread digi691
Ansible Tower's upstream opensource project is called AWX.  If you don't 
want to pay for support you can always go AWX instead of Ansible 
Tower.  https://github.com/ansible/awx



On Thursday, March 22, 2018 at 11:05:37 AM UTC-5, Albert Shamsiyan wrote:
>
> Thx for the reply sdoran
>
> So using Ansible is for free and I'll licensing for using Tower for more 
> than 10 nodes? if so, what will be the definition if node ?? 
>
>

-- 
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/d9ad4b18-5fad-4d06-a9a4-d0e13e57ddbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable gets registered even if when clause is false

2018-03-26 Thread Marcos Alano
Nevermind. (:

On Mon, Mar 26, 2018, 1:04 PM Marcos Alano  wrote:

> What the value of 'now' variable?
>
> On Mon, Mar 26, 2018, 1:01 PM MKPhil  wrote:
>
>> In a playbook, a Variable gets registered even if "when" clause is
>> false...Is this a bug?
>>
>> Consider this playbook
>>
>> ---
>> - name: When test
>>   gather_facts: false
>>   hosts: all
>>   vars:
>> now: true
>>   tasks:
>> - name: Get hostname
>>   shell: hostname
>>   register: output
>>   when: now == true
>>
>>
>> - name: Get user
>>   shell: whoami
>>   register: output
>>   when: now != true
>>
>> - debug:
>> var: output
>>
>>
>> What should be the output?
>> Logically, I believe it should be the result of the first play:
>>
>>
>> PLAY [When test]
>> 
>>
>> TASK [Get hostname]
>> *
>> changed: [localhost]
>>
>> TASK [debug]
>> 
>> ok: [localhost] => {
>> "changed": false,
>> "output": {
>> "changed": true,
>> "cmd": "hostname",
>> "delta": "0:00:00.003747",
>> "end": "2018-03-26 16:55:48.727647",
>> "rc": 0,
>> "start": "2018-03-26 16:55:48.723900",
>> "stderr": "",
>> "stderr_lines": [],
>> "stdout": "server01",
>> "stdout_lines": [
>> "server01"
>> ]
>> }
>> }
>>
>> PLAY RECAP
>> 
>> localhost  : ok=2changed=1unreachable=0
>> failed=0
>>
>>
>>
>> What I actually get is:
>>
>> PLAY [When test]
>> ***
>>
>> TASK [Get hostname]
>> 
>> changed: [localhost]
>>
>> TASK [Get user]
>> 
>> skipping: [localhost]
>>
>> TASK [debug]
>> ***
>> ok: [localhost] => {
>> "changed": false,
>> "output": {
>> "changed": false,
>> "skip_reason": "Conditional result was False",
>> "skipped": true
>> }
>> }
>>
>> PLAY RECAP
>> ***
>> localhost  : ok=2changed=1unreachable=0
>> failed=0
>>
>>
>> Or am I misunderstanding something?
>>
>> --
>> 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/139ab0b4-8371-403d-9ebb-5ee119c8ebdf%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/CAO3Us%3DmqmXm8j3rBgp8wdxE1z2M_iKDCgDbcx%3DgLxwFX069O8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable gets registered even if when clause is false

2018-03-26 Thread Marcos Alano
What the value of 'now' variable?

On Mon, Mar 26, 2018, 1:01 PM MKPhil  wrote:

> In a playbook, a Variable gets registered even if "when" clause is
> false...Is this a bug?
>
> Consider this playbook
>
> ---
> - name: When test
>   gather_facts: false
>   hosts: all
>   vars:
> now: true
>   tasks:
> - name: Get hostname
>   shell: hostname
>   register: output
>   when: now == true
>
>
> - name: Get user
>   shell: whoami
>   register: output
>   when: now != true
>
> - debug:
> var: output
>
>
> What should be the output?
> Logically, I believe it should be the result of the first play:
>
>
> PLAY [When test]
> 
>
> TASK [Get hostname]
> *
> changed: [localhost]
>
> TASK [debug]
> 
> ok: [localhost] => {
> "changed": false,
> "output": {
> "changed": true,
> "cmd": "hostname",
> "delta": "0:00:00.003747",
> "end": "2018-03-26 16:55:48.727647",
> "rc": 0,
> "start": "2018-03-26 16:55:48.723900",
> "stderr": "",
> "stderr_lines": [],
> "stdout": "server01",
> "stdout_lines": [
> "server01"
> ]
> }
> }
>
> PLAY RECAP
> 
> localhost  : ok=2changed=1unreachable=0failed=0
>
>
>
> What I actually get is:
>
> PLAY [When test]
> ***
>
> TASK [Get hostname]
> 
> changed: [localhost]
>
> TASK [Get user]
> 
> skipping: [localhost]
>
> TASK [debug]
> ***
> ok: [localhost] => {
> "changed": false,
> "output": {
> "changed": false,
> "skip_reason": "Conditional result was False",
> "skipped": true
> }
> }
>
> PLAY RECAP
> ***
> localhost  : ok=2changed=1unreachable=0failed=0
>
>
> Or am I misunderstanding something?
>
> --
> 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/139ab0b4-8371-403d-9ebb-5ee119c8ebdf%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/CAO3Us%3Dkccc4G-nDmRBAWk0k_6PvB8SFnrQMzHqbf3%2BRJZda%3D9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable gets registered even if when clause is false

2018-03-26 Thread Brian Coca
The when: clause affects task execution, while register: puts into a
variable the status and output of a task.

So 'skipped' is a 'valid status of a task', which is what then is put
into the registered variable, this way subsequent tasks can do this:

when: registeredvar is skipped

to execute another task when previous one is skipped (or not + other
conditions).


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


[ansible-project] Variable gets registered even if when clause is false

2018-03-26 Thread MKPhil
In a playbook, a Variable gets registered even if "when" clause is 
false...Is this a bug?

Consider this playbook

---
- name: When test
  gather_facts: false
  hosts: all
  vars:
now: true
  tasks:
- name: Get hostname
  shell: hostname
  register: output
  when: now == true


- name: Get user
  shell: whoami
  register: output
  when: now != true

- debug:
var: output


What should be the output?
Logically, I believe it should be the result of the first play:


PLAY [When test] 


TASK [Get hostname] 
*
changed: [localhost]

TASK [debug] 

ok: [localhost] => {
"changed": false,
"output": {
"changed": true,
"cmd": "hostname",
"delta": "0:00:00.003747",
"end": "2018-03-26 16:55:48.727647",
"rc": 0,
"start": "2018-03-26 16:55:48.723900",
"stderr": "",
"stderr_lines": [],
"stdout": "server01",
"stdout_lines": [
"server01"
]
}
}

PLAY RECAP 

localhost  : ok=2changed=1unreachable=0failed=0



What I actually get is:

PLAY [When test] 
***

TASK [Get hostname] 

changed: [localhost]

TASK [Get user] 

skipping: [localhost]

TASK [debug] 
***
ok: [localhost] => {
"changed": false,
"output": {
"changed": false,
"skip_reason": "Conditional result was False",
"skipped": true
}
}

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


Or am I misunderstanding something?

-- 
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/139ab0b4-8371-403d-9ebb-5ee119c8ebdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Environment variables unavaiable

2018-03-26 Thread Kai Stian Olstad

On 26.03.2018 15:24, Martin Simovic wrote:

Yes, still according to man pages /bin/sh started as login shell should
source /etc/profile (as it does on e.g. CENTOS)


As I wrote in my first reply since Ansible is just executing a 
command(s), it doesn't use login shell/interactive shell, it uses 
non-interactive shell.


The same as this that will run env in a non-interactive shell
ssh user@host env

So that is why non of the profile files is being read, so you need to 
use /etc/environment or make a hack yourself.


What Centos does I don't know since I don't use it.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ba780ae474dec00964d650488050ff59%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dynamic Inventory and Openstack: how to cache ?

2018-03-26 Thread Ilyes Semlali
Any suggestions on where to find some documentation on "the config there" ? 
I've looked through a few source code to check which key to add to 
my /etc/ansible/openstack.yml file. 
All I could find was 
: https://github.com/ansible/ansible/blob/devel/contrib/inventory/openstack.yml
I really need to cache my inventory, my cloud provider has set an 
unlimitted timeout when he blacklists IPs that perform too much requests on 
keystone. 

Thank's in advance for you answer 

Le vendredi 10 février 2017 04:01:17 UTC+1, Brian Coca a écrit :
>
> The openstack libraries control the caching, look at the config there. 
>
>
> -- 
> 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/2098cafe-26ed-4db1-8c7f-e9a0fb58a930%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dynamic Inventory and Openstack: how to cache ?

2018-03-26 Thread Ilyes Semlali
Any suggestions on where to find some documentation on "the config there" ? 
I've looked through a few source code to check which key to add to 
my /etc/ansible/openstack.yml file. 
All I could find was : 
I really need to cache my inventory, my cloud provider has set an 
unlimitted timeout when he blacklists IPs that perform too much requests on 
keystone. 

Thank's in advance for you answer 

Le vendredi 10 février 2017 04:01:17 UTC+1, Brian Coca a écrit :
>
> The openstack libraries control the caching, look at the config there. 
>
>
> -- 
> 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/fc286986-682b-418c-b055-825c42c40a81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] expect module works but hangs

2018-03-26 Thread 'Daley Okuwa' via Ansible Project

Other recipients: 
Hello, I have a playbook here which seems to do what it needs to do but 
hangs It actually copies the file using ftp but cannot find a way to exit 
out of the program --- - name: backup of juniper using expect hosts: 
juniper connection: local 
Hello,

I have a playbook here which seems to do what it needs to do but hangs 
It actually copies the file using ftp  but cannot find a way to exit out of 
the program

---
- name: backup of juniper using expect
  hosts: juniper
  connection: local
  tasks:
   - name: copy running config to ftp server
 expect:
  command: ssh admin@10.101.250.41
  responses:
Password: x#
admin@POD1_SRX210>: file copy /config/juniper.conf.49.gz 
ftp://ansible:xx@10.241.11.237/juniper.conf.49.gz
ftp://ansible:test123@10.241.11.237/juniper.co100% of 1024  B   84 
kBps\nadmin@POD1_SRX210>: exit

OUTPUT


ansible@ansible-new:/etc/ansible$ ansible-playbook -i hosts 
backup-juniper-expect.yml  -vvv
ansible-playbook 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
[u'/home/ansible/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
20160609]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
PLAYBOOK: backup-juniper-expect.yml 

1 plays in backup-juniper-expect.yml
PLAY [backup of juniper using expect] 
**
TASK [Gathering Facts] 
*
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<10.201.250.41> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<10.201.250.41> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.201.250.41> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676 `" && 
echo ansible-tmp-1521801893.62-242955740702676="` echo 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676 `" ) 
&& sleep 0'
<10.201.250.41> PUT /tmp/tmpc6YMbQ TO 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676/setup.py
<10.201.250.41> EXEC /bin/sh -c 'chmod u+x 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676/ 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676/setup.py 
&& sleep 0'
<10.201.250.41> EXEC /bin/sh -c '/usr/bin/python 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676/setup.py; 
rm -rf 
"/home/ansible/.ansible/tmp/ansible-tmp-1521801893.62-242955740702676/" > 
/dev/null 2>&1 && sleep 0'
ok: [10.201.250.41]
META: ran handlers
TASK [copy running config to ftp server] 
***
task path: /etc/ansible/backup-juniper-expect.yml:7
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/commands/expect.py
<10.201.250.41> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<10.201.250.41> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.201.250.41> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765 `" && 
echo ansible-tmp-1521801893.94-111637507774765="` echo 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765 `" ) 
&& sleep 0'
<10.201.250.41> PUT /tmp/tmpamRP0L TO 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765/expect.py
<10.201.250.41> EXEC /bin/sh -c 'chmod u+x 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765/ 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765/expect.py 
&& sleep 0'
<10.201.250.41> EXEC /bin/sh -c '/usr/bin/python 
/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765/expect.py; 
rm -rf 
"/home/ansible/.ansible/tmp/ansible-tmp-1521801893.94-111637507774765/" > 
/dev/null 2>&1 && sleep 0'
^CProcess WorkerProcess-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in 
_bootstrap
self.run()
  File 
"/usr/lib/python2.7/dist-packages/ansible/executor/process/worker.py", line 
118, in run
self._rslt_q
  File 
"/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 
130, in run
res = self._execute()
  File 
"/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 
528, in _execute
result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/normal.py", 
line 45, in run
results = merge_hash(results, self._execute_module(tmp=tmp, 
task_vars=task_vars, wrap_async=wrap_async))
  File 
"/usr/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 
740, in _execute_module
res = self._low_level_execute_command(cmd, sudoable=sudoable, 
in_data=in_data)
  File 
"/usr/li

Re: [ansible-project] Environment variables unavaiable

2018-03-26 Thread Martin Simovic
Yes, still according to man pages /bin/sh started as login shell should 
source /etc/profile (as it does on e.g. CENTOS)

On Monday, 26 March 2018 13:44:31 UTC+2, Kai Stian Olstad wrote:
>
> On 26.03.2018 12:10, Martin Simovic wrote: 
> > However, this is happening when I use command module with args: 
> > executable=/bin/bash too. This kind of rules the dash theory out. 
> > It is almost like /etc/profile is ignored in any case. 
>
> bash working the same as dash in this aspect. 
>
>
> > Still, on Centos/Sles it is sourced regardless of /bin/sh or /bin/bash 
> > use 
> > (I know that /bin/sh is symlink to /bin/bash on those distributions) 
>
> bash has a posix mode is uses when bash is started with name sh, this 
> mode behave differently. 
> It's documented in the man pages. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0e41d48b-e1ea-45e6-aa63-5043c703be01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Environment variables unavaiable

2018-03-26 Thread Kai Stian Olstad

On 26.03.2018 12:10, Martin Simovic wrote:

However, this is happening when I use command module with args:
executable=/bin/bash too. This kind of rules the dash theory out.
It is almost like /etc/profile is ignored in any case.


bash working the same as dash in this aspect.


Still, on Centos/Sles it is sourced regardless of /bin/sh or /bin/bash 
use

(I know that /bin/sh is symlink to /bin/bash on those distributions)


bash has a posix mode is uses when bash is started with name sh, this 
mode behave differently.

It's documented in the man pages.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9955ddb2fb4d831a8aafcb223115f933%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] win_shell failing since Ansible 2.5 (?)

2018-03-26 Thread Jeremie Levy
My playbook is broken since i upgraded to v2.5

Here is the simplest example i have:

The code from my playbook:
- name: Install Winzip Package
  win_shell: 'cmd /C C:\Users\ansible\Downloads\install_winzip.cmd'
  args:
creates: 'C:\Program Files\WinZip\WINZIP64.EXE'


Here is the output:
TASK [common : Install Winzip Package] 
*
task path: /ansible/scripts/roles/common/tasks/winzip.yml:11

  
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/windows/win_shell.ps1  

  
 ESTABLISH WINRM CONNECTION FOR USER: ansible@DOMAIN on 
PORT 5986 TO hasgqba011.DOMAIN   
checking if winrm_host hasgqba011.DOMAIN is an IPv6 address

 
creating Kerberos CC at /tmp/tmpg3ejrJ  


calling kinit with subprocess for principal ansible@DOMAIN  


kinit succeeded for principal ansible@DOMAIN


 WINRM CONNECT: transport=kerberos 
endpoint=https://hasgqba011.DOMAIN:5986/wsman  
   
 WINRM OPEN SHELL: CCE2248A-9096-4242-B51C-9A1911DBBEE9  


EXEC (via pipeline wrapper)

 
 WINRM EXEC 'PowerShell' ['-NoProfile', 
'-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-']
  
 WINRM RESULT u''
   
 WINRM CLOSE SHELL: 
CCE2248A-9096-4242-B51C-9A1911DBBEE9
 
fatal: [hasgqba011.DOMAIN]: FAILED! => {


"changed": false,  

 
"module_stderr": "Test-AnsiblePath : Exception calling 
\"GetAttributes\" with \"1\" argument(s): \"Could not find a part of the 
path \r\n'C:\\Program Files\\WinZip\\WINZIP64.EXE'.\"\r\nAt line:59 
char:21\r\n+ if ($creates -and $(Test-AnsiblePath -Path $creates)) {\r\n+  
   ~~~\r\n+ CategoryInfo
  : NotSpecified: (:) [Test-AnsiblePath], 
MethodInvocationException\r\n+ FullyQualifiedErrorId : 
DirectoryNotFoundException,Test-AnsiblePath\r\n \r\n\r\n",  

"module_stdout": "",


"msg": "MODULE FAILURE",


"rc": 1

 
}  
  

I want to install winzip if the file winzip64.exe is not found, and it 
fails because it's not found.
Removing the args/creates lines --> works like a charm.

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/0a363c6b-3c50-4a43-9352-1c56b83cef26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Environment variables unavaiable

2018-03-26 Thread Martin Simovic
Thank you Kai for your quick answer.

However, this is happening when I use command module with args: 
executable=/bin/bash too. This kind of rules the dash theory out.
It is almost like /etc/profile is ignored in any case. 

Still, on Centos/Sles it is sourced regardless of /bin/sh or /bin/bash use 
(I know that /bin/sh is symlink to /bin/bash on those distributions)

?

On Monday, 26 March 2018 12:02:35 UTC+2, Kai Stian Olstad wrote:
>
> On 26.03.2018 11:31, Martin Simovic wrote: 
> > I am observing following behaviour using ansible on set of Ubuntu-1604, 
> > SLES-12 and CentOS-7 hosts. 
> > 
> > Environment variables, normally avaiable for login shell (/bin/bash) 
> > are 
> > not avaiable via ansible "setup" or "shell" modules for Ubuntu-16.04. 
> > Yet 
> > the same variables (defined in /etc/profile) are available for both 
> > these 
> > modules for SLES and CentOS distributions. 
> > 
> > Seems as if ansible run shell as login shell for Sles and Centos, and 
> > non-login shell for Ubuntu. This inconsistency is killing me. Anyone 
> > came 
> > across this? Possible solution? 
>
> This is normal in Debian and its derivatives. 
> Ansible is using /bin/sh that is symlink to dash. 
>
> The dash shell has to mode like most other shell, interactive and 
> non-interactive and the /etc/profile is only read in interactive shell 
> mode. 
> But since Ansible is not logging in, it just run a command it uses 
> non-interactive that file is not read. 
>
> For more information check man dash search for Invocation. 
>
> You need to use /etc/environment but remember that this file doesn't 
> support variable expansion. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b0a1e3f1-7760-4322-8e59-8b450240a2d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Environment variables unavaiable

2018-03-26 Thread Kai Stian Olstad

On 26.03.2018 11:31, Martin Simovic wrote:

I am observing following behaviour using ansible on set of Ubuntu-1604,
SLES-12 and CentOS-7 hosts.

Environment variables, normally avaiable for login shell (/bin/bash) 
are
not avaiable via ansible "setup" or "shell" modules for Ubuntu-16.04. 
Yet
the same variables (defined in /etc/profile) are available for both 
these

modules for SLES and CentOS distributions.

Seems as if ansible run shell as login shell for Sles and Centos, and
non-login shell for Ubuntu. This inconsistency is killing me. Anyone 
came

across this? Possible solution?


This is normal in Debian and its derivatives.
Ansible is using /bin/sh that is symlink to dash.

The dash shell has to mode like most other shell, interactive and 
non-interactive and the /etc/profile is only read in interactive shell 
mode.
But since Ansible is not logging in, it just run a command it uses 
non-interactive that file is not read.


For more information check man dash search for Invocation.

You need to use /etc/environment but remember that this file doesn't 
support variable expansion.



--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/048ff6ea8fa4d293ddbf4f962a8eee45%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Environment variables unavaiable

2018-03-26 Thread Martin Simovic
Hi,

I am observing following behaviour using ansible on set of Ubuntu-1604, 
SLES-12 and CentOS-7 hosts.

Environment variables, normally avaiable for login shell (/bin/bash) are 
not avaiable via ansible "setup" or "shell" modules for Ubuntu-16.04. Yet 
the same variables (defined in /etc/profile) are available for both these 
modules for SLES and CentOS distributions.

Seems as if ansible run shell as login shell for Sles and Centos, and 
non-login shell for Ubuntu. This inconsistency is killing me. Anyone came 
across this? Possible solution?

Many Thanks
Martin.

-- 
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/41ff76ad-688e-4990-b09f-fd150f15fec2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible remote installation of SQL server 2016.

2018-03-26 Thread 12177589
After installing CredSSP, ansible can access Windows via the domain user, 
but it will fail in ansible tower.
Error: CredSSP: requests auth method is CredSSP, but requests- CredSSP is 
not installed.

在 2018年3月23日星期五 UTC+8下午6:23:23,Jordan Borean写道:
>
> The docs should be more explicit, you don't need to specify a certificate 
> thumbprint, it will use a random one generated each time the host starts. 
> Those docs are only there if you wanted to set an explicit cert but that 
> isn't required for CredSSP. The reason why it failed to connect is you need 
> to set ansible_password not ansible_pass, the error message is complaining 
> no password was set.
>
> In this case, mentioned that CredSSP has client and server, Do I need to 
>> configure it?
>>
>
> No you only need to configure the server components, the client side is if 
> you are using that WIndows host to connect to another host with CredSSP. 
> Because you are just using Ansible to Windows, only the server side is 
> needed.
>
> Thanks
>
> Jordan 
>

-- 
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/9d092065-1762-4bf4-93ab-765737dad79c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] current run timestamp

2018-03-26 Thread Kai Stian Olstad

On 20.03.2018 23:27, orderedchaos...@gmail.com wrote:
I want to set it up so there is a current ansible playbook run 
timestamp

set at the start of every playbook run so I can use this var in various
roles.
The only way so far I have found is to set a pre_task with set fact in
every playbook.
Does anyone have any suggestions or information on a current playbook 
run

start timestamp or a way to set this var so that I dont need to add the
set_fact to every playbook?


You always have access to the hostvars['localhost'].ansible_date_time

You also have this variable on every host if you gather facts, since 
facts is gathered at different times that time will differ between host, 
but the one on localhost is consistent through the run.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d07917bc108a3b7691647f9e27be0e80%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Command timeout adjustment in 2.5 with new network modules?

2018-03-26 Thread 'Scott Pettit' via Ansible Project
Hello,

I have a number of network tasks that take a long time to run, for example 
firmware update tasks. In Ansible 2.4 I extended the command_timeout by 
using the timeout variable on an individual task basis per 
https://docs.ansible.com/ansible/2.5/network/user_guide/network_debug_troubleshooting.html

*Option 2: Increase command timeout per task basis. All network modules 
support a timeout value that can be set on a per task basis. The timeout 
value controls the amount of time in seconds before the task will fail if 
the command has not returned.*

This doesn't seem to be the case in Ansible 2.5 once you move to the new 
network_cli connection type as the provider options go away and Ansible 
throws an error that you're trying to set the timeout variable, but can't.

I don't want to globally adjust the command_timeout in ansible.cfg as that 
has other implications when I'm hitting several hundred devices at once and 
they aren't always available, so timing out quickly is a correct outcome.

I can workaround the issue by using export 
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=xxx prior to running the playbooks I 
know need additional time, but what's the correct way to adjust the command 
timeout on a per task basis in Ansible 2.5?

-Scott

-- 
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/5a5a5d44-7375-498b-ba3a-290745b568b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible issues with Windows deployment

2018-03-26 Thread 12177589
I changed the playbook file to the following, no longer error, but the 
execution has been stuck in the win_shell step, why?

- hosts: dbServer

  tasks:
- win_shell: "New-PSDrive -Name temp_path -PSProvider FileSystem -Root 
'192.168.227.198\\Microsoft SQL Server' -Credential New-Object 
-TypeName PSCredential -ArgumentList 'administrator', 
ConvertTo-SecureString -String 'Test123' -AsPlainText -Force -Scope Script
Copy-Item -Path 'temp_path:\\130' -Destination C:\\tools -Recurse"
  register: result

- debug:
  var: result
  verbosity: 2




在 2018年3月21日星期三 UTC+8上午11:12:59,Jordan Borean写道:
>
> You pretty much need to copy the win_shell task as it was (with any 
> credential or path changes you need). You also don't need the win_copy 
> tasks as the win_shell task will do that for you, I only provided that 
> example to show you how it is easier to use become when 2.5 comes out.
>
> In the future, when you say there are errors, please provide those errors 
> itself as it makes it easier to see what is going on.
>
> Thanks
>
> Jordan
>

-- 
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/9f4a503f-1fd7-4eb0-9181-ed2db598fcde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.