[ansible-project] syntax error while putting mapped values in arguments in ansible playbook

2018-11-13 Thread visar
Hello Experts,

Good Day!!

I was searching for some solution on my ansible playbook where i want run 
an application inbuilt .sh script with arguments and corresponding mapped 
values.

the below is the command which i can successfully execute in terminal 
window.

I tried with both shell and command and script modules in ansible, but no 
luck..

./repotools-jts.sh -setup repositoryURL=https://myappurl:9443/jts 
responsefile=response.properties adminUserId=mydomainID adminPassword=passwd

-- 
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/2c93e562-f5ff-46d9-87b5-1c8e841ff9c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Open Command prompt as RunAsAdministrator and install setup.exe

2018-11-13 Thread mvramana212
Thanks Jordan for your prompt response.

Issue was with argument which i was passing in win_command. 
win_command: 'C:\temp\setup.exe /SP /VERYSILENT /DIR=C:/temp* 
/LOG=C:/temp/Install.log'*

Here *temp *directory was not there to create log file but after creating 
temp directory, i'm able to install setup.exe file successfully.

Also as you mentioned, become method is not require to run 'RunAs 
Administrator'. I'm able to install setup.exe without become method.

Regards,
Venkat


On Wednesday, 14 November 2018 01:53:29 UTC+5:30, Jordan Borean wrote:
>
> Become isn't necessarily used to 'run as administrator' in Windows but 
> rather to change the logon from a network to interactive logon with 
> credentials to use for delegation. Normally a WinRM process is run with the 
> full Administrative rights of an account and you can verify that by running
>
> - name: getlogon details for current user
>   win_whoami:
>
> This will return a whole bunch of information but if the label key 
> contains a 'High Mandatory Label' you know you are running as an admin. In 
> older versions of Ansible, a become task may not have admin rights and 
> since 2.5 it is done as a best effort attempt. I would do the below to 
> verify you are least get the High Mandatory Label returned when using 
> become to verify that process is run with admin rights as well.
>
> - name: test whoami with become
>   win_whoami:
>   become: yes
>   become_method: runas
>   become_user: Administrator
>
> As for why the process is still running it could be a few different things;
>
>- Become runs the task in a pseudo interactive logon so it may be 
>prompting the user for something causing it to hang
>- The args you are using aren't the correct silent args for the process
>- Some else?
>
> What I would try
>
>- Run the same command locally and see if it works or not
>- Check the log file when being installed with Ansible to see if 
>there's anything in there that might indicate what it's waiting for
>- Try running the task with async and become, this changes a few 
>things with how the console is spawned and killed so may work for you
>- Use procexp to see what processes are still running, whether the 
>main powershell exe that executes the module is still running, if 
> setup.exe 
>is still running and so on.
>
>
> Thanks
>
> Jordan
>
>

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


Re: [ansible-project] ssh to remote node and run CLI

2018-11-13 Thread Abdul Rahim
Thans Brian ,

It fails with following

root@ansibile-launch:~/ansible/tasks/add-compute# ansible-playbook -i
inventory.yml add-compute.yml -
ansible-playbook 2.7.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0
20160609]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
/root/ansible/tasks/add-compute/inventory.yml did not meet host_list
requirements, check plugin documentation if this is unexpected
/root/ansible/tasks/add-compute/inventory.yml did not meet script
requirements, check plugin documentation if this is unexpected
Parsed /root/ansible/tasks/add-compute/inventory.yml inventory source with
yaml plugin
ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to have been in
'/root/ansible/tasks/add-compute/add-compute.yml': line 11, column 23, but
may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - name: Copy Test
  ansible_user: "{{build_username}}"
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

with_items:
  - {{ foo }}

Should be written as:

with_items:
  - "{{ foo }}"

root@ansibile-launch:~/ansible/tasks/add-compute#

root@ansibile-launch:~/ansible/tasks/add-compute# cat add-compute.yml
---
# Demo Adding Compute Node
- name: Adding Compute Node
  hosts: build_node
  connection: local
  gather_facts: no


  tasks:
  - name: Copy Test
  ansible_user: "{{build_username}}"
  ansible_ssh_pass: "{{build_password}}"
  ansible_connection: ssh
  command: cp /root/arahim/ansible/tasks/add-compute.yml
/root/arahim/ansible/tasks/add-compute.yml.bak
root@ansibile-launch:~/ansible/tasks/add-compute# cat inventory.yml
fabric01:
  hosts:
build_node:
  build_host: 192.168.115.101
  build_username: root
  build_password: 123Abdul123


It does work with below


root@ansibile-launch:~/ansible/tasks/add-compute# ansible-playbook -i
new_inventory test.yml
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user
and make sure become_method is 'sudo' (default). This feature will be
removed in version 2.9. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.

PLAY [all]
**

TASK [Gathering Facts]
**
ok: [192.168.115.101]

TASK [Copy file]

changed: [192.168.115.101]

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

root@ansibile-launch:~/ansible/tasks/add-compute# cat new_inventory
[hosts]
192.168.115.101 ansible_connection=ssh ansible_ssh_user=root
ansible_ssh_pass=123Abdul123

root@ansibile-launch:~/ansible/tasks/add-compute# cat test.yml
---
- hosts: all
  user: root
  vars:
createuser: 'ansible'
createpassword: '123Abdul123'
  tasks:
  - name: Copy file
command: cp /root/arahim/ansible/tasks/add-compute.yml
/root/arahim/ansible/tasks/add-compute.yml.bak
sudo: true


Not sure what is wrong with the yml version of inventory and the variables
called .. but I am able to now make progress , thanks for getting back to
me on this

Regards,
AR

On Wed, Nov 14, 2018 at 1:26 PM Brian Coca  wrote:

> Without an error I can only guess, one thing i've noticed is that you
> are incorrectly formatting the task
>
> - name: return motd to registered var
>   command: 'cp /root/setup_data.yaml /root/setup_data.yaml.bak'
>   vars:
> ansible_user= "{{build_username}}"
> ansible_ssh_pass= "{{build_password}}"
>
>
>
> --
> --
> 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 

[ansible-project] "msg": "Could not find the requested service x: "

2018-11-13 Thread Ronnie10
Hi all,

I have a custom service script which I have copied to my vagrant centos 
/etc/systemd/system folder, when I run using ansible-playbook, everything 
seems ok. 

But when I run molecule test, it always give me"msg": "Could not find 
the requested service x: "

Anything I can try to fix 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/567403a7-ff78-4a99-a96c-e64657d9bbca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] - name: restart Zookeeper service service: name=zookeeper.service state=restarted

2018-11-13 Thread Ronnie10
Hi all,

I have copied my x.services file to /etc/systemd/system, but when I run my 
ansible script with molecule test, it always fail with the following 
message,"msg": "Could not find the requested service x: "

If I run on ansible-playbook alone, everything runs perfectly.

Any idea what can I fix?

-- 
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/20b9d703-bed6-4dc8-b560-c540852720e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ssh to remote node and run CLI

2018-11-13 Thread Brian Coca
Without an error I can only guess, one thing i've noticed is that you
are incorrectly formatting the task

- name: return motd to registered var
  command: 'cp /root/setup_data.yaml /root/setup_data.yaml.bak'
  vars:
ansible_user= "{{build_username}}"
ansible_ssh_pass= "{{build_password}}"



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


[ansible-project] LOOP_CONTROL with ansible

2018-11-13 Thread Dhara Patel
Hi,

When i run my playbook i run into this issue. It pops us as Warning.

*[WARNING]: The loop variable 'item' is already in use. You should set the 
`loop_var` value in the `loop_control` option*

*for the task to something else to avoid variable collisions and unexpected 
behavior.*


*main.yml*

- include: groups.yml


groups.yml

- include: ec2_gr.yml


ec2_gr.yml

- name: 'ec2 groups'
ec2_group:
name: '{{ item.key }}'
description: '{{ item.value.description }}'
vpc_id: '{{ vpc_net_facts.id }}'
region: '{{ region }}'
rules: '{{ item.value.rules }}'

rules_egress: '{{ default_egress_rule if item.value.rules_egress is not 
defined else item.value.rules_egress }}'
when: ec2groups is defined
with_dict: '{{ ec2groups | default({}) }}'
register: tag_ec2groups
- set_fact:
group: '{{ ec2groups.keys() + group }}'
when: ec2groups is defined I see a warning on above line. I have such issue 
with a lot of tasks. I don't understand loop_control that well. I tried to 
provide that variable after register: but still running into issue.


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


[ansible-project] ssh to remote node and run CLI

2018-11-13 Thread Abdul Rahim
Hello Experts,

As you can see struggling through basic tasks will appreciate any pointers
, using ansible version 2.7

 cat inventory.yml
fabric01:
  hosts:
build_node:
  build_host: 192.168.115.101
  build_username: root
  build_password: 123Abdul123

root@ansibile-launch:~/ansible/tasks/add-compute# cat add-compute.yml
---
# Demo Adding Compute Node
- name: Adding Compute Node
  hosts: build_node
  connection: local
  gather_facts: no


  tasks:
  - name: return motd to registered var
ansible_user= "{{build_username}}"
ansible_ssh_pass= "{{build_password}}"
command: 'cp /root/setup_data.yaml /root/setup_data.yaml.bak'

Appreciate if you can please int me in the right direction here ..

Regards,
AR

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


Re: [ansible-project] Re: CPU

2018-11-13 Thread stifan kristi
pls check:
https://en.wikipedia.org/wiki/System_monitor
there's a lot of tools to use for monitoring system, and ansible is not for 
monitoring, perhaps you can combine it, ansible just used for manage it's 
state ensure that the monitoring service is running

best regards,
stifan

-- 
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/fc1b41b0-a365-45bd-9a83-84377ff27b64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
Lucas or someone can help me with this, currently on my krb5.config i added
only 1 h...@domain.com, but if i want to run on multiple windows machines
do i need to add all my hosts on krb5.config file.

thanks,
Narmada


On Tue, Nov 13, 2018 at 4:21 PM Nk Chitturi  wrote:

