Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-11 Thread jean-christophe manciot
My environment is the following:
- ubuntu 16.04 4.4.0-34
- ansible 2.1.1.0 *stable* from official PPA (not from sources)
- latest commit of extra modules pointed by "library"

On Fri, Aug 12, 2016 at 1:26 AM, Peter Sprygada 
wrote:

> Thats really strange... I just rebuilt an Ansible env using the latest
> from source and everything works fine.
>
> https://gist.github.com/privateip/88b68576d7c0dd8d8e566ce3ec75e4a8
>
> Will try to look at exactly which commit the asa_* modules showed up in
> the submodule a bit later but it definitely is working with the latest.
>
>
>
> On Thu, Aug 11, 2016 at 2:01 PM, jean-christophe manciot <
> actionmysti...@gmail.com> wrote:
>
>>
>> @Tony Reveal
>> @ Peter Sprygada
>> Tony is right, I've just tried the asa_command and experienced the same
>> issue:
>>
>> TASK [asa_pull_config : Fetching config from the remote node]
>> **
>> fatal: [172.21.100.252]: FAILED! => {"failed": true, "msg": "Could not
>> find imported module support code for asa_command.  Looked for either * or
>> asa"}
>>
>> despite having the "library" variable from /etc/ansible/ansible.cfg
>> pointing at the right folder containing the cloned
>> https://github.com/ansible/ansible-modules-extras.
>> The issue is the same whatever the asa_* call is: acl, config, template
>> or command.
>>
>> --
>> 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/ms
>> gid/ansible-project/7e7d5823-8087-4789-8771-0b85381f9c74%
>> 40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/QWMQJCUavV0/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/CAEkdrMg02s42KAw4DZw0LdhiVMb%
> 3DjByc49g0ByX%2Bdy4YyerWwg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jean-Christophe

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


[ansible-project] Configure isolated servers without Internet access

2016-08-11 Thread David Li
Hi,

I am relatively new to Ansible. I need to use Ansible from a dev laptop to 
set up some servers (both Ubuntu and Centos) that are isolated without any 
Internet access. The laptop has Internet access for development and it can 
ssh into these servers. 

I wonder what's the best practice in this case. I am trying to avoid 
setting a mirror repo on the laptop.  I am also trying to avoid manually 
figuring out all the packages along with their dependencies. Is there any 
way that Ansbile modules (such as yum or apt) can help to download and 
assemble all packages on the laptop and then copy and install them on the 
servers?

Thanks.

David

-- 
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/b6188760-511a-49c6-995f-6933fbc8a999%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-11 Thread Peter Sprygada
Thats really strange... I just rebuilt an Ansible env using the latest from
source and everything works fine.

https://gist.github.com/privateip/88b68576d7c0dd8d8e566ce3ec75e4a8

Will try to look at exactly which commit the asa_* modules showed up in the
submodule a bit later but it definitely is working with the latest.



On Thu, Aug 11, 2016 at 2:01 PM, jean-christophe manciot <
actionmysti...@gmail.com> wrote:

>
> @Tony Reveal
> @ Peter Sprygada
> Tony is right, I've just tried the asa_command and experienced the same
> issue:
>
> TASK [asa_pull_config : Fetching config from the remote node]
> **
> fatal: [172.21.100.252]: FAILED! => {"failed": true, "msg": "Could not
> find imported module support code for asa_command.  Looked for either * or
> asa"}
>
> despite having the "library" variable from /etc/ansible/ansible.cfg
> pointing at the right folder containing the cloned https://github.com/
> ansible/ansible-modules-extras.
> The issue is the same whatever the asa_* call is: acl, config, template or
> command.
>
> --
> 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/7e7d5823-8087-4789-8771-0b85381f9c74%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/CAEkdrMg02s42KAw4DZw0LdhiVMb%3DjByc49g0ByX%2Bdy4YyerWwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Can't find boto for ansible EC2 module

2016-08-11 Thread Troy Cauble
I found the solution elsewhere you can set this via -e

   -e 'ansible_python_interpreter="/usr/bin/env python"'

On Thursday, August 11, 2016 at 3:34:18 PM UTC-4, Troy Cauble wrote:
>
> What can I do if I'm not using an inventory file?  I'm exec-ing from a 
> script with "ansible-playbook -i , ...".
>
> Also, the ansible and ansible-playbook scripts in my_virtualenv_dir/bin 
> start with
> #!/my_virtualenv_dir/bin/python2
>
> So they're using the right python to start...
>

-- 
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/904ab33f-d30d-4d50-b0cb-090ab0096cd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Can't find boto for ansible EC2 module

2016-08-11 Thread Troy Cauble
What can I do if I'm not using an inventory file?  I'm exec-ing from a 
script with "ansible-playbook -i , ...".

Also, the ansible and ansible-playbook scripts in my_virtualenv_dir/bin 
start with
#!/my_virtualenv_dir/bin/python2

So they're using the right python to start...

-- 
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/78c72b3d-6abc-4971-a839-e75e376e227a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running Python script, running into /usr/bin/env: No such file or directory

2016-08-11 Thread Kai Stian Olstad

On 11. aug. 2016 20:00, SC wrote:

Thanks for the reply Kai! I took a look at the /etc/default/login file on
the Solaris box and it looks like the PATH lines are commented out:

# PATH sets the initial shell PATH variable
#
#PATH=/usr/bin:

# SUPATH sets the initial shell PATH variable for root
#
#SUPATH=/usr/sbin:/usr/bin

So if it's not set in the /etc/default/login file, I'm thinking Ansible is
pulling from somewhere else? As Brian said, Ansible is attempting to run in
a non-interactive manner and where it's pulling the PATH from is unknown to
me.


I'm pretty sure that hard coded values is in use if PATH isn't set in 
/etc/default/login.


Ansible is just using the environment given by the OS when it logs in 
over ssh.
On Linux, PAM is set to read the /etc/environment(and some other files 
depending on distribution) when you login with ssh, on Solaris it's 
/etc/default/login.


Try to set the PATH and see what happens.

--
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/c103b4e4-d8f3-9efb-d398-fedc7b296066%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-11 Thread jean-christophe manciot

@Tony Reveal 
@ Peter Sprygada
Tony is right, I've just tried the asa_command and experienced the same 
issue:

TASK [asa_pull_config : Fetching config from the remote node] 
**
fatal: [172.21.100.252]: FAILED! => {"failed": true, "msg": "Could not find 
imported module support code for asa_command.  Looked for either * or asa"}

despite having the "library" variable from /etc/ansible/ansible.cfg 
pointing at the right folder containing the 
cloned https://github.com/ansible/ansible-modules-extras.
The issue is the same whatever the asa_* call is: acl, config, template or 
command.

-- 
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/7e7d5823-8087-4789-8771-0b85381f9c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running Python script, running into /usr/bin/env: No such file or directory

2016-08-11 Thread SC
Thanks for the reply Kai! I took a look at the /etc/default/login file on 
the Solaris box and it looks like the PATH lines are commented out:

# PATH sets the initial shell PATH variable

#

#PATH=/usr/bin:


# SUPATH sets the initial shell PATH variable for root

#

#SUPATH=/usr/sbin:/usr/bin


So if it's not set in the /etc/default/login file, I'm thinking Ansible is 
pulling from somewhere else? As Brian said, Ansible is attempting to run in 
a non-interactive manner and where it's pulling the PATH from is unknown to 
me.

-- 
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/02062488-be42-49e3-aa0f-61b718138d86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows Playbook Fails Using win_user

2016-08-11 Thread Anfield
That was perfect. 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/59d93e6b-46c4-428d-9cee-6367d8bfda78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows Playbook Fails Using win_user

2016-08-11 Thread Matt Davis
Unless it's just Google Groups eating the formatting, it looks like your 
YAML indentation is hosed up (Ansible's failing on the control side, not on 
the Windows module). YAML is whitespace-sensitive, so it should look like:

- name: Add a user
  hosts: all
  gather_facts: false
  tasks:
  - name: Add User
win_user:
  name: ansible1
  password: "@ns1bl3"
  state: present
  groups: ["Users"]


On Thursday, August 11, 2016 at 7:47:37 AM UTC-7, Anfield wrote:
>
> Trying to run a playbook to add a user on a windows server and getting 
> errors, see below
>
> [root@localhost group_vars]# ansible-playbook createuser.yml
> ERROR! Syntax Error while loading YAML.
>
> The error appears to have been in 
> '/etc/ansible/group_vars/createuser.yml': line 2, column 1, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
> - name: Add a user
> hosts: all
> ^ here
>
>
> I have a /etc/ansible/group_vars/windows.yml setup as follows
>
> ansible_ssh_user: Administrator
> ansible_ssh_pass: Liverpool27
> ansible_ssh_port: 5986
> ansible_connection: winrm
> ansible_winrm_server_cert_validation: ignore
>
>
> I have a /etc/ansible/group_vars/createuser.yml as follows
>
> - name: Add a user
> hosts: all
> gather_facts: false
> tasks:
> - name: Add User
> win_user:
> name: ansible1
> password: "@ns1bl3"
> state: present
> groups: ["Users"]
>
>
> Also have a hosts file setup under /etc/ansible/hosts
>
>
> [windows]
> 10.10.128.0
>
>
> When I run the command manually with the one liner it works fine - 
> ansible windows --module-name=win_user --args="name=ansible 
> password=fooBar1+3"
>
> If I try and run it with the following it still doesnt work -> 
>  ansible-playbook -i 10.10.128.0 createuser.yml
>
> Suggestions welcome... 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/7a06eea6-4106-41f6-a443-afbfeb07799b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] assign custom host name to ec2 instances

2016-08-11 Thread eric_skaggs
When deploying an autoscaling group I want to be able to add custom 
hostnames to the instances for both initial deploy and scaling up and down.

hostnames would be something like app-server01 app-server02.  Then when we 
scale up it would increment 03/04/etc.

Thanks,
Eric

-- 


This email communication (including any attachments) contains information 
from Answers Corporation or its affiliates that is confidential and may be 
privileged. The information contained herein is intended only for the use 
of the addressee(s) named above. If you are not the intended recipient (or 
the agent responsible to deliver it to the intended recipient), you are 
hereby notified that any dissemination, distribution, use, or copying of 
this communication is strictly prohibited. If you have received this email 
in error, please immediately reply to sender, delete the message and 
destroy all copies of it. If you have questions, please email 
le...@answers.com. 

If you wish to unsubscribe to commercial emails from Answers and its 
affiliates, please go to the Answers Subscription Center 
http://campaigns.answers.com/subscriptions to opt out.  Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-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/19f83d44-e62c-4d33-bfa5-b2bdc4a670ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to assign instance ID to a variable

2016-08-11 Thread AC
Hi,

I am using ansible to get the instance ID of a EC2 instance on AWS through 
the use of ec2_remote_facts. 
How do I assign the instance ID to a variable using set_fact? 

I was trying to use the following script but it did not work. 

---
- name: Set ip instance on AWS instance 
  hosts: localhost


  tasks: 


  - ec2_remote_facts:
 region: eu-west-1
 filters:
  "tag:Name": test_instance
register: ec2_info


#  - debug: var=ec2_info


#  - name: Show one variable
#debug: msg="{{ item.id }}"
#with_items: '{{ ec2_info.instances }}'
  
  - set_fact:
 haproxy_id: "{{ ec2_info.instances_id }}"
 #haproxy_id: "{{ item.id }}"
 #with_items: '{{ ec2_info.instances }}'


  - debug: msg="{{ haproxy_id }}"
  
  
[root@test ansible]# ansible-playbook set_up_instance.yml 


PLAY [Set ip instance on AWS instance ] 



TASK [ec2_remote_facts] 

ok: [localhost]


TASK [set_fact] 

fatal: [localhost]: FAILED! => {"failed": true, "msg": "'dict object' has 
no attribute 'instances_id'"}


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


PLAY RECAP 
*
localhost  : ok=1changed=0unreachable=0failed=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/895d8cf8-d8d1-489d-ba5c-e891bf260eea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Simple cisco IOS show version

2016-08-11 Thread Bharath Bharadwaj
Tried your example ,it returns with syntax error at line 11, column 9

The offending line appears to be:

 - show version
hosts: "{{ inventory_hostname }}"
^ here

On Wednesday, August 10, 2016 at 11:36:41 AM UTC-4, Peter Sprygada wrote:
>
> See example here: https://gist.github.com/privateip/11b042e569585ee9248a
>
> On Wed, Aug 10, 2016 at 11:12 AM, pixel fairy  > wrote:
>
>> start with 
>>
>> - hosts: routers
>>   vars: 
>> ...
>>   tasks:
>> ...
>>
>>
>>
>> On Wednesday, August 10, 2016 at 7:32:23 AM UTC-7, Bharath Bharadwaj 
>> wrote:
>>>
>>> Hi All,
>>>
>>> I'm new to Ansible and yml, my goal is to automate a part of network 
>>> operation, I just want to start with a very simple output, copied below is 
>>> my playbook, I'm trying to run a show version, but i'm getting error when 
>>> executing the output, yet when i try the same yml script through yml 
>>> validator, there is no errors.
>>>
>>> My Playbook
>>>
>>> vars:
>>> cli:
>>> host: "{{ network }}"
>>> username: admin
>>> password: test@123
>>> transport: cli
>>>
>>> tasks:
>>> - name: run multiple commands on remote nodes
>>>   ios_command:
>>>   - commands: show version
>>>   - provider: "{{ cli }}"
>>>   - transport: cli
>>>
>>> Error:
>>> "ERROR! playbooks must be a list of plays
>>>
>>> The error appears to have been in 
>>> '/etc/ansible/playbooks/cisco_ios.yml': line 1, column 1, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>> The offending line appears to be:
>>>
>>>
>>> vars:
>>> ^ here"
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/0e2c7491-cd53-4d07-8b20-c6870c600fc4%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/8559881e-4133-4b80-a1d2-12f3091923a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Simple cisco IOS show version

2016-08-11 Thread Bharath Bharadwaj
I tried with your example, this also appears to be having syntax error, 
error as followed.

The error appears to have been in '/etc/ansible/playbooks/cisco_ios.yml': 
line 11, column 9, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

 - show version
hosts: "{{ inventory_hostname}}"
^ here

Regards,

On Wednesday, August 10, 2016 at 10:32:23 AM UTC-4, Bharath Bharadwaj wrote:
>
> Hi All,
>
> I'm new to Ansible and yml, my goal is to automate a part of network 
> operation, I just want to start with a very simple output, copied below is 
> my playbook, I'm trying to run a show version, but i'm getting error when 
> executing the output, yet when i try the same yml script through yml 
> validator, there is no errors.
>
> My Playbook
>
> vars:
> cli:
> host: "{{ network }}"
> username: admin
> password: test@123
> transport: cli
>
> tasks:
> - name: run multiple commands on remote nodes
>   ios_command:
>   - commands: show version
>   - provider: "{{ cli }}"
>   - transport: cli
>
> Error:
> "ERROR! playbooks must be a list of plays
>
> The error appears to have been in '/etc/ansible/playbooks/cisco_ios.yml': 
> line 1, column 1, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>
> vars:
> ^ here"
>

-- 
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/6c68e26f-7200-4713-a43a-8aff1b42e588%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Windows Playbook Fails Using win_user

2016-08-11 Thread Anfield
Trying to run a playbook to add a user on a windows server and getting 
errors, see below

[root@localhost group_vars]# ansible-playbook createuser.yml
ERROR! Syntax Error while loading YAML.

The error appears to have been in '/etc/ansible/group_vars/createuser.yml': 
line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:
- name: Add a user
hosts: all
^ here


I have a /etc/ansible/group_vars/windows.yml setup as follows

ansible_ssh_user: Administrator
ansible_ssh_pass: Liverpool27
ansible_ssh_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore


I have a /etc/ansible/group_vars/createuser.yml as follows

- name: Add a user
hosts: all
gather_facts: false
tasks:
- name: Add User
win_user:
name: ansible1
password: "@ns1bl3"
state: present
groups: ["Users"]


Also have a hosts file setup under /etc/ansible/hosts


[windows]
10.10.128.0


When I run the command manually with the one liner it works fine - 
ansible windows --module-name=win_user --args="name=ansible 
password=fooBar1+3"

If I try and run it with the following it still doesnt work -> 
 ansible-playbook -i 10.10.128.0 createuser.yml

Suggestions welcome... 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/987d089f-56f4-44d6-8a12-8a29175d72b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: simple true/false statements in playbooks

2016-08-11 Thread skinnedknuckles
Okay, it works now.  Casting the variable as an int was key but I forgot 
the curly brackets around the variable name.  Here is how the last line 
should be.  Thanks Kai for your help!!

  when: ({{tisDatabaseAge}} > 60)


On Wednesday, August 10, 2016 at 4:31:57 PM UTC-5, skinnedknuckles wrote:
>
> Management Node:
>
>- CentOs 7.1
>- Ansible 2.1
>
> Remote Node:
>
>- Windows 7
>- Powershell 3.0
>
> I'm trying to display an error message if the file ADS800Dice.s3db has 
> not been modified for more than an hour.  The problem in in the last line. 
>  If I leave the quotes around the number 60, it gives me a false negative 
> (evaluates to true when false).  When I remove the quote around the number 
> 60, it gives me a false positive (evaluates to false when true).  I'd 
> appreciate any help with this.
>
>
>
>   - name: GET AGE OF DATABASE ADS800DICE.S3DB ON SHARE
> script: minutesSinceAccess.ps1 "{{uncServer}}" 
> "{{path}}/ADS800Dice.s3db" "seagate\{{userName}}" "password"
> register: result
>   - set_fact: tisDatabaseAge={{result.stdout_lines.4}}
>   - name: CHECK AGE OF ADS800DICE.S3DB ON SHARE
> debug: msg="ERROR! ADS800DICE.S3DB HAS NOT BEEN UPDATED FOR 
> {{tisDatabaseAge}} MINUTES."
> when: (tisDatabaseAge > "60")
>
>

-- 
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/8259df9c-5e10-4fe4-ba30-7e3f8b436354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Boolean variable being capitalized in templates? Best practice to work around?

2016-08-11 Thread Andrew Feller
Maybe to_json is better than to_yaml and apparently have been superseded by 
to_nice_json / to_nice_yaml but the to_yaml / to_nice_yaml filters are 
crap, not well documented within jinja2, and require understanding the 
actual pyyaml library function interface to make work.  In short, all of it 
feels bad.

On Wednesday, February 11, 2015 at 8:38:13 AM UTC-5, Brian Coca wrote:
>
> the capitalized boolean happens because this is how valid booleans 
> work in jinja2/python, which is what ansible uses internally. 
>
> as @tom suggested there is a to_json filter which will output correct 
> json from ansible data structures/variables. 
>
>
>
> -- 
> 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/35611c61-3450-422f-aa56-806cb7e51517%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Behavior change related to roles_path config with relative include

2016-08-11 Thread Julien Tognazzi
Hi list,

I upgraded ansible with the latest epel-testing 
version ansible-2.1.1.0-1.el7.noarch and noticed a change with the 
roles_path configuration.

This is my roles_path:
roles_path= /etc/ansible/roles:../base/roles:./roles

So I expect that if I run a playbook from /vagrant/ansible/somedir it will 
look for roles in /vagrant/ansible/base/roles and 
/vagrant/ansible/somedir/roles

But it doesn't seem to be the case anymore.

With 
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/local/share/ansible_modules/']

If running a play referencing non existant role, I have
$ pwd
/vagrant/ansible/somedir
$ansible-playbook test.yml -v
Using /etc/ansible/ansible.cfg as config file
ERROR! the role 'somerole' was not found in /vagrant/ansible/somedir/roles:/
vagrant/ansible/somedir:/etc/ansible/roles:
/etc/base/roles:/etc/ansible/roles


With
ansible 2.1.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/local/share/ansible_modules/']

Running the same play gives me:
$ pwd
/vagrant/ansible/somedir
$ansible-playbook test.yml -v


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


ERROR! the role 'somerole' was not found in /vagrant/ansible/somedir/roles:/
vagrant/ansible/somedir:/etc/ansible/roles:../base/roles:./roles


The behavior change is highlighted in yellow above.

Is this a regression ?

thanks for your explanation 

-- 
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/f089ad61-1a0c-4dd0-9813-0324ed5519f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: azure_rm_deployment error ansible 2.1.1.0 __init__() takes exactly 1 argument (2 given)

2016-08-11 Thread M Ghaleb
Hi Trond,

thank you for your reply, it turns out to be the msrest, we were using 
0.4.0 and it only works with 0.4.1.

I've updated it and it works now fine.

BR

On Wednesday, August 10, 2016 at 3:46:07 AM UTC+3, Trond Hindenes wrote:
>
> Could you please share an example playbook? We're using this module 
> without issues.
>
> On Tuesday, August 9, 2016 at 3:08:15 PM UTC+2, M Ghaleb wrote:
>>
>> Hi All,
>>
>> I'm trying to deploy an Azure template using the azure_rm_deployment 
>> module.
>>
>> ubuntu 14.04 TLS
>> ansible 2.1.1.0
>> azure 2.0.0rc5
>>
>> I get the below error:
>>
>> TASK [ansible-azure-provisioner : Deploying your Azure Jumphox] ***
>> task path: 
>> /var/lib/awx/projects/_9__ansible_cloudfirst_master/roles/internal/ansible-azure-provisioner/tasks/main.yml:11
>> <40.118.63.1> ESTABLISH LOCAL CONNECTION FOR USER: awx
>> <40.118.63.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
>> $HOME/.ansible/tmp/ansible-tmp-1470747867.04-122827512832920 `" && echo 
>> ansible-tmp-1470747867.04-122827512832920="` echo 
>> $HOME/.ansible/tmp/ansible-tmp-1470747867.04-122827512832920 `" ) && sleep 
>> 0'
>> <40.118.63.1> PUT /tmp/tmpxr0A6K TO 
>> /var/lib/awx/.ansible/tmp/ansible-tmp-1470747867.04-122827512832920/azure_rm_deployment
>> <40.118.63.1> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 
>> LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
>> /var/lib/awx/.ansible/tmp/ansible-tmp-1470747867.04-122827512832920/azure_rm_deployment;
>>  
>> rm -rf 
>> "/var/lib/awx/.ansible/tmp/ansible-tmp-1470747867.04-122827512832920/" > 
>> /dev/null 2>&1 && sleep 0'
>> fatal: [40.118.63.1]: FAILED! => {"changed": false, "failed": true, 
>> "invocation": {"module_name": "azure_rm_deployment"}, "module_stderr": 
>> "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:318:
>>  
>> SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject 
>> Name Indication) extension to TLS is not available on this platform. This 
>> may cause the server to present an incorrect TLS certificate, which can 
>> cause validation failures. You can upgrade to a newer version of Python to 
>> solve this. For more information, see 
>> https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.\n 
>>  
>> SNIMissingWarning\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122:
>>  
>> InsecurePlatformWarning: A true SSLContext object is not available. This 
>> prevents urllib3 from configuring SSL appropriately and may cause certain 
>> SSL connections to fail. You can upgrade to a newer version of Python to 
>> solve this. For more information, see 
>> https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.\n
>>  
>>  InsecurePlatformWarning\nTraceback (most recent call last):\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_module_azure_rm_deployment.py\", line 660, in 
>> \nmain()\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_module_azure_rm_deployment.py\", line 656, in 
>> main\nAzureRMDeploymentManager()\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_module_azure_rm_deployment.py\", line 438, in 
>> __init__\nsupports_check_mode=False)\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
>>  
>> line 192, in __init__\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_module_azure_rm_deployment.py\", line 449, in 
>> exec_module\ndeployment = self.deploy_template()\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_module_azure_rm_deployment.py\", line 493, in 
>> deploy_template\n   
>>  self.rm_client.resource_groups.create_or_update(self.resource_group_name, 
>> params)\n  File 
>> \"/tmp/ansible_Qp3l_v/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
>>  
>> line 596, in rm_client\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/azure/mgmt/resource/resources/resource_management_client.py\",
>>  
>> line 141, in __init__\nself._serialize = 
>> Serializer(client_models)\nTypeError: __init__() takes exactly 1 argument 
>> (2 given)\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
>>
>>
>>
>>
>> Any idea? I've installed urllib3[secure] no luck
>>
>> MG
>>
>

-- 
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/c645cf2d-2e32-467c-84df-2b544910240e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running Python script, running into /usr/bin/env: No such file or directory

2016-08-11 Thread Kai Stian Olstad

On 11. aug. 2016 09:14, SC wrote:

Do you know if it's possible to add to the PATH in Ansible's
non-interactive run somehow? I do have a ghetto workaround where I check
the ansible_distribution and make a conditional in the playbook to point to
a different script depending on the distro but it's an ugly implementation
I think. Thanks for replying!


Long time since I work on Solaris, but IIRC you can change PATH in 
/etc/default/login.


--
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/86ff74ad-a2f0-c4d1-f3e6-adf7a83bc322%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Importing Python Custom Modules for Ansible to run?

2016-08-11 Thread Kai Stian Olstad

On 11. aug. 2016 09:26, SC wrote:

Probably a silly question, but is it possible to refer to another Python
file with the script module?


No, it has limited functionality.



For example, if I have abc.py and 123.py, if I import 123.py into the
abc.py python script (if I need some functions or whatever), both of these
files are not copied when I call the script module for abc.py in the
playbook.

Obviously, I didn't think ansible would check to make sure all the imports
are valid inside a Python script, but how can I get it to work otherwise?
Documentation (http://docs.ansible.com/ansible/script_module.html) doesn't
have any examples of this and I tried looking up: 'ansible python import
ansible' and other keywords with no real relevant results.

The only way I can think of doing this is copying both files over, then
running the script, then deleting the copied files after run?


You also has one other possibility, the documentation for the Script 
module also say this[1]:
"It is usually preferable to write Ansible modules than pushing scripts. 
Convert your script to an Ansible module for bonus points!"


[1] https://docs.ansible.com/ansible/script_module.html#notes

--
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/7fa1ae49-4507-1665-49fc-49173c317885%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Importing Python Custom Modules for Ansible to run?

2016-08-11 Thread SC
Probably a silly question, but is it possible to refer to another Python 
file with the script module?

For example, if I have abc.py and 123.py, if I import 123.py into the 
abc.py python script (if I need some functions or whatever), both of these 
files are not copied when I call the script module for abc.py in the 
playbook.

Obviously, I didn't think ansible would check to make sure all the imports 
are valid inside a Python script, but how can I get it to work otherwise? 
Documentation (http://docs.ansible.com/ansible/script_module.html) doesn't 
have any examples of this and I tried looking up: 'ansible python import 
ansible' and other keywords with no real relevant results.

The only way I can think of doing this is copying both files over, then 
running the script, then deleting the copied files after run?

Is there a way to copy 123.py to a default location, wherever the script 
module uses to copy abc.py so when ansible-playbook tries to run abc.py, 
123.py will already be there and import correctly. Afterwards, I can have 
the playbook delete 123.py to clean itself up. 

The other way to do it is to just copy the functions/stuff you need from 
123.py to abc.py but I was looking for a modular way to do this if 
possible. Any thoughts are appreciated, thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-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/3f4663a3-1be9-4274-b539-c9afafd96ce5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Running Python script, running into /usr/bin/env: No such file or directory

2016-08-11 Thread SC
Really appreciate your reply, it's very informative. I'm still not so 
familiar with Ansible so it's good to get someone else's take.

I put that debug line into the Playbook and got the following output:

Non-Solaris
"ansible_env": {
"CVS_RSH": "ssh",
"G_BROKEN_FILENAMES": "1",
"HOME": "/home/admin_name_here",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US.UTF-8",
"LC_MESSAGES": "en_US.UTF-8",
"LESSOPEN": "||/usr/bin/lesspipe.sh %s",
"LOGNAME": "admin_name_here",
"MAIL": "/var/mail/admin_name_here",
*"PATH": "/usr/local/bin:/bin:/usr/bin",*
"PWD": "/home/admin_name_here",
"PYTHONPATH": "",
"SELINUX_LEVEL_REQUESTED": "",
"SELINUX_ROLE_REQUESTED": "",
"SELINUX_USE_CURRENT_RANGE": "",
"SHELL": "/bin/bash",
"SHLVL": "2",
"SSH_CLIENT": "REDACTED",
"SSH_CONNECTION": "REDACTED",
"SSH_TTY": "/dev/pts/0",
"TERM": "vt100",
"USER": "admin_name_here",
"_": "/usr/bin/python"
}

Solaris
"ansible_env": {
"HOME": "/export/home/solaris_admin_name_here",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US.UTF-8",
"LC_MESSAGES": "en_US.UTF-8",
"LOGNAME": "solaris_admin_name_here",
"MAIL": "/var/mail//solaris_admin_name_here",
*"PATH": "/usr/bin:/bin",*
"PWD": "/export/home/solaris_admin_name_here",
"PYTHONPATH": "",
"SHELL": "/usr/bin/bash",
"SHLVL": "1",
"SSH_CLIENT": "REDACTED",
"SSH_CONNECTION": "REDACTED",
"SSH_TTY": "/dev/pts/5",
"TERM": "vt100",
"TZ": "UTC",
"USER": "solaris_admin_name_here",
"_": "/bin/sh"
}

I've bolded the PATH for clarity. For the Non-Solaris box, Python is in 
/usr/bin/ which is in the PATH. However, for Solaris, only /usr/bin and 
/bin are there, when it looks like I need something like '/usr/local/bin/' 
(for /usr/local/bin/python). I'm thinking this might be the issue?

Do you know if it's possible to add to the PATH in Ansible's 
non-interactive run somehow? I do have a ghetto workaround where I check 
the ansible_distribution and make a conditional in the playbook to point to 
a different script depending on the distro but it's an ugly implementation 
I think. Thanks for replying!

-- 
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/98a36ced-cfa9-4182-8f61-c090f5871a29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.