[ansible-project] Variable precedence change/fix coming in 2.3

2017-02-28 Thread James Cammarata
Hi all, just wanted to write about a fix/change I'll be merging into the
devel branch soon (ie. as soon as the AWS outage quits impacting our
testing infrastructure), which means it will be included in the 2.3.0
release.

Per our variable precedence docs (
http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable),
the variables provided by the inventory script or INI file are supposed to
be lower priority than those found in group_vars and host_vars files,
however this has not been the case in 2.0 and it has gone unnoticed thus
far.

While fixing this to match our documentation however, we realized that the
precedence docs had a problem - variables defined on the host in the
script/INI file would in fact have lower precedence than those in
group_vars/all (or any group_vars files). We've decided to fix this based
on the following rules for inventory:

1) Host Vars > Group Vars
2) Things relative to the playbook > Things relative to the inventory >
Things defined in inventory

For those who are unfamiliar with the second point above, it is possible to
have host/group vars files defined relative to both the playbook and to the
inventory. For example, if you have:

playbook/site.yml
playbook/group_vars/all
inventory/hosts
inventory/group_vars/all

And you run:

$ ansible-playbook -i inventory/hosts playbook/site.yml

the variables in playbook/group_vars/all will "win" over those in
inventory/group_vars/all.

Prior to this change, if you had something like:

ansible_connection: local

In any group_vars/all file, it would have "won" over anything defined in
the inventory script, even if you did something like:

myhost ansible_connection=paramiko

the value in the group_vars would have been the value used, which is
counter-intuitive.

If anyone has any questions regarding this change, please let us know.

Thanks!

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

-- 
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/CAMFyvFgMtr%2B4dYEpZ%2BqCjPXfRf%3DEDdK%3DN3L1RubgRZORJfTbvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Help with ios_config and login banner

2017-02-28 Thread Len Tucker
I am having a timeout issue with ios_config and login banners. The playbook 
times out. Any help or examples of a working config would be appreciated. 

adminlen@len-nm-1:~/ansible$ ansible --version
ansible 2.3.0
  config file = /home/adminlen/ansible/ansible.cfg
  configured module search path = Default w/o overrides


ansible$ cat router-login-banner.yml

hosts: testsitehsrp1
gather_facts: no
connection: local

tasks:
name: Set motd and alias commands for dsl
ios_config:
username: adminlen
save: yes
src: /home/adminlen/ansible/router-login-banner-test

adminlen@len-nm-1:~/ansible$ cat router-login-banner-test
banner login @

test login
banner

@

adminlen@len-nm-1:~/ansible$ ansible-playbook -vvv router-login-banner.yml 
--ask-pass
Using /home/adminlen/ansible/ansible.cfg as config file
SSH password:

PLAYBOOK: router-login-banner.yml 
***
1 plays in router-login-banner.yml

PLAY [testsitehsrp1] 

META: ran handlers

TASK [Set motd and alias commands for dsl] 
**
task path: /home/adminlen/ansible/router-login-banner.yml:7
Using module file 
/usr/local/lib/python2.7/dist-packages/ansible-2.3.0-py2.7.egg/ansible/modules/network/ios/ios_config.py
<10.100.80.2> ESTABLISH LOCAL CONNECTION FOR USER: adminlen
<10.100.80.2> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.100.80.2> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534" && 
echo ansible-tmp-1487961451.38-133078886647534="echo 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534" ) && 
sleep 0'
<10.100.80.2> PUT /tmp/tmpIbJY6x TO 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534/ios_config.py
<10.100.80.2> EXEC /bin/sh -c 'chmod u+x 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534/ 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534/ios_config.py
 
&& sleep 0'
<10.100.80.2> EXEC /bin/sh -c '/usr/bin/python 
/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534/ios_config.py;
 
rm -rf 
"/home/adminlen/.ansible/tmp/ansible-tmp-1487961451.38-133078886647534/" > 
/dev/null 2>&1 && sleep 0'
fatal: [testsitehsrp1]: FAILED! => {
"changed": false,
"command": "banner login @",
"failed": true,
"invocation": {
"module_args": {
"after": null,
"auth_pass": null,
"authorize": null,
"backup": false,
"before": null,
"config": null,
"defaults": false,
"force": false,
"host": null,
"lines": null,
"match": "line",
"multiline_delimiter": "@",
"parents": null,
"password": null,
"port": null,
"provider": null,
"replace": "line",
"save": true,
"src": "banner login @ \n\ntest login\nbanner\n\n@\n\n",
"ssh_keyfile": null,
"timeout": null,
"username": "adminlen"
}
},
"msg": "timeout trying to send command: banner login @",
"rc": 1
}
to retry, use: --limit @/home/adminlen/ansible/router-login-banner.retry

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

-- 
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/c1db20c0-5a63-4bc6-8a0b-d1939357fd4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible-pull, and upgrading ansible

2017-02-28 Thread Stephen Tan
Hi all

I have an interesting situation which I think the very clever people here 
could probably help me with.

Our use case for ansible:

- We use ansible pull which runs a local connection. It allows us to scale 
nicely without the need for a master host.
- ansible pull is set in a cron job that runs every hour locally
- We want to be able to upgrade ansible in place ( the best practice is to 
nuke our current machine and replace with a fresh packer based image but 
sometimes that's not the available solution )
- If we do this with ansible, then ansible will shoot itself in the head - 
a chicken and egg situation

Basically, I'm asking - are there any best practices that someone can 
recommend for upgrading ansible using ansible? 

- Perhaps there is some cunning way using vitualenv?
- Or we can get ansible to trigger it's own upgrade using cron or some 
other mechanism? ( The problem is then if ansible is running when this job 
is run . )

There is huge kudos for the people with a nice clean, elegant solution! :)

many thanks in advance

Stephen

-- 
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/1cf93a14-7531-4496-b932-7070f91498ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Windows Working Group IRC meetings

2017-02-28 Thread Greg DeKoenigsberg
w00t

thanks matt :)

On Tue, Feb 28, 2017 at 2:52 PM, Matt Davis  wrote:
> We're pleased to announce that the Ansible Windows Working Group will begin
> biweekly IRC meetings in the Freenode #ansible-meeting channel on March
> 13/14, 2017 (depending on your time zone). This will be a regular developer
> forum to discuss and guide the overall direction of Ansible's support for
> managing Windows hosts, as well as to talk over specific pull requests and
> feature ideas. As with all Ansible working groups, the intent is to keep the
> meetings development-focused, so support questions and other discussion will
> be redirected to the public #ansible IRC channel and mailing list.
>
> In an attempt to accommodate the wide home-timezone range of Ansible Windows
> contributors, we're initially scheduling the meetings to occur every other
> week, on Monday afternoons and Friday mornings (Pacific Time). More details,
> including calendar, agenda links, and minutes, can be found at
> https://github.com/ansible/community/blob/master/MEETINGS.md.
>
> This has been a long time coming- we're looking forward to engaging with the
> community in a more regular and realtime fashion. Hope to see you there!
>
> - Matt Davis, Principal Software Engineer, Ansible Core / Red Hat
>
> --
> 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/26d12852-98dd-456a-a16b-86b112fb813f%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Greg DeKoenigsberg
Ansible Community 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/CAM1FbhGimu9k%2BUv1Hd-LSAoi3Z6rB4GrtGVUQAhqsMNoN%2BgmjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible shell calling maven exec fails

2017-02-28 Thread g . roberts
Thanks Kai

Is there anyway to get the user's env?