> Thanks all,
> I am able to run ping module on windows machines.
>
> On Tuesday, November 13, 2018 at 3:47:28 PM UTC-8, Nk Chitturi wrote:
>>
>> I ran this script multiple times on my windows machine but no use
>> if i change in my vars to http, it is giving very big error
>> [nchitturi@sjc04d1shdwb51 ansible-windows]$ ansible-playbook
>> windows_ping.yaml -i inventory.txt
>>
>> PLAY [ping test]
>> **
>>
>> TASK [Gathering Facts]
>> 
>> ok: [servername]
>>
>> TASK [ping test]
>> **
>>  [WARNING]: FATAL ERROR DURING FILE TRANSFER:
>>
>> fatal: [SJC04D1SHDWB01.SDLC.TESLAMOTORS.COM]: FAILED! => {"msg": "winrm
>> send_input failed; \nstdout: Unable to initialize device PRN\r\nUnable to
>> initialize device PRN\r\nUnable to initialize device PRN\r\n\nstderr
>> ANSIBALLZ_WRAPPER : The term 'ANSIBALLZ_WRAPPER' is not recognized as the
>> name of a cmdlet, function, script file, or \r\noperable program. Check the
>> spelling of the name, or if a path was included, verify that the path is
>> correct and try \r\nagain.\r\nAt line:1 char:1\r\n+ ANSIBALLZ_WRAPPER =
>> True # For test-module script to tell this is a A ...\r\n+
>> ~\r\n+ CategoryInfo  : ObjectNotFound:
>> (ANSIBALLZ_WRAPPER:String) [], CommandNotFoundException\r\n+
>> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
>> 'import' is not recognized as the name of a cmdlet, function, script file,
>> or operable program. \r\nCheck the spelling of the name, or if a path was
>> included, verify that the path is correct and try again.\r\nAt line:1
>> char:1\r\n+ import os\r\n+ ~~\r\n+ CategoryInfo  :
>> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
>> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
>> 'import' is not recognized as the name of a cmdlet, function, script file,
>> or operable program. \r\nCheck the spelling of the name, or if a path was
>> included, verify that the path is correct and try again.\r\nAt line:1
>> char:1\r\n+ import os.path\r\n+ ~~\r\n+ CategoryInfo  :
>> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
>> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
>> 'import' is not recognized as the name of a cmdlet, function, script file,
>> or operable program. \r\nCheck the spelling of the name, or if a path was
>> included, verify that the path is correct and try again.\r\nAt line:1
>> char:1\r\n+ import sys\r\n+ ~~\r\n+ CategoryInfo  :
>> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
>> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
>> 'import' is not recognized as the name of a cmdlet, function, script file,
>> or operable program. \r\nCheck the spelling of the name, or if a path was
>> included, verify that the path is correct and try again.\r\nAt line:1
>> char:1\r\n+ import __main__\r\n+ ~~\r\n+ CategoryInfo  :
>> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
>> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nscriptdir : The
>> term 'scriptdir' is not recognized as the name of a cmdlet, function,
>> script file, or operable \r\nprogram. Check the spelling of the name, or if
>> a path was included, verify that the path is correct and try again.\r\nAt
>> line:1 char:1\r\n+ scriptdir = None\r\n+ ~\r\n+ CategoryInfo
>>   : ObjectNotFound: (scriptdir:String) [],
>> CommandNotFoundException\r\n+ FullyQualifiedErrorId :
>> CommandNotFoundException\r\n \r\ntry: : The term 'try:' is not recognized
>> as the name of a cmdlet, function, script file, or operable program. Check
>> \r\nthe spelling of the name, or if a path was included, verify that the
>> path is correct and try again.\r\nAt line:1 char:1\r\n+ try:\r\n+ \r\n
>>   + CategoryInfo  : ObjectNotFound: (try::String) [],
>> CommandNotFoundException\r\n+ FullyQualifiedErrorId :
>> CommandNotFoundException\r\n \r\n__main__.__file__ : The term
>> '__main__.__file__' is not recognized as the name of a cmdlet, function,
>> script file, or \r\noperable program. Check the spelling of the name, or if
>> a path was included, verify that the path is correct and try
>> \r\nagain.\r\nAt 

Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
Thanks all,
I am able to run ping module on windows machines. 

On Tuesday, November 13, 2018 at 3:47:28 PM UTC-8, Nk Chitturi wrote:
>
> I ran this script multiple times on my windows machine but no use
> if i change in my vars to http, it is giving very big error
> [nchitturi@sjc04d1shdwb51 ansible-windows]$ ansible-playbook 
> windows_ping.yaml -i inventory.txt
>
> PLAY [ping test] 
> **
>
> TASK [Gathering Facts] 
> 
> ok: [servername]
>
> TASK [ping test] 
> **
>  [WARNING]: FATAL ERROR DURING FILE TRANSFER:
>
> fatal: [SJC04D1SHDWB01.SDLC.TESLAMOTORS.COM]: FAILED! => {"msg": "winrm 
> send_input failed; \nstdout: Unable to initialize device PRN\r\nUnable to 
> initialize device PRN\r\nUnable to initialize device PRN\r\n\nstderr 
> ANSIBALLZ_WRAPPER : The term 'ANSIBALLZ_WRAPPER' is not recognized as the 
> name of a cmdlet, function, script file, or \r\noperable program. Check the 
> spelling of the name, or if a path was included, verify that the path is 
> correct and try \r\nagain.\r\nAt line:1 char:1\r\n+ ANSIBALLZ_WRAPPER = 
> True # For test-module script to tell this is a A ...\r\n+ 
> ~\r\n+ CategoryInfo  : ObjectNotFound: 
> (ANSIBALLZ_WRAPPER:String) [], CommandNotFoundException\r\n+ 
> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term 
> 'import' is not recognized as the name of a cmdlet, function, script file, 
> or operable program. \r\nCheck the spelling of the name, or if a path was 
> included, verify that the path is correct and try again.\r\nAt line:1 
> char:1\r\n+ import os\r\n+ ~~\r\n+ CategoryInfo  : 
> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+ 
> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term 
> 'import' is not recognized as the name of a cmdlet, function, script file, 
> or operable program. \r\nCheck the spelling of the name, or if a path was 
> included, verify that the path is correct and try again.\r\nAt line:1 
> char:1\r\n+ import os.path\r\n+ ~~\r\n+ CategoryInfo  : 
> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+ 
> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term 
> 'import' is not recognized as the name of a cmdlet, function, script file, 
> or operable program. \r\nCheck the spelling of the name, or if a path was 
> included, verify that the path is correct and try again.\r\nAt line:1 
> char:1\r\n+ import sys\r\n+ ~~\r\n+ CategoryInfo  : 
> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+ 
> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term 
> 'import' is not recognized as the name of a cmdlet, function, script file, 
> or operable program. \r\nCheck the spelling of the name, or if a path was 
> included, verify that the path is correct and try again.\r\nAt line:1 
> char:1\r\n+ import __main__\r\n+ ~~\r\n+ CategoryInfo  : 
> ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+ 
> FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nscriptdir : The 
> term 'scriptdir' is not recognized as the name of a cmdlet, function, 
> script file, or operable \r\nprogram. Check the spelling of the name, or if 
> a path was included, verify that the path is correct and try again.\r\nAt 
> line:1 char:1\r\n+ scriptdir = None\r\n+ ~\r\n+ CategoryInfo
>   : ObjectNotFound: (scriptdir:String) [], 
> CommandNotFoundException\r\n+ FullyQualifiedErrorId : 
> CommandNotFoundException\r\n \r\ntry: : The term 'try:' is not recognized 
> as the name of a cmdlet, function, script file, or operable program. Check 
> \r\nthe spelling of the name, or if a path was included, verify that the 
> path is correct and try again.\r\nAt line:1 char:1\r\n+ try:\r\n+ \r\n  
>   + CategoryInfo  : ObjectNotFound: (try::String) [], 
> CommandNotFoundException\r\n+ FullyQualifiedErrorId : 
> CommandNotFoundException\r\n \r\n__main__.__file__ : The term 
> '__main__.__file__' is not recognized as the name of a cmdlet, function, 
> script file, or \r\noperable program. Check the spelling of the name, or if 
> a path was included, verify that the path is correct and try 
> \r\nagain.\r\nAt line:1 char:50\r\n+ scriptdir = 
> os.path.dirname(os.path.realpath(__main__.__file__))\r\n+  
> ~\r\n+ CategoryInfo
>   : ObjectNotFound: (__main__.__file__:String) [], 
> CommandNotFoundException\r\n+ 

Re: [ansible-project] openstack networks using ansible

2018-11-13 Thread Jonathan Lozada De La Matta
Hello,

The module documents are straight forward. On 2.7 you need to install
openstacksdk
and then authenticate with an auth dictionary or using the cloud.yml

On Tue, Nov 13, 2018 at 6:52 PM Abdul Rahim  wrote:

> Hi Ansible Experts,
>
> I am using ansible 2.7
>
> Can some one . please guide me to the steps required before I can use
> ansible to provision openstack/neutron networks using the os_network ,
> os_subnet , os_router and  os_port modules
>
> Regards,
> AR
>
> --
> 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/CAL7z%3Dge%3DAY%3DiEgf1Q9Qf7ci2NHCk7eYA8rtVB71nRwFPRoyjkQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
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/CAFYJA%2BKQZEyRmSGS%3DXBeOQ%2BvRpEMWOKw%3DASyecHjdZe3qM3FxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] openstack networks using ansible

2018-11-13 Thread Abdul Rahim
Hi Ansible Experts,

I am using ansible 2.7

Can some one . please guide me to the steps required before I can use
ansible to provision openstack/neutron networks using the os_network ,
os_subnet , os_router and  os_port modules

Regards,
AR

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


Re: [ansible-project] Re: CPU

2018-11-13 Thread ameya agashe
Ansible is not a monitoring tool. You need a monitoring tool. There are
many excellent tools out there. Respectfully, please don't use Nagios!

Ameya

On Wed, Nov 14, 2018 at 2:27 AM Brian Coca  wrote:

> nagios/naemon, zabbix, sar, etc ...many good ways to do this, but if you
> REALLY want to do shit in Ansible (I don't recommend):
>
> -  name: get RAM
>shell: free
>register: memory
>
> - name: cpu info
>shell top -n 1
>register: cpu
>
>
>
> --
> --
> 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/CACVha7c8w9W_UTU-PJmCbG24XUatJdVgDTYX8Cv0P4dsmWrVFQ%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/CAG9tf--KPoNuDHLJcqv8ETYq0_Ju0ZQ1gqQD1pqh3_Q_%2BtQzBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
I ran this script multiple times on my windows machine but no use
if i change in my vars to http, it is giving very big error
[nchitturi@sjc04d1shdwb51 ansible-windows]$ ansible-playbook
windows_ping.yaml -i inventory.txt

PLAY [ping test]
**

TASK [Gathering Facts]

ok: [servername]

TASK [ping test]
**
 [WARNING]: FATAL ERROR DURING FILE TRANSFER:

fatal: [SJC04D1SHDWB01.SDLC.TESLAMOTORS.COM]: FAILED! => {"msg": "winrm
send_input failed; \nstdout: Unable to initialize device PRN\r\nUnable to
initialize device PRN\r\nUnable to initialize device PRN\r\n\nstderr
ANSIBALLZ_WRAPPER : The term 'ANSIBALLZ_WRAPPER' is not recognized as the
name of a cmdlet, function, script file, or \r\noperable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try \r\nagain.\r\nAt line:1 char:1\r\n+ ANSIBALLZ_WRAPPER =
True # For test-module script to tell this is a A ...\r\n+
~\r\n+ CategoryInfo  : ObjectNotFound:
(ANSIBALLZ_WRAPPER:String) [], CommandNotFoundException\r\n+
FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
'import' is not recognized as the name of a cmdlet, function, script file,
or operable program. \r\nCheck the spelling of the name, or if a path was
included, verify that the path is correct and try again.\r\nAt line:1
char:1\r\n+ import os\r\n+ ~~\r\n+ CategoryInfo  :
ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
'import' is not recognized as the name of a cmdlet, function, script file,
or operable program. \r\nCheck the spelling of the name, or if a path was
included, verify that the path is correct and try again.\r\nAt line:1
char:1\r\n+ import os.path\r\n+ ~~\r\n+ CategoryInfo  :
ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
'import' is not recognized as the name of a cmdlet, function, script file,
or operable program. \r\nCheck the spelling of the name, or if a path was
included, verify that the path is correct and try again.\r\nAt line:1
char:1\r\n+ import sys\r\n+ ~~\r\n+ CategoryInfo  :
ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term
'import' is not recognized as the name of a cmdlet, function, script file,
or operable program. \r\nCheck the spelling of the name, or if a path was
included, verify that the path is correct and try again.\r\nAt line:1
char:1\r\n+ import __main__\r\n+ ~~\r\n+ CategoryInfo  :
ObjectNotFound: (import:String) [], CommandNotFoundException\r\n+
FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nscriptdir : The
term 'scriptdir' is not recognized as the name of a cmdlet, function,
script file, or operable \r\nprogram. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.\r\nAt
line:1 char:1\r\n+ scriptdir = None\r\n+ ~\r\n+ CategoryInfo
  : ObjectNotFound: (scriptdir:String) [],
CommandNotFoundException\r\n+ FullyQualifiedErrorId :
CommandNotFoundException\r\n \r\ntry: : The term 'try:' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check
\r\nthe spelling of the name, or if a path was included, verify that the
path is correct and try again.\r\nAt line:1 char:1\r\n+ try:\r\n+ \r\n
  + CategoryInfo  : ObjectNotFound: (try::String) [],
CommandNotFoundException\r\n+ FullyQualifiedErrorId :
CommandNotFoundException\r\n \r\n__main__.__file__ : The term
'__main__.__file__' is not recognized as the name of a cmdlet, function,
script file, or \r\noperable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try
\r\nagain.\r\nAt line:1 char:50\r\n+ scriptdir =
os.path.dirname(os.path.realpath(__main__.__file__))\r\n+
~\r\n+ CategoryInfo
  : ObjectNotFound: (__main__.__file__:String) [],
CommandNotFoundException\r\n+ FullyQualifiedErrorId :
CommandNotFoundException\r\n \r\nAt line:1 char:23\r\n+ except
(AttributeError, OSError):\r\n+   ~\r\nMissing argument
in parameter list.\r\n+ CategoryInfo  : ParserError: (:) [],
ParentContainsErrorRecordException\r\n+ FullyQualifiedErrorId :
MissingArgument\r\n \r\npass : The term 'pass' is not 

[ansible-project] Building inventory from csv file

2018-11-13 Thread Abdul Rahim
Hi there ,

I am new to ansible , looking to see if I can import variables from csv
file and either build an inventory file or use them in a playbook  ,
Appreciate your feedback.

Basic playbook I tried:

root@ansibile-launch:~/ansible/tasks/csv-file# cat test2.yml
---
- hosts: localhost
  connection: local
  become: false

  tasks:
  - name: efine Values From CSV File
  set_fact:
tenant: "{{ lookup('csvfile', '
file=/root/ansible/tasks/csv-file/example.csv delimiter=, col=1') }}
debug:
  msg: " Print tenant {{tenant}}"
  delegate_to: localhost


root@ansibile-launch:~/ansible/tasks/csv-file# cat example.csv
tenant-name,vrf-name,app-name,bd-name,bd-subnet,epg-name,vlan-id,status_is
tenant_telstra_tenant,vrf_tenant,anp_tenant,bd_net2,
172.16.2.252/24,epg_net2,2102,"created,modified"
tenant_telstra_tenant,vrf_tenant,anp_tenant,bd_net3,
172.16.3.252/24,epg_net3,2103,"created,modified"
tenant_telstra_tenant,vrf_tenant,anp_tenant,bd_net4,
172.16.4.252/24,epg_net4,2104,"created,modified"

Error I am getting


root@ansibile-launch:~/ansible/tasks/csv-file# ansible-playbook test2.yml
 [WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match 'all'

ERROR! Syntax Error while loading YAML.
  did not find expected key

The error appears to have been in '/root/ansible/tasks/csv-file/test2.yml':
line 11, column 14, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

debug:
  msg: " Print tenant {{tenant}}"
 ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

with_items:
  - {{ foo }}

Should be written as:

with_items:
  - "{{ foo }}"

Regards,
AR

-- 
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/CAL7z%3DgdUPwOg9qUOu_-33T4-Su48riSYwn8fnZTipodDUbG7tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread lucas.adam.jackson
It's up to you, depends on the use case. Preferably using https over 5986.Good 
script to use for configuring winrm for ansible 
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1You
 can configure the listener manually if you prefer but script works wellSent 
from my Samsung Galaxy smartphone.
 Original message From: Nk Chitturi  
Date: 2018-11-13  6:21 PM  (GMT-05:00) To: ansible-project@googlegroups.com 
Subject: Re: [ansible-project] Re: Working with Ansible on Windows Hosts Thanks 
Lucas, is there any way i can make it listen on port 5986, or can we use 5985 
to connect.but here is from my windows hostPS H:\> winrm enumerate 
winrm/config/listenerListener [Source="GPO"]    Address = *    Transport = HTTP 
   Port = 5985    Hostname    Enabled = true    URLPrefix = wsman    
CertificateThumbprint    ListeningOn =  0.00.000.000,  , 127.0.0.1, ::1, 
Listener [Source="Compatibility"]    Address = *    Transport = HTTP    Port = 
80    Hostname    Enabled = true    URLPrefix = wsman    CertificateThumbprint  
  ListeningOn =  0.00.000.000,   127.0.0.1, ::1, Listener 
[Source="Compatibility"]    Address = *    Transport = HTTPS    Port = 443    
Hostname =     Enabled = true    URLPrefix = wsman    
CertificateThumbprint    ListeningOn = 0.00.000.000, 127.0.0.1, ::1, On Tue, 
Nov 13, 2018 at 2:27 PM lucas.adam.jackson  
wrote:Your problem is you're not listening on port 5986Sent from my Samsung 
Galaxy smartphone. Original message From: Nk Chitturi 
 Date: 2018-11-13  5:24 PM  (GMT-05:00) To: 
ansible-project@googlegroups.com Subject: Re: [ansible-project] Re: Working 
with Ansible on Windows Hosts PS H:\> winrm enumerate 
winrm/config/listenerListener [Source="GPO"]    Address = *    Transport = HTTP 
   Port = 5985    Hostname    Enabled = true    URLPrefix = wsman    
CertificateThumbprint    ListeningOn = 

0.00.000.000,  , 127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3Listener [Source="Compatibility"]    Address = *    
Transport = HTTP    Port = 80    Hostname    Enabled = true    URLPrefix = 
wsman    CertificateThumbprint    ListeningOn = 

0.00.000.000,   127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3Listener [Source="Compatibility"]    Address = *    
Transport = HTTPS    Port = 443    Hostname =     
Enabled = true    URLPrefix = wsman    CertificateThumbprint    ListeningOn = 
0.00.000.000, 127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3PS H:\>this is my inbound rules On Tue, Nov 13, 2018 
at 1:56 PM Jordan Borean  wrote:That either means the 
Firewall is blocking that port of you have no HTTPS WinRM listener. To verify 
what listeners are active you can run 'winrm enumerate winrm/config/listener' 
on your Windows host.



-- 
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/4ed3f233-1964-4315-acdb-8806b0e9cbd1%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/CABdF8S3%2BUrrZFtV4KWd8VAh1oHRgdL0A9ZDVgH8YP%3D-gnBRhOQ%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/5beb4fe2.1c69fb81.d53e2.5d9b%40mx.google.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/CABdF8S1GhC8pqRzmetcqNt-ZjcLZOk9MdJZ5GDb_jsD%3D1gDA-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the 

Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
Thanks Lucas, is there any way i can make it listen on port 5986, or can we
use 5985 to connect.
but here is from my windows host
PS H:\> winrm enumerate winrm/config/listener
Listener [Source="GPO"]
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn =  0.00.000.000,  , 127.0.0.1, ::1,
Listener [Source="Compatibility"]
Address = *
Transport = HTTP
Port = 80
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn =  0.00.000.000,   127.0.0.1, ::1,
Listener [Source="Compatibility"]
Address = *
Transport = HTTPS
Port = 443
Hostname = http://servername.domain.com/>>
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 0.00.000.000, 127.0.0.1, ::1,


On Tue, Nov 13, 2018 at 2:27 PM lucas.adam.jackson <
lucas.adam.jack...@gmail.com> wrote:

> Your problem is you're not listening on port 5986
>
>
>
> Sent from my Samsung Galaxy smartphone.
>
>  Original message 
> From: Nk Chitturi 
> Date: 2018-11-13 5:24 PM (GMT-05:00)
> To: ansible-project@googlegroups.com
> Subject: Re: [ansible-project] Re: Working with Ansible on Windows Hosts
>
> PS H:\> winrm enumerate winrm/config/listener
> Listener [Source="GPO"]
> Address = *
> Transport = HTTP
> Port = 5985
> Hostname
> Enabled = true
> URLPrefix = wsman
> CertificateThumbprint
> ListeningOn =  0.00.000.000,  , 127.0.0.1, ::1,
> fe80::5efe:10.33.138.118%5, fe80::7008:2200:c50:e8f4%3
>
> Listener [Source="Compatibility"]
> Address = *
> Transport = HTTP
> Port = 80
> Hostname
> Enabled = true
> URLPrefix = wsman
> CertificateThumbprint
> ListeningOn =  0.00.000.000,   127.0.0.1, ::1,
> fe80::5efe:10.33.138.118%5, fe80::7008:2200:c50:e8f4%3
>
> Listener [Source="Compatibility"]
> Address = *
> Transport = HTTPS
> Port = 443
> Hostname = 
> Enabled = true
> URLPrefix = wsman
> CertificateThumbprint
> ListeningOn = 0.00.000.000, 127.0.0.1, ::1,
> fe80::5efe:10.33.138.118%5, fe80::7008:2200:c50:e8f4%3
>
> PS H:\>
>
> this is my inbound rules
> [image: image.png]
>
>
> On Tue, Nov 13, 2018 at 1:56 PM Jordan Borean  wrote:
>
>> That either means the Firewall is blocking that port of you have no HTTPS
>> WinRM listener. To verify what listeners are active you can run 'winrm
>> enumerate winrm/config/listener' on your Windows host.
>>
>> --
>> 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/4ed3f233-1964-4315-acdb-8806b0e9cbd1%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/CABdF8S3%2BUrrZFtV4KWd8VAh1oHRgdL0A9ZDVgH8YP%3D-gnBRhOQ%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/5beb4fe2.1c69fb81.d53e2.5d9b%40mx.google.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 

Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread lucas.adam.jackson
Your problem is you're not listening on port 5986Sent from my Samsung Galaxy 
smartphone.
 Original message From: Nk Chitturi  
Date: 2018-11-13  5:24 PM  (GMT-05:00) To: ansible-project@googlegroups.com 
Subject: Re: [ansible-project] Re: Working with Ansible on Windows Hosts PS 
H:\> winrm enumerate winrm/config/listenerListener [Source="GPO"]    Address = 
*    Transport = HTTP    Port = 5985    Hostname    Enabled = true    URLPrefix 
= wsman    CertificateThumbprint    ListeningOn = 

0.00.000.000,  , 127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3Listener [Source="Compatibility"]    Address = *    
Transport = HTTP    Port = 80    Hostname    Enabled = true    URLPrefix = 
wsman    CertificateThumbprint    ListeningOn = 

0.00.000.000,   127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3Listener [Source="Compatibility"]    Address = *    
Transport = HTTPS    Port = 443    Hostname =     
Enabled = true    URLPrefix = wsman    CertificateThumbprint    ListeningOn = 
0.00.000.000, 127.0.0.1, ::1, fe80::5efe:10.33.138.118%5, 
fe80::7008:2200:c50:e8f4%3PS H:\>this is my inbound rules On Tue, Nov 13, 2018 
at 1:56 PM Jordan Borean  wrote:That either means the 
Firewall is blocking that port of you have no HTTPS WinRM listener. To verify 
what listeners are active you can run 'winrm enumerate winrm/config/listener' 
on your Windows host.



-- 
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/4ed3f233-1964-4315-acdb-8806b0e9cbd1%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/CABdF8S3%2BUrrZFtV4KWd8VAh1oHRgdL0A9ZDVgH8YP%3D-gnBRhOQ%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/5beb4fe2.1c69fb81.d53e2.5d9b%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
PS H:\> winrm enumerate winrm/config/listener
Listener [Source="GPO"]
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn =  0.00.000.000,  , 127.0.0.1, ::1,
fe80::5efe:10.33.138.118%5, fe80::7008:2200:c50:e8f4%3

Listener [Source="Compatibility"]
Address = *
Transport = HTTP
Port = 80
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn =  0.00.000.000,   127.0.0.1, ::1,
fe80::5efe:10.33.138.118%5, fe80::7008:2200:c50:e8f4%3

Listener [Source="Compatibility"]
Address = *
Transport = HTTPS
Port = 443
Hostname = 
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 0.00.000.000, 127.0.0.1, ::1, fe80::5efe:10.33.138.118%5,
fe80::7008:2200:c50:e8f4%3

PS H:\>

this is my inbound rules
[image: image.png]


On Tue, Nov 13, 2018 at 1:56 PM Jordan Borean  wrote:

> That either means the Firewall is blocking that port of you have no HTTPS
> WinRM listener. To verify what listeners are active you can run 'winrm
> enumerate winrm/config/listener' on your Windows host.
>
> --
> 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/4ed3f233-1964-4315-acdb-8806b0e9cbd1%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/CABdF8S3%2BUrrZFtV4KWd8VAh1oHRgdL0A9ZDVgH8YP%3D-gnBRhOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Jordan Borean
That either means the Firewall is blocking that port of you have no HTTPS 
WinRM listener. To verify what listeners are active you can run 'winrm 
enumerate winrm/config/listener' on your Windows host.

-- 
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/4ed3f233-1964-4315-acdb-8806b0e9cbd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] AttributeError: 'module' object has no attribute 'cursors'

2018-11-13 Thread Dick Visser
On Tue, 13 Nov 2018 at 15:38, 'Son T' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> This is the error I get when using proxysql_manage_config module as
> documented here:
> https://docs.ansible.com/ansible/2.5/modules/proxysql_manage_config_module.html
>
> Anyone know how I get around this issue?
>

Without showing the actual playbook, that’s going to be difficult.
So, what does the playbook look like?



Dick
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

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


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
Now i am getting another new error, somehow i amble to create a kinit
ticket but the error is
(Caused by NewConnectionError(': Failed to establish a new connection: [Errno
111] Connection refused',))", "unreachable": true}

On Tue, Nov 13, 2018 at 11:48 AM Jordan Borean  wrote:

> So that error is saying it failed to run kinit to get a kerb ticket for
> the user 'user...@xyz.com'. This isn't necessarily an Ansible issue but a
> problem with how your Kerberos setup is done. It is saying it cannot
> contact/find the KDC in the realm 'xyz.com' so the one you have
> configured in your /etc/krb5.conf may not be correct or just not reachable.
>
> Make sure the value for 'kdc' in the realms section is a valid hostname
> for your domain controller and that the host is able to resolve it to an
> actual host.
>
> Thanks
>
> Jordan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/fdc79590-192c-4973-adaa-7f87d2a1e889%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/CABdF8S0Ptxzxhkkg5OoBHfW%3DMbqYH-TXfMAkbEk7hQTQRU3bQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Open Command prompt as RunAsAdministrator and install setup.exe

2018-11-13 Thread Jordan Borean
Become isn't necessarily used to 'run as administrator' in Windows but 
rather to change the logon from a network to interactive logon with 
credentials to use for delegation. Normally a WinRM process is run with the 
full Administrative rights of an account and you can verify that by running

- name: getlogon details for current user
  win_whoami:

This will return a whole bunch of information but if the label key contains 
a 'High Mandatory Label' you know you are running as an admin. In older 
versions of Ansible, a become task may not have admin rights and since 2.5 
it is done as a best effort attempt. I would do the below to verify you are 
least get the High Mandatory Label returned when using become to verify 
that process is run with admin rights as well.

- name: test whoami with become
  win_whoami:
  become: yes
  become_method: runas
  become_user: Administrator

As for why the process is still running it could be a few different things;

   - Become runs the task in a pseudo interactive logon so it may be 
   prompting the user for something causing it to hang
   - The args you are using aren't the correct silent args for the process
   - Some else?

What I would try

   - Run the same command locally and see if it works or not
   - Check the log file when being installed with Ansible to see if there's 
   anything in there that might indicate what it's waiting for
   - Try running the task with async and become, this changes a few things 
   with how the console is spawned and killed so may work for you
   - Use procexp to see what processes are still running, whether the main 
   powershell exe that executes the module is still running, if setup.exe is 
   still running and so on.
   

Thanks

Jordan

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


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Jordan Borean
So that error is saying it failed to run kinit to get a kerb ticket for the 
user 'user...@xyz.com'. This isn't necessarily an Ansible issue but a 
problem with how your Kerberos setup is done. It is saying it cannot 
contact/find the KDC in the realm 'xyz.com' so the one you have configured 
in your /etc/krb5.conf may not be correct or just not reachable.

Make sure the value for 'kdc' in the realms section is a valid hostname for 
your domain controller and that the host is able to resolve it to an actual 
host.

Thanks

Jordan

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


Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-13 Thread John Harmon
In case anybody else is looking to do the same thing, here is my BASH 
solution:

- name: Sanitize Virtual Interface(s)
  shell: |
file="/var/ftp/vm.cfg"
total=$( grep ^vif "$file" | grep -o mac | wc -l )
for i in `seq 1 $total`; do
  my_random=$(xxd -l 1 -p /dev/urandom )
  my_random2=$(xxd -l 1 -p /dev/urandom )
  sed -ri 
"s|mac=00:21:f6:((\w{2}(:)?){3})|mac=00:21:f6:aa:${my_random}:${my_random2}|${i}"
 
$file
done


-- 
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/8a24e671-0f09-403b-92ca-0a118b7f4b11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-13 Thread vivek vijayan
Thanks Maria,

I will check for that. Do u have any scenario like where you could modify
the xml file with see command and how we can automate this using ansible..

On Tue, 13 Nov 2018, 21:53 'Maria MacCallum' via Ansible Project, <
ansible-project@googlegroups.com> wrote:

> Dear Visar,
>
> By no means am I an ansible expert but I thought of 2 ideas around the
> problem for you:
>
> 1) Have 2 files on the server you can copy between the 2 files to be the
> 'active' file using ansible, one with the commented out section, one with
> it active
>- When you have changes to make to the xml file use ansible to copy the
> new ones to the server
>
> 2) If you are using unix, you can use shell to use sed to search and
> replace.
>
> Hope this helps in the interim while you find a proper ansible solution to
> your problem
>
> Regards, Maria
>
> On Monday, 5 November 2018 06:21:17 UTC, visar wrote:
>>
>> Hi Experts,
>>
>>
>> Please help me with your guidance here.
>>
>> I want to comment a line in one config file and need to uncomment the
>> other lline using ansible.
>>
>> My file content as below.
>>
>> 
>>
>> 
>>  -this i want to comment
>> 
>>   --- this line i want to
>> uncomment
>>
>>
>> __
>>
>> I tried with the below play book and its not showing any error even
>> though its not changing any changes to the file.
>>
>>
>> ---
>>
>> - name: enable LDAP
>>   hosts: localhost
>>   tasks:
>>- name: disbale basic user-registry
>>  lineinfile:
>>path:
>> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>>regexp: '^\s*.*$'
>>line: ';'
>>backrefs: yes
>>  become: true
>>
>> ---
>> ---
>>
>> - name: enable LDAP USER_REGISTRY
>>   hosts: localhost
>>   tasks:
>> lineinfile:
>>   dest:
>> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>>   regexp: '^(.*)(.*)$'
>>   line: ';'
>>   backrefs: yes
>>
>>
>> _
>>
>>
>> Output:
>>
>>
>> PLAY [enable LDAP]
>> **
>>
>> TASK [Gathering Facts]
>> **
>> ok: [localhost]
>>
>> TASK [disbale basic user-registry]
>> **
>> ok: [localhost]
>>
>> PLAY RECAP
>> **
>> localhost  : ok=2changed=0unreachable=0
>> failed=0
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ae990a2d-84ca-42be-9793-88056d60687a%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/CAJztPtQ0mU4TPwbut14tJOtnhtmcGOMBvugPpY6YyhM3rLNXhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Working with Ansible on Windows Hosts

2018-11-13 Thread Nk Chitturi
Thanks Jordan, i tried like what you mentioned above, but this is the error
I am getting

fatal: [servername]: UNREACHABLE! => {"changed": false, "msg": "Kerberos
auth failure for principal usern...@xyz.com with subprocess: kinit: Cannot
find KDC for realm \"xyz.com\" while getting initial credentials",
"unreachable": true}
please suggest with some solution...

thanks,
Narmada

On Mon, Nov 12, 2018 at 6:19 PM Jordan Borean  wrote:

> You're missing the most important thing, what's the error you are
> receiving and whether you kinit can get the user's token. Briefly looking
> at it
>
>
>- The KDC as has user...@xyz.com, this should be a hostname and not an
>account of the domain controller
>- Your inventory file has ansibel_ssh_user, this has incorrect
>spelling and isn't needed because you have defined ansible_user in the
>group vvariables
>- You have ansible_winrm_message_encryption: always but because you
>are running over https this isn't needed, you can omit this value
>
> Please share the output you are getting, preferably run Ansible with -vvv,
> and try and run kinit manually outside of Ansible to verify your kerb setup
> is correct.
>
> Thanks
>
> Jordan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c5b766b7-291a-4a2e-a365-680887b1e402%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/CABdF8S2eZLMUacEGKK_6ELNHyzMsLLFkmuaWx0uHBX4L4T6OLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: need to replace a line in config file

2018-11-13 Thread 'Maria MacCallum' via Ansible Project
Dear Visar,

By no means am I an ansible expert but I thought of 2 ideas around the 
problem for you:

1) Have 2 files on the server you can copy between the 2 files to be the 
'active' file using ansible, one with the commented out section, one with 
it active
   - When you have changes to make to the xml file use ansible to copy the 
new ones to the server

2) If you are using unix, you can use shell to use sed to search and 
replace.

Hope this helps in the interim while you find a proper ansible solution to 
your problem

Regards, Maria

On Monday, 5 November 2018 06:21:17 UTC, visar wrote:
>
> Hi Experts,
>
>
> Please help me with your guidance here.
>
> I want to comment a line in one config file and need to uncomment the 
> other lline using ansible.
>
> My file content as below. 
>
> 
>
>   
>  -this i want to comment 
>   
>   --- this line i want to 
> uncomment
>
>
> __
>
> I tried with the below play book and its not showing any error even though 
> its not changing any changes to the file.
>
>
> ---
>
> - name: enable LDAP
>   hosts: localhost
>   tasks:
>- name: disbale basic user-registry
>  lineinfile:
>path: 
> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>regexp: '^\s*.*$'
>line: ';'
>backrefs: yes
>  become: true
>
> ---
> ---
>
> - name: enable LDAP USER_REGISTRY
>   hosts: localhost
>   tasks:
> lineinfile:
>   dest: 
> /opt/IBM/605CLM/JazzTeamServer/server/liberty/servers/clm/server.xml
>   regexp: '^(.*)(.*)$'
>   line: ';'
>   backrefs: yes
>
>
> _
>
>
> Output:
>
>
> PLAY [enable LDAP] 
> **
>
> TASK [Gathering Facts] 
> **
> ok: [localhost]
>
> TASK [disbale basic user-registry] 
> **
> ok: [localhost]
>
> PLAY RECAP 
> **
> localhost  : ok=2changed=0unreachable=0failed=0
>
>
>

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