On Tuesday, February 28, 2017 at 11:33:02 AM UTC-5, Kai Stian Olstad wrote:
>
> On 28. feb. 2017 15:38, g.ro...@prometheuscomputing.com  
> wrote: 
> > I would assume ansible would run a bash script exactly as if it were run 
> > from the CLI, but apparently not.  Can any one help me understand the 
> > differences? 
> > 
> > I am using ansible shell to start a set of five long running processes. 
> > Each process is a bash script that starts a java program. Each script is 
> > set up with an & so the process runs in the background.  To wit: 
> > 
> > shell: ./start.sh & 
> > 
> > All process work as expected when started manually by logging in to the 
> > hosts one by one and running the exact same command that would be run 
> using 
> > shell.  Three of the processes do indeed work when started from ansible 
> > shell, but two fail to start at all.  These two have something in 
> common: 
> > Both use maven exec:exec to start them.   The others do not. 
> > 
> > Is there any reason for this? 
>
> With shell module you would not get the users environment, so you 
> probably missing correct PATH and/or other environment variables need 
> for starting. 
>
> -- 
> 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/a5c7189a-2130-492b-8a02-3f0eb6152087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Windows Working Group IRC meetings

2017-02-28 Thread Matt Davis
We're pleased to announce that the Ansible Windows Working Group will begin 
biweekly IRC meetings in the Freenode #ansible-meeting channel on March 
13/14, 2017 (depending on your time zone). This will be a regular developer 
forum to discuss and guide the overall direction of Ansible's support for 
managing Windows hosts, as well as to talk over specific pull requests and 
feature ideas. As with all Ansible working groups, the intent is to keep 
the meetings development-focused, so support questions and other discussion 
will be redirected to the public #ansible IRC channel and mailing list.

In an attempt to accommodate the wide home-timezone range of Ansible 
Windows contributors, we're initially scheduling the meetings to occur 
every other week, on Monday afternoons and Friday mornings (Pacific Time). 
More details, including calendar, agenda links, and minutes, can be found 
at https://github.com/ansible/community/blob/master/MEETINGS.md.

This has been a long time coming- we're looking forward to engaging with 
the community in a more regular and realtime fashion. Hope to see you there!

- Matt Davis, Principal Software Engineer, Ansible Core / Red Hat

-- 
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/26d12852-98dd-456a-a16b-86b112fb813f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Marshalling Cisco AireOS/WLC devices with ansible

2017-02-28 Thread Jacob Floyd
Hey all,

I just filed #22098: "Feature Idea: Add module for Cisco AireOS devices 
(WLCs)".

We have a Cisco WLC where we need to dynamically create/destroy or 
enable/disable wireless networks. I even need to dynamically change the 
PSKs for a few of them.
Right now, I have a simple, crufty, python script that sends a few commands 
to the controller via Exscript.

Basically we're testing a bunch of IoT devices that are setup to connect to 
only one network. It would be very helpful to use Ansible to create the 
appropriate network as install/testing begins, and destroy it once that 
process is finished. Needless to say, that's not a common way to use the 
Cisco wireless stuff.

It looks like the new network_cli connection plugin will be perfect for 
this once 2.3 is out.[1]

Does anyone else have access to Cisco WLCs to be able to create a module to 
deal with them?  I wouldn't be able to spend enough time to write an entire 
module from scratch--I haven't ever written a module before, and I'm not 
sure I have time to learn it all now. But, I do need to make my crufty 
script more dynamic, fault-tolerant, and reusable, so, maybe I can use some 
of that effort to work with someone on such an ansible module. Any takers?

Cheers,
Jacob Floyd
Systems Admin at Theatro (theatro.com)

[1] https://www.ansible.com/blog/networking-features-in-ansible-2-3

-- 
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/123b5aa3-e989-4bcf-a555-e00612957ff1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Kai Stian Olstad

On 28. feb. 2017 19:38, Brian Coca wrote:

As long as project_config is defined, if not you'll get an attribute
error exception


I don't get any errors, here is the full playbook.

---
- name: project_config not set
  hosts: localhost
  tasks:
- debug: var=project_config

- name: "[] []"
  debug: msg="This will not print {{ item }}"
  with_items: " {{ (project_config | default([])).apt | default([]) }}"

- name: "{} []"
  debug: msg="This will not print {{ item }}"
  with_items: " {{ (project_config | default({})).apt | default([]) }}"

- name: "[] {}"
  debug: msg="This will not print {{ item }}"
  with_items: " {{ (project_config | default([])).apt | default({}) }}"

- name: "{} {}"
  debug: msg="This will not print {{ item }}"
  with_items: " {{ (project_config | default({})).apt | default({}) }}"


$ ansible-playbook --version
ansible-playbook 2.2.1.0


$ ansible-playbook test.yml

PLAY [project_config not set] 
**


TASK [debug] 
***

ok: [localhost] => {
"project_config": "VARIABLE IS NOT DEFINED!"
}

TASK [[] []] 
***


TASK [{} []] 
***


TASK [[] {}] 
***


TASK [{} {}] 
***


PLAY RECAP 
*

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


As you can see I don't get any errors.


--
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/0323f606-efeb-623c-fba7-96f1bcbb43c0%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Brian Coca
As long as project_config is defined, if not you'll get an attribute
error exception


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


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Kai Stian Olstad

On 28. feb. 2017 19:06, Brian Coca wrote:

note the change, only the last one is an empty list [ ] , if
project_config is undefined it should be an empty hash/dictionary, as
.apt can only be part of that and not a list. Default will need to
return what is expected of the 'next step'

with_items: " {{ (project_config | default({})).apt | default([]) }}"



My experience is that it doesn't matter it I use {}, [] or a mix, it 
works either way.


  - name: "[] []"
debug: msg="This will not print {{ item }}"
with_items: " {{ (project_config | default([])).apt | default([]) }}"

  - name: "{} []"
debug: msg="This will not print {{ item }}"
with_items: " {{ (project_config | default({})).apt | default([]) }}"

  - name: "[] {}"
debug: msg="This will not print {{ item }}"
with_items: " {{ (project_config | default([])).apt | default({}) }}"

  - name: "{} {}"
debug: msg="This will not print {{ item }}"
with_items: " {{ (project_config | default({})).apt | default({}) }}"


TASK [[] []] 

TASK [{} []] 

TASK [[] {}] 

TASK [{} {}] 

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

--
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/3d6dd671-7a28-3f61-06ce-98e711b645dc%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variables and templates between roles

2017-02-28 Thread Dick Davies
If you load the apache role in a play and then your vhosts role, you should be
able to use apache role vars (or set in defaults/ ) in the vhosts role, so long
as both roles are in the same play.

(we just did exactly this this afternoon, so let me know if it's not happening
for any reason).

On 28 February 2017 at 15:32, Gabriel Forster  wrote:
> I may be way off in the way I'm trying to accomplish this, but I think I
> need to pass variables from one role to another.
>
> I am setting up svn on a Suse server. I'm using the geerlingguy.apache and a
> rather modified geerlingguy.svn roles. I need the apache role available to
> deploy apache with various vhosts across a number of servers. So, my thought
> is that the vhosts should not be in the apache role, but in roles for the
> various different services that use apache, svn being one of them. So, I'd
> like to basically use the roles and templates from the apache role in the
> svn role.
>
> Alternatively, I think I would put all the various vhost configurations into
> the apache role and somehow determine which one goes on which server. Unsure
> how to do that.
>
> Looking for the best way forward since this idea will carry over into other
> roles as well and I want to get the structure correct.  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/980f29cf-829e-461c-8d8a-656155c79872%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/CAK5eLPTjStUb3cO2sZAKXei6Qwi6gGMcm3Cy4XWN6t-HdvZbAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Brian Coca
note the change, only the last one is an empty list [ ] , if
project_config is undefined it should be an empty hash/dictionary, as
.apt can only be part of that and not a list. Default will need to
return what is expected of the 'next step'