Re: [ansible-project] What is the proper way to add a loop for a whole playbook ?

2018-11-13 Thread ryan prihoda
I ended up restructuring my vars a bit:
- name: archive logs
  hosts: localhost
  vars:
- date: "{{ lookup('pipe', 'date -d \"-1 month\" +\"%m-%Y\"') }}"
- customers:
  - { name: 'customer1', archive: 'customer1.tgz', bucket: 
'customer1-log-archive' }
  - { name: 'customer2', archive: 'customer2.tgz', bucket: 
'customer2-log-archive' }


Then I just need to add with_items: "{{ customers }}" to the end of each 
task to get the loop that I wanted. 

Thanks for the help.

On Tuesday, November 13, 2018 at 9:18:50 AM UTC-6, Brian Coca wrote:
>
> Create an inventory in which the 'hosts' are customers and associate 
> the variables to each host, then have the play run `hosts: customer` 
> and `delegate_to: localhost`/ 
>
> -- 
> -- 
> 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/b874e363-9be3-4c23-a77b-9e5646a2273b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: CPU

2018-11-13 Thread Brian Coca
nagios/naemon, zabbix, sar, etc ...many good ways to do this, but if you
REALLY want to do shit in Ansible (I don't recommend):

-  name: get RAM
   shell: free
   register: memory

- name: cpu info
   shell top -n 1
   register: cpu



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


Re: [ansible-project] What is the proper way to add a loop for a whole playbook ?

2018-11-13 Thread Brian Coca
Create an inventory in which the 'hosts' are customers and associate
the variables to each host, then have the play run `hosts: customer`
and `delegate_to: localhost`/

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


Re: [ansible-project] What is the proper way to add a loop for a whole playbook ?

2018-11-13 Thread ryan prihoda
 This play is only ran locally. I meant to loop through the customers so
that I could have {{ item.customer }} {{ item.archive }} {{ item.bucket }}
available as variables in each task in my playbook without having to add
the same loop at the end of each task.

On Tue, Nov 13, 2018 at 8:56 AM Brian Coca  wrote:

> hosts: <= this already loops the whole playbook with each host being
> an item, other than that, there is no other way.
>
>
>
> --
> --
> 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/a2a6PBxUG20/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/CACVha7f6i50uYXD31J%2BPBfEKkTou-byGnHM1qWjEAm68%2BMG-Qg%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/CAHLami65Rb%2BgTL%2Bk2CCMiYjfmN0opbOSXcGDa7NCHWt4YD1-7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] What is the proper way to add a loop for a whole playbook ?

2018-11-13 Thread Brian Coca
hosts: <= this already loops the whole playbook with each host being
an item, other than that, there is no other way.



-- 
--
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/CACVha7f6i50uYXD31J%2BPBfEKkTou-byGnHM1qWjEAm68%2BMG-Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: CPU

2018-11-13 Thread vivek vijayan
Icinga will be a good option for you. We are using it for our servers cpu
and load monitoring which is an open source

On Tue, 13 Nov 2018, 19:26 Jonathan Lozada De La Matta, 
wrote:

> if you go to nagios page then you can find all this information.
>
> On Tue, Nov 13, 2018 at 8:37 AM Vinu Vajravel 
> wrote:
>
>> do you know any perl or shell scripts or any plugins to interface with
>> Nagios to monitor CPU/memory ?
>>
>> Thanks
>> Vinu
>>
>> On Tue, Nov 13, 2018 at 5:56 PM Brad Van Orden 
>> wrote:
>>
>>> Are you sure you want to use ansible for that task?  It sounds more like
>>> something for a monitoring tool such as nagios, oneview, big brother, etc.
>>>
>>> On Tuesday, November 13, 2018 at 6:43:57 AM UTC-5, Vinu Vajravel wrote:

 HI Ansible Experts ,

 Can anyone let me know how can i monitor CPU and memory usage using a
 play books please ?

 THanks
 VInu

>>> --
>>> 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/fe4c538a-2da8-4747-915d-240e076ed8b3%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/CAPFALF72H6g25oJbL-U_h3_7mOUXzaTDaFp%2BTZ-QFBsTZ%2BL4_A%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION PRACTICE
>
>
>
>
> --
> 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/CAFYJA%2BK_mERjypr4pF%3DO%2BPYxeP_ejhXfDdN%2B00NEz2HvtD%2Bi2A%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/CAJztPtQTqHv0uZeAJDqJHrEgAKf9EWe_2pZ%2B4krp1ftv_4qxGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] What is the proper way to add a loop for a whole playbook ?

2018-11-13 Thread ryan prihoda
Normally I'd add my loop at the end of each task but my playbook is growing 
rather long. How do I set variables in the playbook so that each task will 
loop though them ? Something like this 

- name: archive logs
  hosts: localhost
  vars:
date: "{{ lookup('pipe', 'date -d \"-1 month\" +\"%m-%Y\"') }}"
loop:
  - { customer: 'customer1', archive: 'customer1.tgz', bucket: 
'customer1-log-archive' }
  - { customer: 'customer2', archive: 'customer2.tgz', bucket: 
'customer2-log-archive' }



-- 
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/9d28bd7f-b856-4c04-8cda-a314fd6e8a17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] AttributeError: 'module' object has no attribute 'cursors'

2018-11-13 Thread 'Son T' via Ansible Project
This is the error I get when using proxysql_manage_config module as 
documented 
here: 
https://docs.ansible.com/ansible/2.5/modules/proxysql_manage_config_module.html

Anyone know how I get around this issue? 

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


Re: [ansible-project] Re: CPU

2018-11-13 Thread Jonathan Lozada De La Matta
if you go to nagios page then you can find all this information.

On Tue, Nov 13, 2018 at 8:37 AM Vinu Vajravel 
wrote:

> do you know any perl or shell scripts or any plugins to interface with
> Nagios to monitor CPU/memory ?
>
> Thanks
> Vinu
>
> On Tue, Nov 13, 2018 at 5:56 PM Brad Van Orden 
> wrote:
>
>> Are you sure you want to use ansible for that task?  It sounds more like
>> something for a monitoring tool such as nagios, oneview, big brother, etc.
>>
>> On Tuesday, November 13, 2018 at 6:43:57 AM UTC-5, Vinu Vajravel wrote:
>>>
>>> HI Ansible Experts ,
>>>
>>> Can anyone let me know how can i monitor CPU and memory usage using a
>>> play books please ?
>>>
>>> THanks
>>> VInu
>>>
>> --
>> 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/fe4c538a-2da8-4747-915d-240e076ed8b3%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/CAPFALF72H6g25oJbL-U_h3_7mOUXzaTDaFp%2BTZ-QFBsTZ%2BL4_A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
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/CAFYJA%2BK_mERjypr4pF%3DO%2BPYxeP_ejhXfDdN%2B00NEz2HvtD%2Bi2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: CPU

2018-11-13 Thread Vinu Vajravel
do you know any perl or shell scripts or any plugins to interface with
Nagios to monitor CPU/memory ?

Thanks
Vinu

On Tue, Nov 13, 2018 at 5:56 PM Brad Van Orden 
wrote:

> Are you sure you want to use ansible for that task?  It sounds more like
> something for a monitoring tool such as nagios, oneview, big brother, etc.
>
> On Tuesday, November 13, 2018 at 6:43:57 AM UTC-5, Vinu Vajravel wrote:
>>
>> HI Ansible Experts ,
>>
>> Can anyone let me know how can i monitor CPU and memory usage using a
>> play books please ?
>>
>> THanks
>> VInu
>>
> --
> 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/fe4c538a-2da8-4747-915d-240e076ed8b3%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/CAPFALF72H6g25oJbL-U_h3_7mOUXzaTDaFp%2BTZ-QFBsTZ%2BL4_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: CPU

2018-11-13 Thread Thad Guidry
I'd highly recommend https://sensu.io/ which is open source and exudes
DevOps best practices.

Thad
+ThadGuidry 


On Tue, Nov 13, 2018 at 6:26 AM Brad Van Orden 
wrote:

> Are you sure you want to use ansible for that task?  It sounds more like
> something for a monitoring tool such as nagios, oneview, big brother, etc.
>
> On Tuesday, November 13, 2018 at 6:43:57 AM UTC-5, Vinu Vajravel wrote:
>>
>> HI Ansible Experts ,
>>
>> Can anyone let me know how can i monitor CPU and memory usage using a
>> play books please ?
>>
>> THanks
>> VInu
>>
> --
> 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/fe4c538a-2da8-4747-915d-240e076ed8b3%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/CAChbWaOZAB0R_PJ_fU5ip0SH%2BsOFTQfU4egcVRtO6tX6k_QQBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Open Command prompt as RunAsAdministrator and install setup.exe

2018-11-13 Thread Brad Van Orden
My first guess is case of administrator.  In your task, you have the first 
letter capitalized.  In your inventory file, it is lowercase.

On Tuesday, November 13, 2018 at 5:42:30 AM UTC-5, mvram...@gmail.com wrote:
>
> Hi Team,
>
> I want to open command prompt as runas administrator to install my 
> setup.exe file in windows.
> below is my playbook.
>
> [Setup_install.yml]
> ---
> - hosts: windows
>   user: testuser
>
>   tasks:
>
>   - name: Install my seup.exe file.
> win_command: 'C:\temp\setup.exe /SP /VERYSILENT /DIR=C:/temp 
> /LOG=C:/temp/Install.log'
> become: yes
> become_method: runas
> become_user: Administrator
>
> below is my inventory file.
>
> [windows]
> server1.domain.com
>
> [windows:vars]
> ansible_ssh_user=testuser
> ansible_ssh_pass=xxx
> ansible_ssh_port=5986
> ansible_connection=winrm
> ansible_winrm_scheme=https
> ansible_winrm_server_cert_validation=ignore
> ansible_winrm_transport=ntlm
> ansible_become_user=administrator
> ansible_become_pass=xxx
>
>
> When i execute setup_install.yml file, below is the output and its not 
> completing the task.
>
>
>
> PLAY [windows] 
> *
>
> TASK [Gathering Facts] 
> *
> ok: [server1.domain.com]
>
> TASK [Install my seup.exe file.] 
> *
>
>
> Can some one please help me on this.
>
> 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/b9bd0232-db52-4644-a9d4-c680a866e3e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: CPU