with_items: " {{ (project_config | default({})).apt | default([]) }}"


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


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Barry Kaplan
Sorry, I was wrong. This does indeed remove the warning.

On Tuesday, February 28, 2017 at 5:44:37 PM UTC+1, Barry Kaplan wrote:
>
> This does not remove the deprecation warning for me in 2.1.2.0
>
> On Saturday, September 10, 2016 at 10:19:34 AM UTC+2, Kai Stian Olstad 
> wrote:
>>
>> This will work. 
>> First project_config need to be filtered through default, and then 
>> project_config.apt. 
>>
>>with_items: " {{ (project_config | default([])).apt | default([]) }}" 
>>
>>
>>

-- 
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/64a154f1-8356-42be-8cea-966b779db04e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: "when" and "with_items" again, with a twist

2017-02-28 Thread Barry Kaplan
Thanks Brian. Just saw that example in another post. It does work of 
course, but boy is it ugly.

-- 
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/b76c008e-e78f-4816-afa3-062c7600c1ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Kai Stian Olstad

On 28. feb. 2017 17:44, Barry Kaplan wrote:

On Saturday, September 10, 2016 at 10:19:34 AM UTC+2, Kai Stian Olstad
wrote:


This will work.
First project_config need to be filtered through default, and then
project_config.apt.

   with_items: " {{ (project_config | default([])).apt | default([]) }}"



This does not remove the deprecation warning for me in 2.1.2.0


It does, if it doesn't work for you, you should show us your code so we 
can help.


--
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/cd68907d-5dd3-a4bf-e0b3-b886b621c49d%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: "when" and "with_items" again, with a twist

2017-02-28 Thread Brian Coca
default only applies to the 'last' item, so if you are going to do
several depths of var defintion that can be undefined, you should have
several defaults.

"{{ (example.json|default({})).url | default([]) }}"


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


Re: [ansible-project] Re: Passing to a module a list of values

2017-02-28 Thread stephane via Ansible Project
Le mardi 28 février 2017 15:47:47 UTC+1, Brian Coca a écrit :
>
> If you are passing the list directly to name= it should 'just work', 
> if you are passing it through with_ ... your module needs to be 
> configured in squash_actions configuration. Be aware that we are 
> considering removing this 'magic'. 
>
>
Hello !

It was the "squash_action" I was missing. Thanks a lot!

But passing a list directly to the name= is a good idea. I'll try that.

-- 
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/037290ed-2498-4b9e-aac6-de292de031cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: "when" and "with_items" again, with a twist

2017-02-28 Thread Barry Kaplan
Anybody figure out to get around these deprecation warnings?

-- 
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/843d7af3-aeb8-4241-bfe7-0745159a02fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help with deprecation warnings

2017-02-28 Thread Barry Kaplan
This does not remove the deprecation warning for me in 2.1.2.0

On Saturday, September 10, 2016 at 10:19:34 AM UTC+2, Kai Stian Olstad 
wrote:
>
> This will work. 
> First project_config need to be filtered through default, and then 
> project_config.apt. 
>
>with_items: " {{ (project_config | default([])).apt | default([]) }}" 
>
>
>

-- 
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/5cd7dc73-d5ae-432d-ac42-4404fa2bf976%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible shell calling maven exec fails

2017-02-28 Thread Kai Stian Olstad

On 28. feb. 2017 15:38, g.robe...@prometheuscomputing.com wrote:

I would assume ansible would run a bash script exactly as if it were run
from the CLI, but apparently not.  Can any one help me understand the
differences?

I am using ansible shell to start a set of five long running processes.
Each process is a bash script that starts a java program. Each script is
set up with an & so the process runs in the background.  To wit:

shell: ./start.sh &

All process work as expected when started manually by logging in to the
hosts one by one and running the exact same command that would be run using
shell.  Three of the processes do indeed work when started from ansible
shell, but two fail to start at all.  These two have something in common:
Both use maven exec:exec to start them.   The others do not.

Is there any reason for this?


With shell module you would not get the users environment, so you 
probably missing correct PATH and/or other environment variables need 
for starting.


--
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/3b49c6b8-d0d1-6d84-2dbb-bdc7efe7de6c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dynamically include vaulted vars within playbook only for certain hosts

2017-02-28 Thread Brian Coca
To include variables, use include_vars, not include (this only works
for plays or tasks).

Include_vars is always dynamic, so you just need a when:

- include_vars: vault_vars/ci_prod/vault.yml
  when: myenv != 'dev'

# example when condition

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


Re: [ansible-project] Can we rely on play variables being re-calculated/re-templated for each host in a play?

2017-02-28 Thread Brian Coca
Variables are lazily evaluated and computed per host. The issues with
set_fact are that the evaluation is happening before setting the
variable as ansible evaluates the expression to pass it to the task:

so

vars:
 varname:  "{{expression}}" # this is lazy


- set_facts: varname={{expression}} #var is set to result of
'expression' as it is evaluated for the task.

I hope that clarifies the issue.
--
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/CACVha7dPyT4Nmn90BhZCg0bi6Q3gnLD1tsjCE%2BGbiC5SH2H0Ew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] lineinfile transiently results in empty file

2017-02-28 Thread Brian Coca
It sounds like corruption after writing, after you get the first 0
length file it makes sense that it stays that way if it cannot match
the line to change.
what is your filesytem? anything show up in the logs? devices errors?
write errors?


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


[ansible-project] Variables and templates between roles

2017-02-28 Thread Gabriel Forster
I may be way off in the way I'm trying to accomplish this, but I think I 
need to pass variables from one role to another. 

I am setting up svn on a Suse server. I'm using the geerlingguy.apache and 
a rather modified geerlingguy.svn roles. I need the apache role available 
to deploy apache with various vhosts across a number of servers. So, my 
thought is that the vhosts should not be in the apache role, but in roles 
for the various different services that use apache, svn being one of them. 
So, I'd like to basically use the roles and templates from the apache role 
in the svn role. 

Alternatively, I think I would put all the various vhost configurations 
into the apache role and somehow determine which one goes on which server. 
Unsure how to do that. 

Looking for the best way forward since this idea will carry over into other 
roles as well and I want to get the structure correct.  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/980f29cf-829e-461c-8d8a-656155c79872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] lineinfile transiently results in empty file

2017-02-28 Thread Ben Watson
Bump.  I'm still having this random problem.  Anyone else seen anything
like this or have any recommendations?  I tried a more recent pull of
Ansible 'devel', but it broke something else (filesystem module).

On Tue, Feb 14, 2017 at 1:20 PM, Ben Watson  wrote:

> Greetings,
>
> I'm using the devel branch on Ansible Github (e.g. version 2.3) and have
> run into a curious problem the past few weeks regarding the use of
> lineinfile that was seemingly bulletproof in prior versions (e.g. 2.0, 2.1,
> 2.2).  We've moved to 2.3 for needed enhancements.
>
> I say that the problem is transient because it doesn't *always* manifest.
> That is, I cannot reliably reproduce the problem.  However, when it does
> manifest, it results in an empty file.  I'll attempt to describe my running
> scenario here, however the actual system we use is Internet-disconnected,
> so I cannot simply copy/paste results here.
>
> I'm using lineinfile to ensure entries exist in /etc/hosts
>
> My play looks like this:
>
> - name: Ensure all machines have /etc/hosts entries
>   become: true
>   hosts: [machines]
>   tasks:
>
> - name: ensure /etc/hosts has entries
>   lineinfile:
> dest: /etc/hosts
> owner: root
> group: root
> mode: u=rw,g=r,o=r
> line: "{{ hostvars[item]['vm_ip'] }}{{
> hostvars[item]['vm_hostname'] }}{{ hostvars[item]['vm_alias'] }}"
> create: yes
> state: present
> backup: yes
>   with_items: "{{ groups['all'] }}"
>
> In other words, I'm looping over my inventory and adding known facts about
> the inventory as lines in /etc/hosts on [machines].  The known facts are
> all stored in aptly named files under the host_vars folder.  This seemed
> pretty trivial and worked well in the past.  However now, some subset of
> [machines] end up with a 0-byte length /etc/hosts file.  Moreover, it is
> not consistent on a run-to-run basis.  On the *majority* of runs of the
> playbook, everything is as expected.  But on *some* runs, certain hosts
> will have this empty file.
>
> I added the "backup: yes" as a means to troubleshoot and when I do
> encounter one of these machines with an empty /etc/hosts file, I can see
> via a directory listing all of the instances of the backups of the file
> corresponding to each time lineinfile modified the file.  I can even see
> the file size growing over these instances until at some point, the size
> goes to 0 bytes and stays there.  For example:
>
> ls -la /etc/hosts
>
> -rw-r--r--. 1 root root   0 Feb 14 18:02 /etc/hosts
> -rw-r--r--. 1 root root 225 Sep 16 18:21 /etc/hosts.2753.2017-02-14@18:
> 02:06
> -rw-r--r--. 1 root root 278 Feb14 18:02 /etc/hosts.2774.2017-02-14@18:
> 02:06
> -rw-r--r--. 1 root root 331 Feb14 18:02 /etc/hosts.2795.2017-02-14@18:
> 02:06
> -rw-r--r--. 1 root root   0 Feb14 18:02 /etc/hosts.2816.2017-02-14@18:
> 02:07
> -rw-r--r--. 1 root root   0 Feb14 18:02 /etc/hosts.2837.2017-02-14@18:
> 02:07
> -rw-r--r--. 1 root root   0 Feb14 18:02 /etc/hosts.2858.2017-02-14@18:
> 02:07
> -rw-r--r--. 1 root root   0 Feb14 18:02 /etc/hosts.2879.2017-02-14@18:
> 02:07
>
> When actually exeuting the ansible-playbook, I'm seeing yellow "changed"
> output thinking that everything is getting updated and is OK in the end,
> however I end up in the above situation.  Is this a known bug in Ansible
> 2.3?
>
> --
> 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/SP8KJnwSxWc/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/569abc84-0b36-4777-8cbb-002a11896566%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/CABJf-Es6MYZnfBZ%2Btiia-1ti9WvX1RpX3kkqsOHbLKuO1Kub-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows installer fails via Ansible

2017-02-28 Thread Justin Dugan
The event log shows an install failure with code 1603. The application log 
shows the following:

[000433][06:45:02:0024] 
[15][ExecuteSequence.InstallDatabase][CreateConnection]
[000434][06:45:02:0397] [16][SQLServer.CreateConnection][CreateConnection] 
SqlExceptionLogin failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
[000435][06:45:02:0397] 
[14][StandardActions.DisplayRollBackError][DisplayRollBackError]
[000436][06:45:02:0397] [14][StandardActions.DisplayRollBackError]Login 
failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
[000437][06:45:02:0398] [13][ExecuteSequence.InstallExecuteSeq]

Again, the installer runs fine if executed via powershell directly on the 
server. It's only failing if executed via ansible.

Thanks,

Justin

On Tuesday, February 28, 2017 at 8:35:10 AM UTC-5, J Hawkesworth wrote:
>
> I would think the authentication delegation may be working - you may be 
> able to examine the security event log on the SQLServer and see if there is 
> a successful logon from whatever user ansible is connecting as.
> but I think its possible that SQL Server has other requirements but worth 
> checking the event log.
> Also, does the installer write a log file or write to the event log.  It 
> might be possible to determine why is failing from the installer's own 
> logging.
>
> Hope this helps,
>
> Jon
>
>
>
> On Monday, February 27, 2017 at 10:15:15 PM UTC, Justin Dugan wrote:
>>
>> The delegation is working (at least for Windows shares). The installer 
>> file is copied from a Windows file share before the install occurs and this 
>> completes successfully. Is it possible for the delegation to work for a 
>> file share and fail for SQL Server? 
>>
>> On Saturday, February 25, 2017 at 12:33:01 PM UTC-5, J Hawkesworth wrote:
>>>
>>> Rdp to the server and connecting to sql server is just one hop. 
>>> Connecting from ansible to server and from server to sql server is a second 
>>> hop, which is where the delegated credential becomes important.
>>>
>>> If you want to check if delegation is working, you could try writing a 
>>> file to a share on a second machine from ansible via your windows server.
>>>
>>> It's been a while since I installed SQL Server, but if I recall there 
>>> is/was a Surface Area configuration tool where you can set various options 
>>> regarding things like ports and available authentication protocols.  If 
>>> that is still a thing, that might be worth looking at too.
>>>
>>> Jon
>>>
>>>

-- 
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/61df7c11-ce38-4183-b0fa-607d1c2303be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Timeout problem with far distance host

2017-02-28 Thread Brian Coca
You could set ConnectTimeout in ansible_ssh_args for that host


--
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/CACVha7f8HVHDmnhaxkhsUG-RFWPLfb90r%3DHpeOe30TC%2BZkJjFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Syntax Error while loading YAML.

2017-02-28 Thread Josh Smift
KSO> In YAML indentation is very important, and you need to be consistent
KSO> in the indentation.

Also, all indentation should be space characters, not tabs.

(If you've got tabs in your playbook, could Ansible catch that and
identify the problem more clearly than it currently does?)

  -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

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


Re: [ansible-project] Re: Passing to a module a list of values

2017-02-28 Thread Brian Coca
If you are passing the list directly to name= it should 'just work',
if you are passing it through with_ ... your module needs to be
configured in squash_actions configuration. Be aware that we are
considering removing this 'magic'.


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


[ansible-project] ansible shell calling maven exec fails

2017-02-28 Thread g . roberts
All,

I would assume ansible would run a bash script exactly as if it were run 
from the CLI, but apparently not.  Can any one help me understand the 
differences?

I am using ansible shell to start a set of five long running processes.  
Each process is a bash script that starts a java program. Each script is 
set up with an & so the process runs in the background.  To wit:

shell: ./start.sh &

All process work as expected when started manually by logging in to the 
hosts one by one and running the exact same command that would be run using 
shell.  Three of the processes do indeed work when started from ansible 
shell, but two fail to start at all.  These two have something in common:  
Both use maven exec:exec to start them.   The others do not.  

Is there any reason for this?

Thanks mucho for any insights.

-- 
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/3aba9fdf-3bc2-485c-885b-10863eeeca76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible doesn't fail when no host found using ec2.py

2017-02-28 Thread irfad


Sometimes (not very often) Ansible doesn't pick the dynamic inventory ip using 
ec2.py and when it happens usually it should fail the job, but instead it will 
SUCCESS the task which prevents us from notifying that the task has not been 
run properly on the server.