2018-11-13 Thread Brad Van Orden
Are you sure you want to use ansible for that task?  It sounds more like 
something for a monitoring tool such as nagios, oneview, big brother, etc.

On Tuesday, November 13, 2018 at 6:43:57 AM UTC-5, Vinu Vajravel wrote:
>
> HI Ansible Experts , 
>
> Can anyone let me know how can i monitor CPU and memory usage using a play 
> books please ? 
>
> THanks
> VInu 
>

-- 
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/fe4c538a-2da8-4747-915d-240e076ed8b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-13 Thread visar
Hello Visser,

I am sorry if i couldn't explain you the way which i was looking for here.

Please find the default server.xml file  which is by default pointing to 
the "basicUserRegistry.xml" file located in  applications conf directory. 
Here in order to proceed further installation step of our application, we 
have to enable "ldapUserRegistry.xml" file in the same directory. Because 
we cant proceed the further steps with "basicUserRegistry" user. We have 
already "ldapUserRegistry.xml" file edited with our domain properties and 
it will be replaced by another play book in the same applications conf 
directory.

Now our requirement is to just enable the "ldapUserRegistry.xml" file and 
disable "basicUserRegistry.xml" ( We dont want to remove this parameter 
because in some troubleshooting scenarios, we can authenticate the 
application with basic user registry and check the things, where ldapuser 
is failing)

here nothing else we want to modify in this file as mistake in this file 
modification will result the application down..
__






monitor-1.0
jsp-2.2
servlet-3.0
ssl-1.0
appSecurity-2.0
adminCenter-1.0























ADMIN
JazzAdmins



${server.config.dir}










___

I tried with your playbook and its result was not as we expected.. Its 
making two entries for same "ldapUserRegistry.xml" file (one is commented 
and another is uncommented), and removed the "basicUserRegistry.xml" file 
paramter itself. 

This was the result of the given playbook in server.xml file.

---

 -->



monitor-1.0
jsp-2.2
servlet-3.0
ssl-1.0
appSecurity-2.0
adminCenter-1.0























ADMIN
JazzAdmins



${server.config.dir}










-


On Tuesday, November 13, 2018 at 4:47:35 PM UTC+5:30, Dick Visser wrote:
>
> Hi Vivek 
>
> It seems that the basics of XML and system configuration are not clear. 
> There is no use in continuing this conversation for me. 
>
> Regards 
>
> Dick 
>
> On Mon, 12 Nov 2018 at 20:16, vivek vijayan  > wrote: 
> > 
> > Hi Dick, 
> > 
> > By editing this configuration xml file I am disabling the default 
> basicregistry file user authentication which is local and I am enabling the 
> LDAP setting by commenting out. Once the LDAP line got uncommented I have 
> my own LDAP settings in the ldapuser registry file. Also in some situations 
> where LDAP is not working I want to use the default basic user registry as 
> well. 
> > 
> > That's why I am looking for enabling LDAP file and disabling 
> basicregistry file here. 
> > 
> > In the given playbook ldapuser registry is enabled and disabled in 
> different lines as I given in prevy example 
> > 
> > On Mon, 12 Nov 2018, 23:36 Dick Visser,  > wrote: 
> >> 
> >> Hi Visar 
> >> 
> >> You keep thinking in terms of "commenting out lines" in your XML 
> >> configuration file. 
> >> But what you really want (although you might not realise it), is to 
> >> configure your application server the right way. 
> >> This playbook does exactly that. 
> >> Ignore what is commented out - like your application server does. 
> >> 
> >> At this moment you're all set! 
> >> 
> >> Dick 
> >> 
> >> 
> >> On Mon, 12 Nov 2018 at 18:32, visar > 
> wrote: 
> >> > 
> >> > Hello Dick, 
> >> > 
> >> > Now this is the output. 
> >> > 
> >> >  
> >> >  
> >> > 
> >> >  
> >> >  
> >> > 
> >> >  
> >> > 
> >> >  
> >> > 
> >> > Here ldapUserRegistry line is repeating twice where one should be 
> basicUserRegistry xml file which should be commented.. 
> >> > 
> >> > 
> >> > Thanks in advance for your help here 
> >> > 
> >> > On Monday, November 12, 2018 at 10:53:39 PM UTC+5:30, visar wrote: 
> >> >> 
> >> >> Hello Dick, 
> >> >> 
> >> >> Yes, You are right that the given play is working . 
> >> >> 
> >> >> The playbook is making changes on the xml file, but not as expected. 
> Its making double entry for same ldap settings. one is commented another is 
> uncommented. 
> >> >> 
> >> >>   
> >> >>  
> >> >> 
> >> >> But here I want a result like comment only the basic user registry 
> line and uncomment ldap line 
> >> >> 
> >> >> 
> >> >> here the basic registry line itself got removed.. 
> >> >> 
> >> >> On Monday, November 12, 2018 at 9:44:32 PM UTC+5:30, Dick Visser 

[ansible-project] win_domain_group to append new member groups

2018-11-13 Thread Raj

Hello All,
I'm using the 'win_domain_group module' in ansible 2.6 to add a newly 
created AD group (new_grp)  to an existing AD group ( my_admins). It 
works,  but instead of appending "new_grp"  as a member of "my_admins" it 
removes all current members and adds only "new_group" . Does this module 
have an append option for attributes?

  win_domain_group:
  domain_server: "{{ domain_ctrl }}"
  domain_username: "{{ domain_user }}"
  domain_password: "{{ domain_pass }}"
  name: "CN=my_admins,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
  path: "{{ ldap_group_path }}"
  category: security
  scope: global
  description: "My test group"
  state: present
  attributes:
 member: "CN=new_grp,ou=user 
groups,ou=accounts,ou=xyz,DC=Lab,DC=local"


I can get it to work if I  manually list all needed member groups like  for 
the attribute like this?

 win_domain_group:
  
  
  state: present
  attributes:
 member: 
 - "CN=new_grp,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
 - "CN=group1,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
 - "CN=group2,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
 - "CN=group3,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"


But as I generate the list from a previous task I'd like to pass the member 
list as a variable like "{{ teams}}"
teams:
- "CN=new_grp,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
- "CN=group1,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
- "CN=group2,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"
- "CN=group3,ou=user groups,ou=accounts,ou=xyz,DC=Lab,DC=local"

Using with_items: "{{ teams}}" , iterates through the list but the  result  
only the last group as a member.  Any suggestions on how I can get around 
this?

-- 
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/ecedde9f-a621-4273-bc17-36684d298a9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] CPU

2018-11-13 Thread Vinu Vajravel
HI Ansible Experts , 

Can anyone let me know how can i monitor CPU and memory usage using a play 
books please ? 

THanks
VInu 

-- 
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/1b605614-d1a9-4da7-9ff6-1ef8ac0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: need to replace a line in config file

2018-11-13 Thread Dick Visser
Hi Vivek

It seems that the basics of XML and system configuration are not clear.
There is no use in continuing this conversation for me.

Regards

Dick

On Mon, 12 Nov 2018 at 20:16, vivek vijayan  wrote:
>
> Hi Dick,
>
> By editing this configuration xml file I am disabling the default 
> basicregistry file user authentication which is local and I am enabling the 
> LDAP setting by commenting out. Once the LDAP line got uncommented I have my 
> own LDAP settings in the ldapuser registry file. Also in some situations 
> where LDAP is not working I want to use the default basic user registry as 
> well.
>
> That's why I am looking for enabling LDAP file and disabling basicregistry 
> file here.
>
> In the given playbook ldapuser registry is enabled and disabled in different 
> lines as I given in prevy example
>
> On Mon, 12 Nov 2018, 23:36 Dick Visser,  wrote:
>>
>> Hi Visar
>>
>> You keep thinking in terms of "commenting out lines" in your XML
>> configuration file.
>> But what you really want (although you might not realise it), is to
>> configure your application server the right way.
>> This playbook does exactly that.
>> Ignore what is commented out - like your application server does.
>>
>> At this moment you're all set!
>>
>> Dick
>>
>>
>> On Mon, 12 Nov 2018 at 18:32, visar  wrote:
>> >
>> > Hello Dick,
>> >
>> > Now this is the output.
>> >
>> > 
>> > 
>> >
>> > 
>> > 
>> >
>> > 
>> >
>> > 
>> >
>> > Here ldapUserRegistry line is repeating twice where one should be 
>> > basicUserRegistry xml file which should be commented..
>> >
>> >
>> > Thanks in advance for your help here
>> >
>> > On Monday, November 12, 2018 at 10:53:39 PM UTC+5:30, visar wrote:
>> >>
>> >> Hello Dick,
>> >>
>> >> Yes, You are right that the given play is working .
>> >>
>> >> The playbook is making changes on the xml file, but not as expected. Its 
>> >> making double entry for same ldap settings. one is commented another is 
>> >> uncommented.
>> >>
>> >>  
>> >> 
>> >>
>> >> But here I want a result like comment only the basic user registry line 
>> >> and uncomment ldap line
>> >>
>> >>
>> >> here the basic registry line itself got removed..
>> >>
>> >> On Monday, November 12, 2018 at 9:44:32 PM UTC+5:30, Dick Visser wrote:
>> >>>
>> >>> On Fri, 9 Nov 2018 at 13:27, visar  wrote:
>> >>> >
>> >>> > Hello Visser,
>> >>> >
>> >>> > Appreciate your time for checking this.
>> >>> >
>> >>> > Here i am little confused that,
>> >>> >
>> >>> > Here I just want to modify the server.xml file only.
>> >>> > (comment basicuserregistry.xml and uncomment ldapuseruserregistry.xml 
>> >>> > file).
>> >>> >
>> >>> > Both the files are already present there in the defined location 
>> >>> > already, but just want to edit the server.xml file to comment and 
>> >>> > uncomment..
>> >>>
>> >>> It would rather see the appreciation for my time by trying out the
>> >>> playbook that I sent.
>> >>> Because there is a very good chance that it will solve your problem.
>> >>> Please let me know how it went.
>> >>>
>> >>> Dick
>> >
>> > --
>> > 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/27f3060b-739c-4b4a-839f-c6b1f7727f4c%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/CAL8fbwPVx2HeW1RHw32cXmhvJ55pjZwceeL5_ueXNHZtmras7w%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/CAJztPtRnpVx0K7s8FyL5c1wCsbt%2BXwE%3D9rbgqHtW_6LMbztRWQ%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, 

[ansible-project] Open Command prompt as RunAsAdministrator and install setup.exe

2018-11-13 Thread mvramana212
Hi Team,

I want to open command prompt as runas administrator to install my 
setup.exe file in windows.
below is my playbook.

[Setup_install.yml]
---
- hosts: windows
  user: testuser

  tasks:

  - name: Install my seup.exe file.
win_command: 'C:\temp\setup.exe /SP /VERYSILENT /DIR=C:/temp 
/LOG=C:/temp/Install.log'
become: yes
become_method: runas
become_user: Administrator

below is my inventory file.

[windows]
server1.domain.com

[windows:vars]
ansible_ssh_user=testuser
ansible_ssh_pass=xxx
ansible_ssh_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm
ansible_become_user=administrator
ansible_become_pass=xxx


When i execute setup_install.yml file, below is the output and its not 
completing the task.



PLAY [windows] 
*

TASK [Gathering Facts] 
*
ok: [server1.domain.com]

TASK [Install my seup.exe file.] 
*


Can some one please help me on this.

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/e45a7219-afc0-41ce-99b6-baa80847477f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unarchive a file is failing

2018-11-13 Thread Mohan L

I am not clear about what you are trying to achieve here. are you using XYZ 
in with_items? Please note you have to quote src and dest in XYZ otherwise 
Ansible will treat src/dest are variables.  

On Tuesday, November 13, 2018 at 2:28:55 PM UTC+5:30, Mohan L wrote:
>
>
> I am not clear about what you are trying to achieve here. are you using 
> XYZ in with_items? Please note you have to quote src and dest in XYZ other 
> Ansible will src/dest are variables.  
>
> On Tuesday, November 13, 2018 at 2:14:25 PM UTC+5:30, 
> anushake...@gmail.com wrote:
>>
>> Please find the files below.
>>
>>
>> *vars/main.yml*
>>
>> XYZ:
>> - { src: '/tmp/abc/ab.warr', dest: '/tmp/abc/' }
>>
>> TAR:
>> - { "src_tar": "/tmp/xx/sample.tar.gz", "dest_tar": "/tmp/sss/" }
>>
>> *tasks/main.yml*
>>
>> ---
>> - hosts: all
>>   vars_files:
>>   - /etc/ansible/xxx/xyz/vars/main.yml
>>   tasks:
>>   - name: test
>> unarchive:
>>   src: "{{ item.src_tar }}"
>>   dest: "{{ item.dest_tar }}"
>> with_items: "{{ TAR }}"
>>
>>
>> On Tuesday, November 13, 2018 at 2:06:40 PM UTC+5:30, Mohan L wrote:
>>>
>>>
>>> It looks like again you are not placing quotes around dictionary key. 
>>> Can you please show your code which through this error?
>>>
>>> On Tuesday, November 13, 2018 at 12:53:39 PM UTC+5:30, 
>>> anushake...@gmail.com wrote:

 It is unpacking a tar file successfully but at the same time I am 
 getting below error. Could you please help.


  {"msg": "The task includes an option with an undefined variable. The 
 error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
 to have been in '/etc/ansible/xxx/xy/tasks/main.yml': line 26, column 5, 
 but may\nbe elsewhere in the file depending on the exact syntax 
 problem.\n\nThe offending line appears to be:\n\n\n  - name: test\n^ 
 here\n"}

>>>

-- 
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/7afcb4b4-3602-4e51-bfc0-28a1cdcc4e41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unarchive a file is failing

2018-11-13 Thread Mohan L

I am not clear about what you are trying to achieve here. are you using XYZ 
in with_items? Please note you have to quote src and dest in XYZ other 
Ansible will src/dest are variables.  

On Tuesday, November 13, 2018 at 2:14:25 PM UTC+5:30, anushake...@gmail.com 
wrote:
>
> Please find the files below.
>
>
> *vars/main.yml*
>
> XYZ:
> - { src: '/tmp/abc/ab.warr', dest: '/tmp/abc/' }
>
> TAR:
> - { "src_tar": "/tmp/xx/sample.tar.gz", "dest_tar": "/tmp/sss/" }
>
> *tasks/main.yml*
>
> ---
> - hosts: all
>   vars_files:
>   - /etc/ansible/xxx/xyz/vars/main.yml
>   tasks:
>   - name: test
> unarchive:
>   src: "{{ item.src_tar }}"
>   dest: "{{ item.dest_tar }}"
> with_items: "{{ TAR }}"
>
>
> On Tuesday, November 13, 2018 at 2:06:40 PM UTC+5:30, Mohan L wrote:
>>
>>
>> It looks like again you are not placing quotes around dictionary key. Can 
>> you please show your code which through this error?
>>
>> On Tuesday, November 13, 2018 at 12:53:39 PM UTC+5:30, 
>> anushake...@gmail.com wrote:
>>>
>>> It is unpacking a tar file successfully but at the same time I am 
>>> getting below error. Could you please help.
>>>
>>>
>>>  {"msg": "The task includes an option with an undefined variable. The 
>>> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
>>> to have been in '/etc/ansible/xxx/xy/tasks/main.yml': line 26, column 5, 
>>> but may\nbe elsewhere in the file depending on the exact syntax 
>>> problem.\n\nThe offending line appears to be:\n\n\n  - name: test\n^ 
>>> here\n"}
>>>
>>>
>>> On Tuesday, November 13, 2018 at 12:46:58 PM UTC+5:30, Keshipeddy Anusha 
>>> wrote:

 Thank you Mohan that worked for me, but may I know why we need to place 
 them in double quotes??

 On Tue, Nov 13, 2018, 11:56 AM Mohan L >>>
>
>
> You have to quote the dictionary key as well. 
>
> FROM
>
> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' } 
>
> TO
>
> - { 'src_tar': '/home/virtual/xx/sample.tar.gz', 'dest_tar': 
> '/tmp/sss/' }
>
>
> Here is the working example. If you write a role and call that role 
> from playbook then you no need to use var_files section. vars/main.yml is 
> one of the default ansible search path. 
>
> See how my tasks/main.yml :
>
> # cat roles/xyz/tasks/main.yml 
>
> ---
>
> # tasks file for xyz
>
> - name: Extract /tmp/xx/sample.tar.gz into /tmp/sss
>
>   unarchive:
>
> src: "{{ item.src_path }}"
>
> dest: "{{ item.dest_path }}"
>
>   with_items: "{{ TAR }}"
>
>
>
> #See the vars/main.yml
>
> # cat roles/xyz/vars/main.yml 
>
> ---
>
> # vars file for xyz
>
> TAR:
>
>  - { "src_path": "/tmp/xx/sample.tar.gz", "dest_path": "/tmp/sss/" }
>
>
>
> # See the Ansible playbook
>
> # cat /etc/asnible/site.yml 
>
> ---
>
> - hosts: all
>
>   
>
>   roles:
>
> - xyz 
>
>
> # ansible-playbook site.yml
>
>
> TASK [xyz : Extract /tmp/xx/sample.tar.gz into /tmp/sss] 
> ***
>
> ok: [localhost] => (item={u'src_path': u'/tmp/xx/sample.tar.gz', 
> u'dest_path': u'/tmp/sss/'})
>
>
> PLAY RECAP 
> *
>
> localhost  : ok=2changed=0unreachable=0
> failed=0   
>
>
> # ls /tmp/xx/sample.tar.gz 
>
> /tmp/xx/sample.tar.gz
>
>
> # ls /tmp/sss/
>
> sample
>
>
>
>
> On Monday, November 12, 2018 at 11:09:08 PM UTC+5:30, 
> anushake...@gmail.com wrote:
>>
>> Hi Team,
>>
>> I am trying to unarchive a file is failing with below errors. Could 
>> someone please look into it.
>>
>> *Playbook:*
>>
>> ---
>>
>> - hosts: all
>>
>>   vars_files:
>>
>>   - /etc/ansible/xx/xyz/vars/main.yml
>>
>>   tasks:
>>
>>   - name: test
>>
>> unarchive:
>>
>>   src: "{{ item.src_tar }}"
>>
>>   dest: “{{ item.dest_tar }}”
>>
>> with_items: "{{ TAR }}"
>>
>>
>> *vars_files:*
>>
>>
>> TAR:
>>
>> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' }
>>
>>
>> *Error:*
>>
>> "msg": "The task includes an option with an undefined variable. The 
>> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error 
>> appears 
>> to have been in '/etc/ansible/xx/xyz/tasks/main.yml': line 23, column 5, 
>> but may\nbe elsewhere in the file depending on the exact syntax 
>> problem.\n\nThe offending line appears to be:\n\nwith_items: \"{{ 
>> TAR 
>> }}\"\n  - name: test\n^ here\n"}
>>
> 

Re: [ansible-project] Re: unarchive a file is failing

2018-11-13 Thread anushakeshipeddy4
Please find the files below.


*vars/main.yml*

XYZ:
- { src: '/tmp/abc/ab.warr', dest: '/tmp/abc/' }

TAR:
- { "src_tar": "/tmp/xx/sample.tar.gz", "dest_tar": "/tmp/sss/" }

*tasks/main.yml*

---
- hosts: all
  vars_files:
  - /etc/ansible/xxx/xyz/vars/main.yml
  tasks:
  - name: test
unarchive:
  src: "{{ item.src_tar }}"
  dest: "{{ item.dest_tar }}"
with_items: "{{ TAR }}"


On Tuesday, November 13, 2018 at 2:06:40 PM UTC+5:30, Mohan L wrote:
>
>
> It looks like again you are not placing quotes around dictionary key. Can 
> you please show your code which through this error?
>
> On Tuesday, November 13, 2018 at 12:53:39 PM UTC+5:30, 
> anushake...@gmail.com wrote:
>>
>> It is unpacking a tar file successfully but at the same time I am getting 
>> below error. Could you please help.
>>
>>
>>  {"msg": "The task includes an option with an undefined variable. The 
>> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
>> to have been in '/etc/ansible/xxx/xy/tasks/main.yml': line 26, column 5, 
>> but may\nbe elsewhere in the file depending on the exact syntax 
>> problem.\n\nThe offending line appears to be:\n\n\n  - name: test\n^ 
>> here\n"}
>>
>>
>> On Tuesday, November 13, 2018 at 12:46:58 PM UTC+5:30, Keshipeddy Anusha 
>> wrote:
>>>
>>> Thank you Mohan that worked for me, but may I know why we need to place 
>>> them in double quotes??
>>>
>>> On Tue, Nov 13, 2018, 11:56 AM Mohan L >>


 You have to quote the dictionary key as well. 

 FROM

 - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' } 

 TO

 - { 'src_tar': '/home/virtual/xx/sample.tar.gz', 'dest_tar': 
 '/tmp/sss/' }


 Here is the working example. If you write a role and call that role 
 from playbook then you no need to use var_files section. vars/main.yml is 
 one of the default ansible search path. 

 See how my tasks/main.yml :

 # cat roles/xyz/tasks/main.yml 

 ---

 # tasks file for xyz

 - name: Extract /tmp/xx/sample.tar.gz into /tmp/sss

   unarchive:

 src: "{{ item.src_path }}"

 dest: "{{ item.dest_path }}"

   with_items: "{{ TAR }}"



 #See the vars/main.yml

 # cat roles/xyz/vars/main.yml 

 ---

 # vars file for xyz

 TAR:

  - { "src_path": "/tmp/xx/sample.tar.gz", "dest_path": "/tmp/sss/" }



 # See the Ansible playbook

 # cat /etc/asnible/site.yml 

 ---

 - hosts: all

   

   roles:

 - xyz 


 # ansible-playbook site.yml


 TASK [xyz : Extract /tmp/xx/sample.tar.gz into /tmp/sss] 
 ***

 ok: [localhost] => (item={u'src_path': u'/tmp/xx/sample.tar.gz', 
 u'dest_path': u'/tmp/sss/'})


 PLAY RECAP 
 *

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


 # ls /tmp/xx/sample.tar.gz 

 /tmp/xx/sample.tar.gz


 # ls /tmp/sss/

 sample




 On Monday, November 12, 2018 at 11:09:08 PM UTC+5:30, 
 anushake...@gmail.com wrote:
>
> Hi Team,
>
> I am trying to unarchive a file is failing with below errors. Could 
> someone please look into it.
>
> *Playbook:*
>
> ---
>
> - hosts: all
>
>   vars_files:
>
>   - /etc/ansible/xx/xyz/vars/main.yml
>
>   tasks:
>
>   - name: test
>
> unarchive:
>
>   src: "{{ item.src_tar }}"
>
>   dest: “{{ item.dest_tar }}”
>
> with_items: "{{ TAR }}"
>
>
> *vars_files:*
>
>
> TAR:
>
> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' }
>
>
> *Error:*
>
> "msg": "The task includes an option with an undefined variable. The 
> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
> to have been in '/etc/ansible/xx/xyz/tasks/main.yml': line 23, column 5, 
> but may\nbe elsewhere in the file depending on the exact syntax 
> problem.\n\nThe offending line appears to be:\n\nwith_items: \"{{ TAR 
> }}\"\n  - name: test\n^ here\n"}
>
 -- 
 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/95a45bc1-676f-496b-8e03-709c10a845eb%40googlegroups.com
  
 