example below.


PLAY RECAP 
* 

Finished: SUCCESS


Is there any way to fail the job is such situations?


Please help

-- 
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/32c7fa67-c8e4-465d-8f7d-adfbfab266ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] deployment notifications - for all cases - OK and failed.

2017-02-28 Thread epiq sty
Thanks,

I have tried, but got :

 [WARNING]: Could not submit message to Slack: HTTP Error 404: Not Found



error

Can you please advise, what else can be wrong here?

$ source .slack 
$ more .slack
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/aaa/bbb/ccc
export SLACK_WEBHOOK_URL
$ grep slack ansible.cfg 
callback_whitelist = slack


On Thursday, 23 February 2017 11:37:01 UTC+1, Stankovic, Marko wrote:
>
> Hi, 
>
> Maybe Slack callback plugin would work better for you? 
>
> Enable it by adding slack to the callback_whitelist in 
> /etc/ansible/ansible.cfg 
> http://docs.ansible.com/ansible/intro_configuration.html#callback-whitelist 
>
> Here's documentation from the plugin itself: 
> https://github.com/ansible/ansible/pull/13408/files 
> This is an ansible callback plugin that sends status 
> updates to a Slack channel during playbook execution. 
>
> This plugin makes use of the following environment variables: 
> SLACK_WEBHOOK_URL (required): Slack Webhook URL 
> SLACK_CHANNEL (optional): Slack room to post in. Default: 
> #ansible 
> SLACK_USERNAME(optional): Username to post as. Default: 
> ansible 
> SLACK_INVOCATION  (optional): Show command line invocation 
>   details. Default: False 
>
> Requires: 
> prettytable 
> CONFIDENTIALITY NOTICE: This message is the property of International Game 
> Technology PLC and/or its subsidiaries and may contain proprietary, 
> confidential or trade secret information. This message is intended solely 
> for the use of the addressee. If you are not the intended recipient and 
> have received this message in error, please delete this message from your 
> system. Any unauthorized reading, distribution, copying, or other use of 
> this message or its attachments is strictly prohibited. 
>

-- 
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/b9148191-95cf-4d68-b061-f506927af4e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] EDX Instal Error : Populate countries

2017-02-28 Thread Luke Duffy
Hi

In an attempt to get ecommerce working I find I cant even instal edx any 
more.

Step 1 Install ubuntu 16.04, using all defaults (except add Open SSH)
Step 2 run the commands:
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install ubuntu-desktop

wget 
https://raw.githubusercontent.com/edx/configuration/master/util/install/ansible-bootstrap.sh
 
-O - | sudo bash

This is all good

Step 3: run command 

wget 
https://raw.githubusercontent.com/edx/configuration/master/util/install/sandbox.sh
 
-O - | sudo bash

which fails

TASK [ecommerce : Migrate] 
*
changed: [localhost]

TASK [ecommerce : Populate countries] 
**
fatal: [localhost]: FAILED! => {"changed": true, "cmd": 
"DB_MIGRATION_USER=migrate DB_MIGRATION_PASS=password 
/edx/app/ecommerce/venvs/ecommerce/bin/python ./manage.py 
oscar_populate_countries", "delta": "0:00:01.753737", "end": "2017-02-28 
20:56:40.462859", "failed": true, "failed_when_result": true, "rc": 1, 
"start": "2017-02-28 20:56:38.709122", "stderr": "Traceback (most recent 
call last):\n  File \"./manage.py\", line 10, in \n   
 execute_from_command_line(sys.argv)\n  File 
\"/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/management/__init__.py\",
 
line 353, in execute_from_command_line\nutility.execute()\n  File 
\"/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/management/__init__.py\",
 
line 345, in execute\n   
 self.fetch_command(subcommand).run_from_argv(self.argv)\n  File 
\"/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/management/base.py\",
 
line 348, in run_from_argv\nself.execute(*args, **cmd_options)\n  File 
\"/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/core/management/base.py\",
 
line 399, in execute\noutput = self.handle(*args, **options)\n  File 
\"/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/oscar/management/commands/oscar_populate_countries.py\",
 
line 57, in handle\nfor country in 
pycountry.countries]\nAttributeError: 'Country' object has no attribute 
'alpha_2'", "stdout": "2017-02-28 09:56:39,481 WARNING 7279 [py.warnings] 
/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/db/models/fields/subclassing.py:22
 
- 
/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/six.py:808:
 
RemovedInDjango110Warning: SubfieldBase has been deprecated. Use 
Field.from_db_value instead.\n  return meta(name, bases, d)", 
"stdout_lines": ["2017-02-28 09:56:39,481 WARNING 7279 [py.warnings] 
/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/django/db/models/fields/subclassing.py:22
 
- 
/edx/app/ecommerce/venvs/ecommerce/local/lib/python2.7/site-packages/six.py:808:
 
RemovedInDjango110Warning: SubfieldBase has been deprecated. Use 
Field.from_db_value instead.", "  return meta(name, bases, d)"], 
"warnings": []}
to retry, use: --limit 
@/var/tmp/configuration/playbooks/edx_sandbox.retry

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


Please what am I doing wrong ???

-- 
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/557df49e-8e96-4ef4-8577-4201371f01f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Multiple users running ansible on the same host causes blocking

2017-02-28 Thread Andrew Martin
Brian,

Thanks, these are good ideas:

Are you using a common user?
>
no, separate users

> do you have custom callbacks or facts cache setup to a absolute path?
>
yes, but the custom callback path is relative

> are your contol persist settings relative or absolute?

absolute; I have changed this to be a relative path inside each user's home
directory

I'll re-test and let you know if this fixes it.

Thanks,

Andrew

On 27 February 2017 at 15:55, Brian Coca  wrote:

> ansible itself does not share resources across invocations, but there
> are a few  things that could be configures to cause this.
>
> Are you using a common user? do you have custom callbacks or facts
> cache setup to a absolute path? are your contol persist settings
> relative or absolute?
>
>
> --
> 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/kNTC1hesEHA/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/CACVha7cR9DzApVnwkWGVf2c8Du46j
> DRUPfXf89TbP2KTQzc-Gg%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/CAE%2B0DR5z-cj3yJE1-MzCeiO9-EDeUiGLgoYA%2Bb3oFZQJQ_B3kQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible winrm : the specified credentials were rejected by the server

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
Winrm is intended for system administration, so using with a regular, non 
administrator user might not have sufficient grants/permissions.

Can you make your local user a local administrator perhaps?

On Thursday, February 16, 2017 at 10:12:20 AM UTC, Hmdi Bz wrote:
>
> no I'm not using a domain login, just a normal user (not an admin) , the 
> User Account Control is disabled.
>
> update:
> I've tried to win_ping to the admin account and it work, the thing is I 
> need it to work with just a normal account
>
> On Wednesday, February 15, 2017 at 12:56:52 PM UTC+1, J Hawkesworth wrote:
>>
>> "the specified credentials were rejected by the server" can often mean 
>> the password doesn't match what's expected for the user name.
>>
>> Are you using a domain login?  If so you'll need to set up the kerberos 
>> support.  If not check the windows event log to see which user it reckons 
>> you are logging in as.
>>
>> Hope this helps,
>>
>> Jon
>>
>> On Tuesday, February 14, 2017 at 6:20:28 PM UTC, Hmdi Bz wrote:
>>>
>>> Hi,
>>> I'm using ansible on centos 7 guest on virtualBox using a bridged 
>>> network with a windows host
>>> they can both ping each other. (windows address: 192.168.1.2, centos7 
>>> address: 192.168.1.3)
>>> I'm using a  basic winrm connection and I've already executed 
>>> configureRemotingForAnsible.ps1 successfuly on the host  along with these 
>>> two commands:
>>>
>>> winrm set winrm/config/service/auth '@{Basic="true"}'
>>> winrm set winrm/config/service '@{AllowUnencrypted="true"}'
>>>
>>> I've also disabled firewall on both sides.
>>> My windows account is not part of any Domain.
>>>
>>>
>>> ansible version is 2.2.1.0
>>> the inventory file:  inv.ini
>>>
>>> [windowsTest]
>>> 192.168.1.2
>>> [windowsTest:vars]
>>> ansible_username=myUsername
>>> ansible_password=myPassword
>>> ansible_port=5985
>>> ansible_connection=winrm
>>> ansible_winrm_scheme=http
>>> ansible_winrm_server_cert_validation=ignore
>>> ansible_winrm_transport=basic
>>>
>>>
>>> when I execute :
>>>
>>>$ ansible windowsTest -i inv.ini -m win_ping
>>>
>>> I get this error:
>>>
>>> 192.168.1.2 |Unreachable! => {
>>>"changed": false,
>>>"msg": "basic: the specified credentials were rejected by the server",
>>>"unreachable": true
>>> }
>>>
>>> any Help?
>>>
>>

-- 
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/a344f72f-21b8-4b1a-b4b0-75688b338886%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_lineinfile does not create new file

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
If you run with -v what error message do you see?

Does your ansible user have permission to write to 
c:\temp\ansible-windows.log ?

Hope this helps,

Jon
On Thursday, February 16, 2017 at 6:52:24 PM UTC, cupcake wrote:
>
> ansible core 2.1
>
> When using win_lineinfile module and the `create: yes` option it seems it 
> should create a new file. it fails the same as if create:yes is not 
> specified.
>
> - hosts: all
>   tasks:
>
>   - name:  win_lineinfile test
> win_lineinfile:
>   dest: 'c:\temp\ansible-windows.log'
>   create: yes
>   line: '{{ ansible_hostname }}-{{ ansible_date_time.iso8601 }}'
>   regexp: '{{ ansible_hostname }}-'
>   state: present
>
> If dest doesn't exist it fails. Guessing I am doing something wrong?
>
>
>
>

-- 
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/4c16a3ef-6ae3-4866-9290-47e1d2e62cb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] uri module and curl

2017-02-28 Thread Kai Stian Olstad

On 28.02.2017 14:38, norricorp wrote:

many thanks to both of you for the replies.
I tried both shell and command modules with the curl command and a
  curl: (7) Failed connect to centos7-ansible:8080; Connection 
refused"
Not sure why the connection would be refused as there. The previous 
task in

ansible is to start tomcat so would it be too soon to accept requests?
Tried adding a pause and that worked with a command module but not the 
uri

module.


Instead of pause you could use until: so it retries until you get 200.
https://docs.ansible.com/ansible/playbooks_loops.html#do-until-loops

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


[ansible-project] Re: On Windows, how can we configure Ansible's modules to go through an HTTP Proxy?

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
There is some discussion here on this issue that might relevant to the 
issue you are having:
https://github.com/diyan/pywinrm/issues/110

Hope this helps,

Jon


On Thursday, February 16, 2017 at 11:21:28 PM UTC, JS wrote:
>
> From Github:
>
> SUMMARY
>
> Ansible modules executed on a Windows host are unable to access the 
> internet via an HTTP Proxy. Ideally modules would function similarly to 
> setting the environment on Linux hosts, i.e
>
> environment: 
>http_proxy: http://gateway:port
>https_proxy: http://gateway:port
>
> The following workarounds have been attempted:
>
>- Making changes to the Registry (i.e 
>HKCU:Software\Microsoft\Windows\CurrentVersion\Internet 
>Settings\ProxyServer)
>- Using netsh (i.e netsh winhttp set proxy 
>proxy-server="http://gateway:port";)
>- Setting the environment variable in cmd.exe, then running Curl as 
>suggested here 
>
> .
>  
>For example:
>
> - name: Fire and forget iexplore.exe 
>   win_shell: set 
> HTTP_PROXY=http://management-gateway.c.ansible-proj.internal:3128 & 
> powershell.exe curl http://www.google.com
>   args:
> executable: cmd
>
>
>- Simulating a new session on the Windows host by starting 
>notepad.exe, setting the registry, then attempting Curl (see below 
> playbook)
>
> *NOTE:* The local administrator account is being used and a formal 
> session via RDP is never initiated.
> STEPS TO REPRODUCE 
>
> Attempt to curl an external website via win_shell. Some examples:
>
>
> ansible windows-host -i inventory-file -m win_shell -a "curl 
> http://www.google.com";
>
>
> - name: run
>   hosts: windows-host
>   tasks:
>   - name: Fire and forget notepad.exe
> win_shell: notepad.exe
> args:
>   exectable: cmd
> async: 60
> poll: 0
>   - name: Set registry
> win_shell: "{{ item }}"
> with_items:- set-itemproperty -path 
> "hkcu:Software\Microsoft\Windows\CurrentVersion\Internet 
> Settings" -name ProxyServer -value "http=gateway:port;https=gateway:port; 
> -type string
>   - set-itemproperty -path "hkcu:Software\Microsoft\Windows\
> CurrentVersion\Internet Settings" -name ProxyEnable -value "1"
>   - name: Run curl
> win_shell: curl http://www.google.com
> register: result
>
>
>
>
>
> On Friday, February 17, 2017 at 9:49:32 AM UTC+11, JS wrote:
>>
>> As per this post on the Ansible Github 
>> , how can Ansible be 
>> configured to run through an HTTP proxy?
>>
>> Ultimately it is ideal to use the win_chocolatey module through the 
>> proxy, but I'm unable to just run a simple curl (i.e curl 
>> http://www.google.com) through win_shell.
>>
>

-- 
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/67754579-aacf-4c96-9823-bf223d59bee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Internet:] [ansible-project] Re: Using win_iis_webapppool to update application pool attributes

2017-02-28 Thread David Norman
A ton of fixes for win_iis_webapppool were merged this morning, so they
should make Ansible 2.3. Jon now imports
C:\Windows\system32\inetsrv\Microsoft.Web.Administration.dll,
which is what makes it possible to reach all the indexes we were previously
getting undefined.

There's a notable change from how I was doing workarounds for 2.2 and older
to use readable strings instead of having to lookup integer values. For
example, processModel.identityType:3 will now
be processModel.identityType:SpecificUser. Another - managedPipelineMode:0
will be managedPipelineMode:Integrated.

The docs in the pull request note at least one of those in the example
output: https://github.com/ansible/ansible/pull/20680


*David Norman, Ph.D., CISSP-ISSAP, CSSLP, CIPT*
Development Operations Engineer

925 North Point Parkway, Ste 350
Alpharetta, GA 30005
david.nor...@cioxhealth.com
www.cioxhealth.com