Re: [ansible-project] Re: unarchive a file is failing

2018-11-13 Thread Mohan L

It looks like again you are not placing quotes around dictionary key. Can 
you please show your code which through this error?

On Tuesday, November 13, 2018 at 12:53:39 PM UTC+5:30, 
anushake...@gmail.com wrote:
>
> It is unpacking a tar file successfully but at the same time I am getting 
> below error. Could you please help.
>
>
>  {"msg": "The task includes an option with an undefined variable. The 
> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
> to have been in '/etc/ansible/xxx/xy/tasks/main.yml': line 26, column 5, 
> but may\nbe elsewhere in the file depending on the exact syntax 
> problem.\n\nThe offending line appears to be:\n\n\n  - name: test\n^ 
> here\n"}
>
>
> On Tuesday, November 13, 2018 at 12:46:58 PM UTC+5:30, Keshipeddy Anusha 
> wrote:
>>
>> Thank you Mohan that worked for me, but may I know why we need to place 
>> them in double quotes??
>>
>> On Tue, Nov 13, 2018, 11:56 AM Mohan L  
>> wrote:
>>
>>>
>>>
>>> You have to quote the dictionary key as well. 
>>>
>>> FROM
>>>
>>> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' } 
>>>
>>> TO
>>>
>>> - { 'src_tar': '/home/virtual/xx/sample.tar.gz', 'dest_tar': '/tmp/sss/' 
>>> }
>>>
>>>
>>> Here is the working example. If you write a role and call that role from 
>>> playbook then you no need to use var_files section. vars/main.yml is one of 
>>> the default ansible search path. 
>>>
>>> See how my tasks/main.yml :
>>>
>>> # cat roles/xyz/tasks/main.yml 
>>>
>>> ---
>>>
>>> # tasks file for xyz
>>>
>>> - name: Extract /tmp/xx/sample.tar.gz into /tmp/sss
>>>
>>>   unarchive:
>>>
>>> src: "{{ item.src_path }}"
>>>
>>> dest: "{{ item.dest_path }}"
>>>
>>>   with_items: "{{ TAR }}"
>>>
>>>
>>>
>>> #See the vars/main.yml
>>>
>>> # cat roles/xyz/vars/main.yml 
>>>
>>> ---
>>>
>>> # vars file for xyz
>>>
>>> TAR:
>>>
>>>  - { "src_path": "/tmp/xx/sample.tar.gz", "dest_path": "/tmp/sss/" }
>>>
>>>
>>>
>>> # See the Ansible playbook
>>>
>>> # cat /etc/asnible/site.yml 
>>>
>>> ---
>>>
>>> - hosts: all
>>>
>>>   
>>>
>>>   roles:
>>>
>>> - xyz 
>>>
>>>
>>> # ansible-playbook site.yml
>>>
>>>
>>> TASK [xyz : Extract /tmp/xx/sample.tar.gz into /tmp/sss] 
>>> ***
>>>
>>> ok: [localhost] => (item={u'src_path': u'/tmp/xx/sample.tar.gz', 
>>> u'dest_path': u'/tmp/sss/'})
>>>
>>>
>>> PLAY RECAP 
>>> *
>>>
>>> localhost  : ok=2changed=0unreachable=0
>>> failed=0   
>>>
>>>
>>> # ls /tmp/xx/sample.tar.gz 
>>>
>>> /tmp/xx/sample.tar.gz
>>>
>>>
>>> # ls /tmp/sss/
>>>
>>> sample
>>>
>>>
>>>
>>>
>>> On Monday, November 12, 2018 at 11:09:08 PM UTC+5:30, 
>>> anushake...@gmail.com wrote:

 Hi Team,

 I am trying to unarchive a file is failing with below errors. Could 
 someone please look into it.

 *Playbook:*

 ---

 - hosts: all

   vars_files:

   - /etc/ansible/xx/xyz/vars/main.yml

   tasks:

   - name: test

 unarchive:

   src: "{{ item.src_tar }}"

   dest: “{{ item.dest_tar }}”

 with_items: "{{ TAR }}"


 *vars_files:*


 TAR:

 - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' }


 *Error:*

 "msg": "The task includes an option with an undefined variable. The 
 error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
 to have been in '/etc/ansible/xx/xyz/tasks/main.yml': line 23, column 5, 
 but may\nbe elsewhere in the file depending on the exact syntax 
 problem.\n\nThe offending line appears to be:\n\nwith_items: \"{{ TAR 
 }}\"\n  - name: test\n^ here\n"}

>>> -- 
>>> 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/95a45bc1-676f-496b-8e03-709c10a845eb%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 

Re: [ansible-project] Re: unarchive a file is failing

2018-11-13 Thread Mohan L
Ansible think src_tar as variable If you don't place quotes so through 
error saying undefined variable.   

On Tuesday, November 13, 2018 at 12:46:58 PM UTC+5:30, Keshipeddy Anusha 
wrote:
>
> Thank you Mohan that worked for me, but may I know why we need to place 
> them in double quotes??
>
> On Tue, Nov 13, 2018, 11:56 AM Mohan L  
> wrote:
>
>>
>>
>> You have to quote the dictionary key as well. 
>>
>> FROM
>>
>> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' } 
>>
>> TO
>>
>> - { 'src_tar': '/home/virtual/xx/sample.tar.gz', 'dest_tar': '/tmp/sss/' }
>>
>>
>> Here is the working example. If you write a role and call that role from 
>> playbook then you no need to use var_files section. vars/main.yml is one of 
>> the default ansible search path. 
>>
>> See how my tasks/main.yml :
>>
>> # cat roles/xyz/tasks/main.yml 
>>
>> ---
>>
>> # tasks file for xyz
>>
>> - name: Extract /tmp/xx/sample.tar.gz into /tmp/sss
>>
>>   unarchive:
>>
>> src: "{{ item.src_path }}"
>>
>> dest: "{{ item.dest_path }}"
>>
>>   with_items: "{{ TAR }}"
>>
>>
>>
>> #See the vars/main.yml
>>
>> # cat roles/xyz/vars/main.yml 
>>
>> ---
>>
>> # vars file for xyz
>>
>> TAR:
>>
>>  - { "src_path": "/tmp/xx/sample.tar.gz", "dest_path": "/tmp/sss/" }
>>
>>
>>
>> # See the Ansible playbook
>>
>> # cat /etc/asnible/site.yml 
>>
>> ---
>>
>> - hosts: all
>>
>>   
>>
>>   roles:
>>
>> - xyz 
>>
>>
>> # ansible-playbook site.yml
>>
>>
>> TASK [xyz : Extract /tmp/xx/sample.tar.gz into /tmp/sss] 
>> ***
>>
>> ok: [localhost] => (item={u'src_path': u'/tmp/xx/sample.tar.gz', 
>> u'dest_path': u'/tmp/sss/'})
>>
>>
>> PLAY RECAP 
>> *
>>
>> localhost  : ok=2changed=0unreachable=0
>> failed=0   
>>
>>
>> # ls /tmp/xx/sample.tar.gz 
>>
>> /tmp/xx/sample.tar.gz
>>
>>
>> # ls /tmp/sss/
>>
>> sample
>>
>>
>>
>>
>> On Monday, November 12, 2018 at 11:09:08 PM UTC+5:30, 
>> anushake...@gmail.com wrote:
>>>
>>> Hi Team,
>>>
>>> I am trying to unarchive a file is failing with below errors. Could 
>>> someone please look into it.
>>>
>>> *Playbook:*
>>>
>>> ---
>>>
>>> - hosts: all
>>>
>>>   vars_files:
>>>
>>>   - /etc/ansible/xx/xyz/vars/main.yml
>>>
>>>   tasks:
>>>
>>>   - name: test
>>>
>>> unarchive:
>>>
>>>   src: "{{ item.src_tar }}"
>>>
>>>   dest: “{{ item.dest_tar }}”
>>>
>>> with_items: "{{ TAR }}"
>>>
>>>
>>> *vars_files:*
>>>
>>>
>>> TAR:
>>>
>>> - { src_tar: '/home/virtual/xx/sample.tar.gz', dest_tar: '/tmp/sss/' }
>>>
>>>
>>> *Error:*
>>>
>>> "msg": "The task includes an option with an undefined variable. The 
>>> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
>>> to have been in '/etc/ansible/xx/xyz/tasks/main.yml': line 23, column 5, 
>>> but may\nbe elsewhere in the file depending on the exact syntax 
>>> problem.\n\nThe offending line appears to be:\n\nwith_items: \"{{ TAR 
>>> }}\"\n  - name: test\n^ here\n"}
>>>
>> -- 
>> 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/95a45bc1-676f-496b-8e03-709c10a845eb%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/c3d97692-e2c0-4221-9722-d223f01c7646%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-13 Thread Tom K.


On Monday, November 5, 2018 at 9:52:15 AM UTC-5, Kai Stian Olstad wrote:
>
> On Monday, 5 November 2018 15:38:51 CET Uwe Sauter wrote: 
> > Sure, but the template will only be used for the one host and as such 
> should not look for variables of other hosts, right? 
>
> It will look up the variable on all host in group mysql 
>
> This is the code in the template 
>
>   {% for host in groups['mysql']%} 
>   {{hostvars[host]['ansible_default_ipv4']['address']}}{% if not loop.last 
> %},{% endif %} 
>   {% endfor %} 
>
> In the inventory he has 
>   [mysql] 
>   mysql01 
>   mysql02 
>   mysql03 
>   mysql04 
>
> In the first iteration host = mysql01 so he is running 
>   {{ hostvars['mysql01']['ansible_default_ipv4']['address'] }} 
>
> But since gather fact has not been run this will get you the error 
> undefined variable. 
>

Sorry for the late reply.  We might have lost track of the original error.  
mysql0[1-3] are ok and print all variables.  Only host mysql04 prints the 
undefined variable.  (see above).  Going to do more tests on your 
suggestions and see further.  Included a few of the modifications Uwe 
pointed out as well. My Ansible version:

[root@awx01 ansible]# rpm -aq|grep -Ei ansible
ansible-inventory-grapher-2.4.4-1.el7.noarch
ansible-lint-3.4.21-1.el7.noarch
ansible-review-0.13.4-1.el7.noarch
ansible-doc-2.5.3-1.el7.noarch
ansible-2.7.0-1.el7.noarch
[root@awx01 ansible]#

 

>
>
> -- 
> 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/9e7c7e53-144c-45d9-8542-3250d80eca29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.