On Tue, Nov 15, 2016 at 8:01 AM, 'J Hawkesworth' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> By the way, if you have the opportunity, please could you test my changes
> to win_iis_webappool module here:
> https://github.com/ansible/ansible-modules-extras/pull/3257
> the version lets to set enumerated values in the configuration such as '
> managedPipelineMode'
> and also returns the possible enumeration values in the response.
>
> Many thanks,
>
> Jon
> On Monday, November 14, 2016 at 10:21:40 AM UTC, J Hawkesworth wrote:
>>
>> The only way my colleagues have found to do this is via appcmd.  If you
>> are on ansible 2.2. you could use win_command instead of raw but the rest
>> of the syntax would probably be the same as below:
>>
>> - name: Add authentication for Site
>>   raw: 'C:\Windows\System32\inetsrv\appcmd.exe set config
>> "Site/" 
>> -section:system.webServer/security/authentication/anonymousAuthentication
>> /enabled:"True" /commit:apphost'
>>
>> - name: Add authentication user for Site
>>   raw: 'C:\Windows\System32\inetsrv\appcmd.exe set config "Site/"
>> -section:system.webServer/security/authentication/anonymousAuthentication
>> /userName:{{ iis_domain }}\{{ iis_user }} /password:{{ iis_cred }}
>> /commit:apphost'
>>
>> HTH
>>
>> Jon
>>
>> On Saturday, November 12, 2016 at 1:31:30 AM UTC, philip shangguan wrote:
>>>
>>> I am trying to config .NET application pool and I need to change the
>>> "Identity" to use "Custom account" and then enter the user name and
>>> password. It seems I can not find the correct attribute names to use in the
>>> playbook to have those values set. I tried to search them in:
>>>
>>> https://msdn.microsoft.com/en-us/library/microsoft.web.admin
>>> istration.applicationpool_properties(v=vs.90).aspx
>>>
>>> but was not successful. This link seems have the right info. but hard to
>>> figure out how to add them into the playbook for "attributes"
>>>
>>> Thanks,
>>> Philip
>>>
>>>
>>>
>>> --
> 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/86d866a6-0a0b-4237-a038-f32e1afdf915%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
CONFIDENTIALITY NOTICE: The information in this e-mail message, and any 
attachment, is intended for the sole use of the individual and entity to 
whom it is addressed. This information may be privileged, confidential, and 
protected from disclosure. If you are not the intended recipient you are 
hereby notified that you have received this communication in error and that 
any review, disclosure, dissemination, distribution or copying of it, or 
its, contents, is strictly prohibited. If you think that you have received 
this e-mail message in error please e-mail the sender and destroy all 
copies of this communication and any attachments. Thank you.




-
This message was secured by ZixCorp(R).

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


[ansible-project] Re: win_shell hangs

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
Not a lot of information to go on here, but it looks like you might need to 
change syntax, looking at the examples here:
https://docs.ansible.com/ansible/win_shell_module.html

try something like this in your playbook

win_shell: start.bat
args:
  chdir: C:\someApp\bin




On Monday, February 20, 2017 at 1:40:09 PM UTC, Hmdi Bz wrote:
>
> hello,
> I tried to execute a bash script ( the script is inside the remote windows 
> server)
> the bash script was executed but the win_shell  task hangs.
> win_shell: chdir="C:\\someApp\\bin" ./start.bat
>

-- 
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/1e6ed657-c883-4ddc-ba63-76dff23bdec3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] uri module and curl

2017-02-28 Thread norricorp
many thanks to both of you for the replies.
I tried both shell and command modules with the curl command and a 
  curl: (7) Failed connect to centos7-ansible:8080; Connection refused"
Not sure why the connection would be refused as there. The previous task in 
ansible is to start tomcat so would it be too soon to accept requests? 
Tried adding a pause and that worked with a command module but not the uri 
module. But curl does take a long time to run whereas outside of anisble it 
is instant.
I did increase the timeout value on uri and that did allow it to complete 
OK.

This is all running on the same VM so there should  not be proxy issues.


>

-- 
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/380dec93-d410-4070-92b7-ce7b93f3f5e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows installer fails via Ansible

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
I would think the authentication delegation may be working - you may be 
able to examine the security event log on the SQLServer and see if there is 
a successful logon from whatever user ansible is connecting as.
but I think its possible that SQL Server has other requirements but worth 
checking the event log.
Also, does the installer write a log file or write to the event log.  It 
might be possible to determine why is failing from the installer's own 
logging.

Hope this helps,

Jon



On Monday, February 27, 2017 at 10:15:15 PM UTC, Justin Dugan wrote:
>
> The delegation is working (at least for Windows shares). The installer 
> file is copied from a Windows file share before the install occurs and this 
> completes successfully. Is it possible for the delegation to work for a 
> file share and fail for SQL Server? 
>
> On Saturday, February 25, 2017 at 12:33:01 PM UTC-5, J Hawkesworth wrote:
>>
>> Rdp to the server and connecting to sql server is just one hop. 
>> Connecting from ansible to server and from server to sql server is a second 
>> hop, which is where the delegated credential becomes important.
>>
>> If you want to check if delegation is working, you could try writing a 
>> file to a share on a second machine from ansible via your windows server.
>>
>> It's been a while since I installed SQL Server, but if I recall there 
>> is/was a Surface Area configuration tool where you can set various options 
>> regarding things like ports and available authentication protocols.  If 
>> that is still a thing, that might be worth looking at too.
>>
>> Jon
>>
>>

-- 
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/4eb38403-5814-4c91-85a0-8a95aa98ecfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Passing to a module a list of values

2017-02-28 Thread 'J Hawkesworth' via Ansible Project
Hi,

Some  modules (I think the yum module is one example) have a code 
optimization which allows them to handle a list passed to them in one go, 
rather than in multiple invocations of the code.

I suggest you have a look at the code for the yum 
module http://docs.ansible.com/ansible/yum_module.html
I haven't looked myself but there may also be an action plugin for yum to 
support this optimization.

Hope this helps,

Jon

On Tuesday, February 28, 2017 at 1:09:56 PM UTC, step...@dupille.org wrote:
>
> Hello,
>
> I'm currently trying to create a module to manage poudriere (which is a 
> tool to manage package repository for FreeBSD).
>
> When I use the pkgng module this way, the command pkgng is actually called 
> once, and the "name" argument is a list of all values contained in the list 
> provided :
> - name: sample pkgng
>   pkgng: name="{{item}}" state=present
>   with_items: [ a, b, c]
>
> But, when I call my poudriere module :
> - name: sample poudriere
>   poudriere: name="{{item}}" jail=jailname
>   with_items: [ a, b, c]
> the module is called three times, once per item value.
>
> I assumed that to get the module called only once, all I had to do is to 
> declare the "name" argument as of type 'list', but this is not working :
> module = AnsibleModule(
>   argument_spec = dict(
> name = dict(required=True, type='list'),
> jail = dict(required=True),
>   ),
>   supports_check_mode = True,
> )
>
> In my module, module.params['name'] is actually a list, but it contains a 
> single value each time.
>
> What am I missing ?
>
> Thanks,
> SD
>
>

-- 
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/74d59f99-2105-4028-b9ef-c3587db303da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Passing to a module a list of values

2017-02-28 Thread stephane via Ansible Project
Hello,

I'm currently trying to create a module to manage poudriere (which is a 
tool to manage package repository for FreeBSD).

When I use the pkgng module this way, the command pkgng is actually called 
once, and the "name" argument is a list of all values contained in the list 
provided :
- name: sample pkgng
  pkgng: name="{{item}}" state=present
  with_items: [ a, b, c]

But, when I call my poudriere module :
- name: sample poudriere
  poudriere: name="{{item}}" jail=jailname
  with_items: [ a, b, c]
the module is called three times, once per item value.

I assumed that to get the module called only once, all I had to do is to 
declare the "name" argument as of type 'list', but this is not working :
module = AnsibleModule(
  argument_spec = dict(
name = dict(required=True, type='list'),
jail = dict(required=True),
  ),
  supports_check_mode = True,
)

In my module, module.params['name'] is actually a list, but it contains a 
single value each time.

What am I missing ?

Thanks,
SD

-- 
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/e26c91cf-e5c4-4ad2-9a02-8899c799a23c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to use regex to match a response using the expect module

2017-02-28 Thread David Williams
Thank you Matt, I have looked at the modules but I'm trying to drop down 
into the linux shell and change some file permissions within the directory 
structure.  It doesn't look like the module can do that.  Thanks for trying 
though!  Any help is always appreciated.

On Tuesday, February 28, 2017 at 12:22:13 AM UTC-6, Matt Clay wrote:
>
> David,
>
> I know this isn't what you asked, but since it looks like you're working 
> with JUNOS I thought I'd check to see if you've already looked at Ansible's 
> JUNOS support:
>
> https://docs.ansible.com/ansible/list_of_network_modules.html#junos
>
>  - Matt
>
> On Monday, February 27, 2017 at 3:57:16 PM UTC-8, David Williams wrote:
>>
>> I am stumped...I have been trying to use the expect module and format the 
>> expected response as a regex that can match multiple responses.   I see 
>> posts all over where people are trying to match the response exactly and 
>> have to escape the regex special characters.  It seems nobody writes regex 
>> to match multiple responses.  Is this not possible?
>>
>> *Playbook*
>>
>> - name: Clear Permissions on /var/etc/pam.conf
>>   hosts: juniper_ex4200
>>   tasks:
>> - name: Access member 0
>>   expect:
>> command: 'request session member 0'
>> responses: 
>> "^---\sJUNOS.+\n(warning.+\n){5}\{((backup)|(linecard)):((1)|(2))\}": 
>> "start shell user root"
>>
>>
>> *Error*
>>
>> ERROR! Syntax Error while loading YAML.
>>
>>
>> The error appears to have been in 
>> '/home/dwilliams/ex4200_permissions_clear/ex4200_permissions_clear': line 
>> 8, column 25, but may
>> be elsewhere in the file depending on the exact syntax problem.
>>
>> The offending line appears to be:
>>
>> command: 'request session member 0'
>> responses: 
>> "^---\sJUNOS.+\n(warning.+\n){5}\{((backup)|(linecard)):((1)|(2))\}"
>> ^ here
>> This one looks easy to fix.  It seems that there is a value started
>> with a quote, and the YAML parser is expecting to see the line ended
>> with the same kind of quote.  For instance:
>>
>> when: "ok" in result.stdout
>>
>> Could be written as:
>>
>>when: '"ok" in result.stdout'
>>
>> Or equivalently:
>>
>>when: "'ok' in result.stdout"
>>
>>

-- 
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/8953d535-057d-48ea-8908-157fd4cb2cdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] uri module and curl

2017-02-28 Thread Dick Davies
It'd be worth checking if a command: task using curl works.
If not it's probably a shell environment (proxy?) issue.

I've seen curl work where get_url: / uri: doesn't if you are hitting an SNI
endpoint, my workaround is a command: task. Issue here:

https://github.com/ansible/ansible-modules-core/issues/1716


On 28 February 2017 at 09:42, norricorp  wrote:
> Hi,
> is the uri module a curl substitute?
> I ask because if, on the command line, I run curl, I get the expected json
> output from a tomcat rest application. In the logs is a 200 result.
> But if I run the same in uri then ...
> - name: test with curl type command
>   uri:
>  url: http://centos7-ansible:8080/heroes/heroes
>
> TASK [test with curl type command]
> *
> fatal: [localhost]: FAILED! => {"changed": false, "content": "", "failed":
> true, "msg": "Status code was not [200]: Connection failure: timed out",
> "redirected": false, "status": -1, "url":
> "http://centos7-ansible:8080/heroes/heroes"}
>
> What am I doing wrong?
>
> 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/f4133ed5-8800-4c8c-8304-de095a245c7c%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/CAK5eLPRh6s4TEk8QM1X0c%3Dr5ax0jLXimmNtuN4rMu9Y-yZvfDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] uri module and curl

2017-02-28 Thread Dick Visser
Could it be that the host blocks outgoing HTTP traffic, and that you
have some proxy environment variable set in your interactive terminal
to reach HTTP content?

If that is the case, you should make Ansible aware of that:
http://docs.ansible.com/ansible/playbooks_environment.html

Dick

On 28 February 2017 at 10:42, norricorp  wrote:
> Hi,
> is the uri module a curl substitute?
> I ask because if, on the command line, I run curl, I get the expected json
> output from a tomcat rest application. In the logs is a 200 result.
> But if I run the same in uri then ...
> - name: test with curl type command
>   uri:
>  url: http://centos7-ansible:8080/heroes/heroes
>
> TASK [test with curl type command]
> *
> fatal: [localhost]: FAILED! => {"changed": false, "content": "", "failed":
> true, "msg": "Status code was not [200]: Connection failure: timed out",
> "redirected": false, "status": -1, "url":
> "http://centos7-ansible:8080/heroes/heroes"}
>
> What am I doing wrong?
>
> 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/f4133ed5-8800-4c8c-8304-de095a245c7c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

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


[ansible-project] uri module and curl

2017-02-28 Thread norricorp
Hi,
is the uri module a curl substitute?
I ask because if, on the command line, I run curl, I get the expected json 
output from a tomcat rest application. In the logs is a 200 result.
But if I run the same in uri then ...
- name: test with curl type command
  uri:
 url: http://centos7-ansible:8080/heroes/heroes

TASK [test with curl type command] 
*
fatal: [localhost]: FAILED! => {"changed": false, "content": "", "failed": 
true, "msg": "Status code was not [200]: Connection failure: timed out", 
"redirected": false, "status": -1, "url": 
"http://centos7-ansible:8080/heroes/heroes"}

What am I doing wrong?

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/f4133ed5-8800-4c8c-8304-de095a245c7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Syntax Error while loading YAML.

2017-02-28 Thread Kai Stian Olstad

On 28.02.2017 06:24, Pankaj Navneet wrote:

Hi All,

I have written a YAML to install Nginx on my AWS Slave server. But 
every
time i got below error while running my playbook. I googled to resolve 
this
issue, but unable to do so. Can you guys help me in sorting what i am 
doing

wrong here. I am using Ubuntu 16 and my YAML is,


In YAML indentation is very important, and you need to be consistent in 
the indentation.




- hosts: AWS_Slave
  tasks:
- name: nginx
apt_key: url=http://nginx.org/keys/nginx_signing.key 
state=present


- name: nginx | Adding sources.list deb url for nginx
lineinfile: dest=/etc/apt/sources.list line="deb
http://nginx.org/packages/mainline/ubuntu/ xenial nginx"

- name: nginx | Updating apt cache
apt:
update_cache: yes

- name: nginx | Installing nginx
apt:
pkg: nginx
state: latest

- name: nginx | Starting nginx
service:
name: nginx
state: started



Here is an example with indentation that should work.

- hosts: AWS_Slave
  tasks:
- name: nginx
  apt_key: url=http://nginx.org/keys/nginx_signing.key state=present

- name: nginx | Adding sources.list deb url for nginx
  lineinfile: dest=/etc/apt/sources.list line="deb 
http://nginx.org/packages/mainline/ubuntu/ xenial nginx"


- name: nginx | Updating apt cache
  apt:
update_cache: yes

- name: nginx | Installing nginx
  apt:
pkg: nginx
state: latest

- name: nginx | Starting nginx
  service:
name: nginx
state: started

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