[ansible-project] Running Ansible with Concourse

2019-11-18 Thread Bishwajit Samanta

Hi, I am trying to run ansible within Concourse, however when i am running 
i am only able to ping localhost. I cannot make passwordless login. I may 
be missing somewhere. Below are my steps:-

I need some guidance as i am not able to Find any resource in Internet.

Concourse Yaml File:-
---
resource_types:
- name: ansible-playbook
  type: docker-image
  source:
repository: troykinsella/concourse-ansible-playbook-resource
tag: latest

resources:
- name: ansible
  type: ansible-playbook
  source:
debug: true
user: cloud_user
ssh_private_key: ((ssh-key))
verbose: vvv

- name: source-code
  type: git
  source:
uri: ((git-repo))
branch: master
private_key: ((ssh-key))

jobs:
  - name: ansible-concourse
plan:
- get: source-code # git resource
- put: ansible
  params:
check: true
diff: true
become: true
become_user: root
inventory: inventory/hosts
playbook: site.yml
path: source-code
  
Host File:-
--
[test]
localhost

Inside the Container:-
---

I intercepted the container and i can ssh to any IP inside, however i am 
not able to make ssh-login.

Ansible Playbook:-


  
---
- name: "Running Current Working Directory"
  hosts: test
  gather_facts: no

  tasks:
 - name: "Current Working Directory"
   shell: pwd
   register: value

 - debug:
  msg: "The Current Working Directory {{value.stdout_lines}}"

Output Coming in Concourse:-
-

ansible-playbook   -i inventory/hosts --private-key 
/tmp/ansible-playbook-resource-ssh-private-key   --user cloud_user   -vvv 
site.yml
ansible-playbook 2.9.0
  config file = /tmp/build/put/source-code/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.8 (default, Oct  7 2019, 12:59:55) [GCC 8.3.0]
Using /tmp/build/put/source-code/ansible.cfg as config file
host_list declined parsing /tmp/build/put/source-code/inventory/hosts as it 
did not pass its verify_file() method
script declined parsing /tmp/build/put/source-code/inventory/hosts as it 
did not pass its verify_file() method
auto declined parsing /tmp/build/put/source-code/inventory/hosts as it did 
not pass its verify_file() method
Parsed /tmp/build/put/source-code/inventory/hosts inventory source with ini 
plugin

PLAYBOOK: site.yml 
*
1 plays in site.yml

PLAY [Running Current Working Directory] 
***
META: ran handlers

TASK [Current Working Directory] 
***
task path: /tmp/build/put/source-code/site.yml:7
Monday 18 November 2019  12:38:49 + (0:00:00.084)   0:00:00.085 
*** 
 ESTABLISH SSH CONNECTION FOR USER: cloud_user
 SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
'IdentityFile="/tmp/ansible-playbook-resource-ssh-private-key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o 'User="cloud_user"' -o ConnectTimeout=10 -o 
ControlPath=/root/.ansible/cp/dc52b3112c localhost '/bin/sh -c '"'"'echo 
~cloud_user && sleep 0'"'"''
 (255, b'', b'')
fatal: [localhost]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ",
"unreachable": true
}

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

Monday 18 November 2019  12:38:49 + (0:00:00.029)   0:00:00.114 
*** 
=== 
Current Working Directory --- 
0.03s
/tmp/build/put/source-code/site.yml:7 
-
  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/80ac12ef-c32d-4e86-ad65-bfdc97b759a5%40googlegroups.com.


Re: [ansible-project] Multiple Directories Multiple Permissions

2019-08-08 Thread Bishwajit Samanta
Woww !!! Great.. that's work like a charm.. 

On Thursday, August 8, 2019 at 11:44:40 PM UTC+5:30, Dick Visser wrote:
>
> --- 
>
> - hosts: localhost 
>   connection: local 
>   gather_facts: no 
>
>   vars: 
> folders: 
>   - path: a 
> mode: '755' 
>   - path: b 
> mode: '754' 
>   - path: c 
> mode: '745' 
>
>   tasks: 
> - name: Ensure folders and permissions are ok 
>   file: 
> state: directory 
> path: "{{ item.path }}" 
> mode: "{{ item.mode }}" 
>   loop: "{{ folders }}" 
>
>
> On Thu, 8 Aug 2019 at 18:04, Bishwajit Samanta 
> > wrote: 
> > 
> > Hi, 
> > 
> > I am looking for ways to solve my problem statement. 
> > 
> > I have a list of directories with different permissions for example, 
> > 
> > /path/to/folderA: 0755 
> > /path/to/folderB: 0754 
> > /path/to/folderC: 0745 
> > 
> > Now today I have 3 folders of 3 different permissions tomorrow I have 6 
> folders of 6 different permissions. 
> > 
> >  I want to dump my required folders and permissions in a file and need 
> to execute ansible playbook to give permission accordingly. 
> > 
> > Even Shell Script is also ok if anybody can solve it. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to ansible...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/983190b5-2061-489a-a1da-2cde5ed0d9d7%40googlegroups.com.
>  
>
>
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/530b3810-a801-45ea-81c7-0c262eca0186%40googlegroups.com.


[ansible-project] Multiple Directories Multiple Permissions

2019-08-08 Thread Bishwajit Samanta
Hi,

I am looking for ways to solve my problem statement.

I have a list of directories with different permissions for example,

/path/to/folderA: 0755
/path/to/folderB: 0754
/path/to/folderC: 0745

Now today I have 3 folders of 3 different permissions tomorrow I have 6 
folders of 6 different permissions.

 I want to dump my required folders and permissions in a file and need to 
execute ansible playbook to give permission accordingly.

Even Shell Script is also ok if anybody can solve it.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/983190b5-2061-489a-a1da-2cde5ed0d9d7%40googlegroups.com.


[ansible-project] Folder Permission for Multiple directories at once

2019-08-07 Thread Bishwajit Samanta
Hi All,

I am trying to achieve mentioning multiple directories in var.yml so that 
in loop i can give them folder permission however it is not working. Can 
anyone help me here.

---
- name: "File List"
hosts: localhost
gather_facts: no
become: yes
become_user: root

tasks:
- include_vars: var.yml
- name: "Folder Permission"
file: 
path: '{{ item }}'
mode: '{{ folder_perm }}'
loop: "{{ folder_path }}"

ignore_errors: true

- name: "File Permission"
file: 
path: '{{ file_path }}'
mode: '{{ file_perm }}'
ignore_errors: true

vars.yml

---

folder_path: 
- /home/sysops/bishwajit/ansible/folder_perm/
- /home/sysops/bishwajit/ansible/demo_perm
- /home/sysops/bishwajit/ansible/sample_perm
file_path: /home/sysops/bishwajit/ansible/folder_perm/file_perm
folder_perm: 0755
file_perm: 0644


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8b8c1fc0-436f-447f-9d78-a847ad77aa90%40googlegroups.com.


[ansible-project] Can we Run Command in Jinja2 Template

2019-07-10 Thread Bishwajit Samanta
Hi Team,

I was curious can we run command in jinja2 template say example


{{pwd}} === here pwd is a shell command.

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


[ansible-project] Vmware + when clause in Ansible

2018-09-08 Thread Bishwajit Samanta
Hi

I am not able to use the Vm Poweredoff status in my when clause.

Can anyone tell me how to fix it.

- name: "Collecting Vmware Guest Facts"
  hosts: localhost

  vars:
msg: |
 {{ value.instance.hw_power_status }}


  tasks:
- name: Gathering Facts
  vmware_guest_facts:
hostname: 192.168.119.129
username: root
password: xxx
datacenter: vntgautvol-64.localdomain
uuid: 564d6556-765a-d5eb-dcc9-711988d1e157
validate_certs: no

  register: value

- debug:
msg: "Vm_Power_status: {{ msg[:-1] }}"

- name: Checking some value
  command: echo vm is "{{ msg }}"
  register: val

  when: msg == "poweredOff"


Error::-

TASK [Checking some value] 
*
task path: /root/ansible/facts.yml:27
skipping: [localhost] => {
"changed": false,
"skip_reason": "Conditional result was False"
}


output ::-
---TASK [debug] 
***
task path: /root/ansible/facts.yml:24
ok: [localhost] => {
"msg": "Vm_Power_status: poweredOff"
}



 ],
"hw_is_template": false,
"hw_memtotal_mb": 1024,
"hw_name": "Test",
"hw_power_status": "poweredOff",
"hw_processor_count": 1,
"hw_product_uuid": "564d6556-765a-d5eb-dcc9-711988d1e157",
"hw_version": "vmx-14",
"instance_uuid": "52d54b23-b8c1-3a2f-e9e3-7fb1424f40a8",
"ipv4": null,
"ipv6": null,
"module_hw": true,
"snapshots": []

-- 
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/371624c3-f3a4-4c76-b15d-a60eef63bdb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Standalone ESXI with Vmware (Evaluation Version ESXI)

2018-09-08 Thread Bishwajit Samanta
Any help ?

On Thursday, September 6, 2018 at 5:30:20 PM UTC+5:30, Bishwajit Samanta 
wrote:
>
> Dear Team,
>
> I want to Run some shell commands in Vmware through Ansible. But i am 
> facing Some errors. If possible can you help me.
>
>
> - name: Run command inside a vm
>   vmware_vm_shell:
> hostname: 192.168.119.129
> username: x
> password: xx
> datacenter: vntgautvol-64.localdomain
> folder: /ha-datacenter/vm
> vm_id: Test
> vm_username: x
> vm_password: xx
> vm_shell: /bin/echo
> vm_shell_args: " $var >> myFile "
> vm_shell_env:
>   - "PATH=/bin"
>   - "VAR=test"
> vm_shell_cwd: "/tmp"
> validate_certs: no
>
> when i am running this, it is saying unable to find datacenter. But when i 
> am running vmware_guest_facts module i am not facing any issue regarding 
> Datacenter.
>
> Mine is Evaluation Version, Below script is working with the same 
> datacenter
>
> ---
>
> - name: "Collecting Vmware Guest Facts"
>   hosts: localhost
>
>   tasks:
> - name: Gathering Facts
>   vmware_guest_facts:
> hostname: 192.168.119.129
> username: xxx
> password: xx
> datacenter: vntgautvol-64.localdomain
> uuid: 564d6556-765a-d5eb-dcc9-711988d1e157
> validate_certs: no
>
>   register: value
>
> - debug: var=value.instance.hw_power_status
>
> This gives me correct output.
>
>
> CAN ANYBODY TELL ME WHICH ALL ARE THE MODULES I CAN USE THROUGH ANSIBLE 
> WITHOUT VCENTER...
>
>
>
>
>
>
>

-- 
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/4eb0b456-2c1f-49d8-8d4a-f110ddc6f52d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] when clause in Ansible not working + Vmware

2018-09-08 Thread Bishwajit Samanta


Hi Team,

When clause is not working in Ansible as it is getting skipped. Can anybody 
help me with the error.


---

- name: "Collecting Vmware Guest Facts"
  hosts: localhost

  vars:
msg: |
 {{ value.instance.hw_power_status }}


  tasks:
- name: Gathering Facts
  vmware_guest_facts:
hostname: 192.168.119.129
username: root
password: Password@123
datacenter: vntgautvol-64.localdomain
uuid: 564d6556-765a-d5eb-dcc9-711988d1e157
validate_certs: no

  register: value

- debug:
msg: "Vm_Power_status: {{ msg[:-1] }}"

- name: Checking some value
  command: echo vm is "{{ msg }}"
  register: val

  when: msg == "poweredOff"


Error::-

TASK [Checking some value] 
*
task path: /root/ansible/facts.yml:27
skipping: [localhost] => {
"changed": false,
"skip_reason": "Conditional result was False"
}


output ::-
---

 ],
"hw_is_template": false,
"hw_memtotal_mb": 1024,
"hw_name": "Test",
"hw_power_status": "poweredOff",
"hw_processor_count": 1,
"hw_product_uuid": "564d6556-765a-d5eb-dcc9-711988d1e157",
"hw_version": "vmx-14",
"instance_uuid": "52d54b23-b8c1-3a2f-e9e3-7fb1424f40a8",
"ipv4": null,
"ipv6": null,
"module_hw": true,
"snapshots": []



-- 
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/f1f1ea00-97d1-44ce-9784-a0626c0d8384%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Standalone ESXI with Vmware (Evaluation Version ESXI)

2018-09-06 Thread Bishwajit Samanta
Dear Team,

I want to Run some shell commands in Vmware through Ansible. But i am 
facing Some errors. If possible can you help me.


- name: Run command inside a vm
  vmware_vm_shell:
hostname: 192.168.119.129
username: x
password: xx
datacenter: vntgautvol-64.localdomain
folder: /ha-datacenter/vm
vm_id: Test
vm_username: x
vm_password: xx
vm_shell: /bin/echo
vm_shell_args: " $var >> myFile "
vm_shell_env:
  - "PATH=/bin"
  - "VAR=test"
vm_shell_cwd: "/tmp"
validate_certs: no

when i am running this, it is saying unable to find datacenter. But when i 
am running vmware_guest_facts module i am not facing any issue regarding 
Datacenter.

Mine is Evaluation Version, Below script is working with the same datacenter

---

- name: "Collecting Vmware Guest Facts"
  hosts: localhost

  tasks:
- name: Gathering Facts
  vmware_guest_facts:
hostname: 192.168.119.129
username: xxx
password: xx
datacenter: vntgautvol-64.localdomain
uuid: 564d6556-765a-d5eb-dcc9-711988d1e157
validate_certs: no

  register: value

- debug: var=value.instance.hw_power_status

This gives me correct output.


CAN ANYBODY TELL ME WHICH ALL ARE THE MODULES I CAN USE THROUGH ANSIBLE 
WITHOUT VCENTER...






-- 
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/7d287f33-18cc-4951-a98c-3dce4a353f76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Vmware Esxi with Ansible

2018-08-29 Thread Bishwajit Samanta
Hi,

I am having below things in my Vm's (Vmware free license)

pyvmomi installed in Ubuntu 16 where ansible also installed 
(192.168.119.131)
ansible 2.7
Esxi 6.5(192.168.119.129)
1 VM (Ubuntu) in vmware named as Test (192.168.119.130) whose vmware 
guest_facts i am finding out through UUID

My host file (Ansible) 

[vmware]
192.168.119.129

My Playbook:

---
- name: Running Vmware Playbook
  hosts: vmware

  tasks:
- name: Printing Vmware Guest Facts
  vmware_guest_facts:
hostname: 192.168.119.129
username: root
password: 
datacenter: vntgautvol-64.localdomain
validate_certs: no
uuid: 56654D56-5A76-EBD5-DCC9-711988D1E157
  delegate_to: localhost
  register: facts

- debug: var=facts.stdout

Error Statement: I guess my ansible playbook is still accepting ssh 
connection but it should use pyvmomi connection may be not sure what to do. 
Can anyone help me out ?

Error Log::-
==

root@ansibleubuntu:~/ansible# ansible-playbook test.yml

PLAY [Running Vmware Playbook] 
*

TASK [Gathering Facts] 
*
fatal: [192.168.119.129]: UNREACHABLE! => {"changed": false, "msg": "Failed 
to connect to the host via ssh: Permission denied 
(publickey,keyboard-interactive).\r\n", "unreachable": true}
to retry, use: --limit @/root/ansible/test.retry

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


On Wednesday, August 29, 2018 at 4:46:32 AM UTC+5:30, Greg Porter wrote:
>
> Well.  after further thought...
>
> When I did this, I used the VMware modules, like those at 
> https://docs.ansible.com/ansible/latest/modules/list_of_cloud_modules.html#vmware
>
> These require use of the VMware vSphere API Python Bindings , pyvmomi.  
> https://github.com/vmware/pyvmomi
>
> You install pyvmomi on the machine you are running the Ansible playbooks 
> from.
>
> Then when you run a playbook that uses a VMware module, the playbook uses 
> pyvmomi to connect directly to the ESXi hypervisor (or vCenter) using the 
> VMware API.  Not ssh. 
>
> The machine you run playbooks from has to have network access to the ESXi 
> hypervisor or vCenter on the various ports that the vSphere API requires.
>
> HTH some more.
>
> Greg
>
>
> On Tuesday, 28 August 2018 16:07:09 UTC-7, Greg Porter wrote:
>>
>> Hmm.  Well, by default ESXi hypervisors have ssh turned off.  You need to 
>> manually go turn it on.  Make sure ssh is running on the host.  
>> https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.vcli.getstart.doc%2FGUID-C3A44A30-EEA5-4359-A248-D13927A94CCE.html
>>
>> HTH
>>
>> Greg
>>
>> On Tuesday, 28 August 2018 07:09:58 UTC-7, Bishwajit Samanta wrote:
>>>
>>> Hi,
>>>
>>>  I am trying to connect esxi 6.5 with ansible. I have copied ssh keys 
>>> using ssh-copy-id to root id of the esxi server but when i am executing 
>>> ansible -m ping vmware(ip) it says permission denied. Any idea how to make 
>>> it work out ?
>>>
>>> 192.168.119.129 | UNREACHABLE! => {
>>> "changed": false,
>>> "msg": "Failed to connect to the host via ssh: Permission denied 
>>> (publickey,keyboard-interactive).\r\n",
>>> "unreachable": true
>>> }
>>>
>>> Sudoers is not there in esxi servers.. am i missing any point 
>>>
>>

-- 
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/1afa79f5-59e1-4190-bda5-ec8f01ad62ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Vmware Esxi with Ansible

2018-08-28 Thread Bishwajit Samanta
Hi,

 I am trying to connect esxi 6.5 with ansible. I have copied ssh keys using 
ssh-copy-id to root id of the esxi server but when i am executing ansible 
-m ping vmware(ip) it says permission denied. Any idea how to make it work 
out ?

192.168.119.129 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied 
(publickey,keyboard-interactive).\r\n",
"unreachable": true
}

Sudoers is not there in esxi servers.. am i missing any point 

-- 
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/233f7bcf-0f4a-497f-9b6e-bf15d4d737ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to run Jenkins in docker container using Ansible

2018-05-21 Thread Bishwajit Samanta
Dear All,

I am not able to run jenkins inside docker container using ansible 
playbook. Jenkins is getting started but unable to run it 


- name: Download Jenkins Container
  docker_container: 
name: Jenkins_server 
image: jenkins 
state: started 
ports: 
  - "8080:8080"
  - "5:5"
command: sleep 1d 
volumes: 
  - /data 

This is starting the container but not able to run jenkins due to which i 
am not able to login to jenkins host.

Can anyone guide me what do to ?

-- 
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/babad340-11ba-4932-b885-0f2d36553a92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to install through dpkg in Ansible

2018-05-05 Thread Bishwajit Samanta
Hi, 

I am trying to install a .deb Package through Ansible, it is not getting 
installed. 

Error:-
--

TASK [recon_app : Install the Deb Package of ReconApp] 
***
Saturday 05 May 2018  18:34:02 +0530 (0:00:00.034)   0:00:00.034 
**
fatal: [192.168.56.124]: FAILED! => {"changed": false, "msg": "No package 
matching 
'/home/bishwajit/RECONAPP_1.0.0-26719-g5defc4d/reconapp_config_1.0.0-26719-g5defc4d_amd64.deb'
 
is available"}

But the Package is there ::-
--

-rw-r--r--  1 bishwajit bishwajit39 Mar 14 00:44 product-build.info
-rw-r--r--  1 bishwajit bishwajit253750 Mar 14 00:45 
reconapp_config_1.0.0-26719-g5defc4d_amd64.deb
-rw-rw-r--  1 bishwajit bishwajit 216942631 Mar 14 00:46 
reconcapp_karaf_1.0.0-26719-g5defc4d.tar.gz
-rw-rw-r--  1 bishwajit bishwajit   1733969 Mar 14 00:46 
scripts_1.0.0-26719-g5defc4d.zip

bishwajit@Ansible-deploy-04:~/RECONAPP_1.0.0-26719-g5defc4d$ dpkg -i 
reconapp_config_1.0.0-26719-g5defc4d_amd64.deb
dpkg: error: requested operation requires superuser privilege

What i found is it is asking for sudo priviledge so i changed the 
parameters to become, but still it is not getting resolved.


- name: Install the Deb Package of ReconApp
  apt:
name: 
"'/home/bishwajit/RECONAPP_1.0.0-26719-g5defc4d/reconapp_config_1.0.0-26719-g5defc4d_amd64.deb"
install_recommends: yes
state: present
  become: yes
  
Can anyone help me ?


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


Re: [ansible-project] Apache Karaf Output via Ansible

2018-05-04 Thread Bishwajit Samanta
I resolved the issue.. :)

On Fri 4 May, 2018, 17:24 Bishwajit Samanta, <bishwajitsamanta1...@gmail.com>
wrote:

> Hi Team,
>
> Is there any way to get the output of Karaf through ansible::
>
> If i am executing the below command::-
>
> # echo encrypt-text abcd | ./client ( I am getting the below output )
>
> 1249 [sshd-SshClient[6d78f375]-nio2-thread-2] WARN
> org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier - Server at [/
> 0.0.0.0:8101, DSA, 06:33:3e:47:5a:e5:bd:c2:f0:cf:74:22:e9:86:b6:c6]
> presented unverified {} key: {}
> __ __  
>/ //_/ __ _/ __/
>   / ,<  / __ `/ ___/ __ `/ /_
>  / /| |/ /_/ / /  / /_/ / __/
> /_/ |_|\__,_/_/   \__,_/_/
>
>   Apache Karaf (3.0.2)
>
> Hit '' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit 'system:shutdown' to shutdown Karaf.
> Hit '' or type 'logout' to disconnect shell from current session.
>
> admin@root()> encrypt-text abcd
> Encrypted value : DpuQ5swhCfVv0PgBC/z3PA==
> admin@root()>
>
>
> The value i am looking for is DpuQ5swhCfVv0PgBC/z3PA==
>
>
> I am writing my playbook as :-
>
>
> - name: encrypting the password from karaf
>   shell: "echo encrypt-text abcd | ./client"
>   register: password_output
>
> - debug: var=password_output.stdout
>
>
> But it is throwing error, can anyone help me in getting resolved?
>
> --
> 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/b848b9ca-4b32-49ec-b008-9aa7b482a4d6%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b848b9ca-4b32-49ec-b008-9aa7b482a4d6%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAPkwwd1LfJnc8AYg%3D4w3zrVT3QUP%3DMEc6VNw0i1VHUU-a1sjwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Apache Karaf Output via Ansible

2018-05-04 Thread Bishwajit Samanta
Hi Team,

Is there any way to get the output of Karaf through ansible::

If i am executing the below command::-

# echo encrypt-text abcd | ./client ( I am getting the below output )

1249 [sshd-SshClient[6d78f375]-nio2-thread-2] WARN 
org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier - Server at 
[/0.0.0.0:8101, DSA, 06:33:3e:47:5a:e5:bd:c2:f0:cf:74:22:e9:86:b6:c6] 
presented unverified {} key: {}
__ __  
   / //_/ __ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (3.0.2)

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit 'system:shutdown' to shutdown Karaf.
Hit '' or type 'logout' to disconnect shell from current session.

admin@root()> encrypt-text abcd
Encrypted value : DpuQ5swhCfVv0PgBC/z3PA==
admin@root()>


The value i am looking for is DpuQ5swhCfVv0PgBC/z3PA==


I am writing my playbook as :-


- name: encrypting the password from karaf 
  shell: "echo encrypt-text abcd | ./client"
  register: password_output

- debug: var=password_output.stdout 


But it is throwing error, can anyone help me in getting resolved?

-- 
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/b848b9ca-4b32-49ec-b008-9aa7b482a4d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Query ::- Ansible VPN connect

2018-04-27 Thread Bishwajit Samanta
Any help .. any idea please ...

On Fri 27 Apr, 2018, 17:11 Bishwajit Samanta, <
bishwajitsamanta1...@gmail.com> wrote:

> Hi all,
>
> I have a query about Connecting Ansible with VPN.
>
>  In our Environment we have Cisco VPN connected.
>
>  Would it be possible to connect ansible to those systems connected via
> CISCO VPN and then perform the tasks i gave for it ?
>
> Any source or links about this knowledge is welcomed...
>
> --
> 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/77430c59-b46b-49b5-acdf-4d9f287a98bd%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/77430c59-b46b-49b5-acdf-4d9f287a98bd%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAPkwwd2D_J4uK%2B%2BU47aXK06Ys%3DHnf3zH96MxgW2azRZ_U2fJ_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Query ::- Ansible VPN connect

2018-04-27 Thread Bishwajit Samanta
Hi all,

I have a query about Connecting Ansible with VPN.

 In our Environment we have Cisco VPN connected.

 Would it be possible to connect ansible to those systems connected via 
CISCO VPN and then perform the tasks i gave for it ?

Any source or links about this knowledge is welcomed... 

-- 
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/77430c59-b46b-49b5-acdf-4d9f287a98bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to use Shell script for Search guard Plugin in Elastic Search with Ansible

2018-04-16 Thread Bishwajit Samanta
Hi All,

I am running a shell script for installation of Search Guard Plugin for 
Elastic Search. Below is the error given. If any body knows any better way 
for Search Guard plugin you can suggest me.

Playbook:
-

---

- hosts: deploy
  gather_facts: no

  tasks:
- script: /opt/search_guard.sh


Contents of search_guard.sh ::-


cd /usr/share/elasticsearch/bin

sh  ./plugin install -b com.floragunn/search-guard-2/2.4.2.9



Error:-
--

TASK [script] 
***
Monday 16 April 2018  20:45:02 +0530 (0:00:00.072)   0:00:00.072 
**
fatal: [192.168.56.121]: FAILED! => {"changed": true, "msg": "non-zero 
return code", "rc": 127, "stderr": "Shared connection to 192.168.56.121 
closed.\r\n", "stdout": "/bin/sh: 1: 
/root/.ansible/tmp/ansible-tmp-1523891702.02-243715668987716/search_guard.sh: 
not found\r\n", "stdout_lines": ["/bin/sh: 1: 
/root/.ansible/tmp/ansible-tmp-1523891702.02-243715668987716/search_guard.sh: 
not found"]}


Though the script was present in the location.

-- 
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/3531ffc9-bb35-4ba2-a782-38cf44dc377a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Postgresql(psycopg2.ProgrammingError: relation "products" does not exist) with Ansible 2.4

2018-04-15 Thread Bishwajit Samanta
Thanks Kai, that problem got solved. but after that 1 more problem created. 
Below is the error log. Now i am able to create database.

Error::-
-

TASK [database : Install Postgress 9.5 Version and its dependencies] 

Sunday 15 April 2018  15:46:32 +0530 (0:00:00.036)   0:00:00.036 
**
changed: [192.168.56.121] => (item=[u'postgresql', u'libpq-dev', 
u'python-psycopg2', u'postgresql-client-common', u'postgresql-contrib'])

TASK [database : Make change in postgresql.conf file] 
***
Sunday 15 April 2018  15:47:00 +0530 (0:00:27.474)   0:00:27.511 
**
ok: [192.168.56.121]

TASK [database : Daemon-Reload for Postgress] 
***
Sunday 15 April 2018  15:47:01 +0530 (0:00:01.188)   0:00:28.699 
**
changed: [192.168.56.121]

TASK [database : create a new postgresql Database] 
**
Sunday 15 April 2018  15:47:05 +0530 (0:00:04.637)   0:00:33.337 
**
changed: [192.168.56.121]

TASK [database : Create Postgress User] 
*
Sunday 15 April 2018  15:47:07 +0530 (0:00:01.552)   0:00:34.890 
**
An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: psycopg2.ProgrammingError: relation "products" does 
not exist
fatal: [192.168.56.121]: FAILED! => {"changed": false, "module_stderr": 
"Traceback (most recent call last):\n  File 
\"/tmp/ansible_9cE3qn/ansible_module_postgresql_user.py\", line 846, in 
\nmain()\n  File 
\"/tmp/ansible_9cE3qn/ansible_module_postgresql_user.py\", line 815, in 
main\nchanged = grant_privileges(cursor, user, privs) or changed\n  
File \"/tmp/ansible_9cE3qn/ansible_module_postgresql_user.py\", line 602, 
in grant_privileges\ngrant_funcs[type_](cursor, user, name, 
privileges)\n  File 
\"/tmp/ansible_9cE3qn/ansible_module_postgresql_user.py\", line 491, in 
grant_table_privileges\ncursor.execute(query)\n  File 
\"/usr/lib/python2.7/dist-packages/psycopg2/extras.py\", line 120, in 
execute\nreturn super(DictCursor, self).execute(query, 
vars)\npsycopg2.ProgrammingError: relation \"products\" does not 
exist\n\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}


On Sunday, April 15, 2018 at 2:48:21 PM UTC+5:30, Bishwajit Samanta wrote:
>
> Hi, i am having a problem in setting up postgresql through ansible.
>
> Error::-
> --
>
>
>  Peer authentication failed for user "postgres". I checked google, i found 
> people as saying i need to use become and become_user: postgress. But even 
> after doing that i am getting, that those are not valid attribute .
>
> My code is :: 
> -
>
> - name: Install Postgress 9.5 Version and its dependencies 
>   apt:
> name: "{{ item }}"
> update_cache: yes
> cache_valid_time: 3600
>
>   with_items:
>
> - postgresql
> - libpq-dev 
> - python-psycopg2
> - postgresql-client-common
> - postgresql-contrib
>  
>
> - name: Make change in postgresql.conf file 
>   template:
> src: postgresql_conf.jinja2
> dest: /etc/postgresql/9.5/main/postgresql.conf
> mode: 0644
> owner: postgres
> group: postgres 
>
>
> - name: Daemon-Reload for Postgress
>   systemd:
> state: restarted
> daemon-reload: yes 
> name: postgresql
>
> - name: create a new postgresql Database
>   postgresql_db:
> name: "{{ my_db_name }}"
> # become: true 
> # become_user: postgres
>
>
> - name: Create Postgress User 
>   postgresql_user:
> name: "{{ my_db_create_name }}"
> password: "{{ my_db_password }}"
> priv: "CONNECT/products:ALL"
> # become: true 
> # become_user: postgres
>  
>
> - name: Ensuring no other user have Database Access
>   postgresql_privs:
> db: "{{ my_db_create_name }}"
> role: PUBLIC
> type: database 
> priv: ALL
> state: absent  
> # become: true 
> # become_user: postgres
>
>
> Can anyone help me ?
>
>
>
>
>

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


[ansible-project] Postgresql (Peer Authentication Error) with Ansible 2.4

2018-04-15 Thread Bishwajit Samanta
Hi, i am having a problem in setting up postgresql through ansible.

Error::-
--


 Peer authentication failed for user "postgres". I checked google, i found 
people as saying i need to use become and become_user: postgress. But even 
after doing that i am getting, that those are not valid attribute .

My code is :: 
-

- name: Install Postgress 9.5 Version and its dependencies 
  apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600

  with_items:

- postgresql
- libpq-dev 
- python-psycopg2
- postgresql-client-common
- postgresql-contrib
 

- name: Make change in postgresql.conf file 
  template:
src: postgresql_conf.jinja2
dest: /etc/postgresql/9.5/main/postgresql.conf
mode: 0644
owner: postgres
group: postgres 


- name: Daemon-Reload for Postgress
  systemd:
state: restarted
daemon-reload: yes 
name: postgresql

- name: create a new postgresql Database
  postgresql_db:
name: "{{ my_db_name }}"
# become: true 
# become_user: postgres


- name: Create Postgress User 
  postgresql_user:
name: "{{ my_db_create_name }}"
password: "{{ my_db_password }}"
priv: "CONNECT/products:ALL"
# become: true 
# become_user: postgres
 

- name: Ensuring no other user have Database Access
  postgresql_privs:
db: "{{ my_db_create_name }}"
role: PUBLIC
type: database 
priv: ALL
state: absent  
# become: true 
# become_user: postgres


Can anyone help me ?




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


[ansible-project] Re: ansible with elastic search with Jinja2 Template

2018-04-13 Thread Bishwajit Samanta
Thanks Larry for such great help.. i hope this solves my problem. !! :) 

On Saturday, April 14, 2018 at 10:25:50 AM UTC+5:30, Larry Smith wrote:
>
> You can use:
> node.name: {{ansible_hostname}}
>
> Which will use the hostname defined on the remote host.
>
> Or you can use:
> node.name:{{inventory_hostname}}
>
> Which will use the inventory hostname defined in your Ansible inventory.
>
> For reference:
>
> https://github.com/mrlesmithjr/ansible-elasticsearch/blob/master/defaults/main.yml#L74
>
> Hope this helps.
>
> On Friday, April 13, 2018 at 1:56:57 PM UTC-4, Bishwajit Samanta wrote:
>>
>> Can anyone help me in my problem please ? 
>>
>>
>> On Friday, April 13, 2018 at 8:21:31 PM UTC+5:30, Bishwajit Samanta wrote:
>>>
>>>
>>>
>>> Hi, my question is :: 
>>> 
>>>
>>> My ansible script will be running for multiple systems. But in 
>>> elasticsearch.jinja2 how can i change the value of node.name for 
>>> different systems.
>>>
>>> Jinja 2 Code::-
>>> ---
>>>
>>> # -- Cluster 
>>> ---
>>> #
>>> # Use a descriptive name for your cluster:
>>> #
>>>  cluster.name: {{ my_defined_cluster_name }}
>>> #
>>> #  Node 
>>> 
>>> #
>>> # Use a descriptive name for the node:
>>> #
>>>  node.name: {{ my_defined_node_name }}
>>> #
>>> # Add custom attributes to the node:
>>> #
>>> # node.rack: r1
>>>
>>> If i am running this jinja2 file, across all the systems the value of 
>>> node.name will be same. But i dont want this, i want to put some other 
>>> values when it runs to other systems. 
>>>
>>> what modification i can do in Jinja2 file , can anyone help me ??
>>>
>>> My ansible playbook looks like this::
>>>
>>>
>>> ---
>>>
>>> ## Task Related to Configuration of Elastic Search :: 
>>>
>>> - name: Copy Configuration file for Elastic Search 
>>>   template:
>>> src: elasticsearch.jinja2
>>> dest: /etc/elasticsearch/elasticsearch.yml
>>> mode: 0750
>>> owner: root
>>> group: elasticsearch
>>>
>>>
>>>

-- 
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/f9ea6dd9-fe2a-4cb3-a6a0-c188bed218c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible with elastic search with Jinja2 Template

2018-04-13 Thread Bishwajit Samanta
Can anyone help me in my problem please ? 


On Friday, April 13, 2018 at 8:21:31 PM UTC+5:30, Bishwajit Samanta wrote:
>
>
>
> Hi, my question is :: 
> 
>
> My ansible script will be running for multiple systems. But in 
> elasticsearch.jinja2 how can i change the value of node.name for 
> different systems.
>
> Jinja 2 Code::-
> ---
>
> # -- Cluster 
> ---
> #
> # Use a descriptive name for your cluster:
> #
>  cluster.name: {{ my_defined_cluster_name }}
> #
> #  Node 
> 
> #
> # Use a descriptive name for the node:
> #
>  node.name: {{ my_defined_node_name }}
> #
> # Add custom attributes to the node:
> #
> # node.rack: r1
>
> If i am running this jinja2 file, across all the systems the value of 
> node.name will be same. But i dont want this, i want to put some other 
> values when it runs to other systems. 
>
> what modification i can do in Jinja2 file , can anyone help me ??
>
> My ansible playbook looks like this::
>
>
> ---
>
> ## Task Related to Configuration of Elastic Search :: 
>
> - name: Copy Configuration file for Elastic Search 
>   template:
> src: elasticsearch.jinja2
> dest: /etc/elasticsearch/elasticsearch.yml
> mode: 0750
> owner: root
> group: elasticsearch
>
>
>

-- 
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/cb729411-2196-4619-a9f6-e6301c8288b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-13 Thread Bishwajit Samanta
Ansible:: 2.4 is the version i am using.

On Friday, April 13, 2018 at 11:40:02 AM UTC+5:30, Biswadip Dutta wrote:
>
> Can you please let me know which Ansible version you are using and what 
> error you are getting?
>
> Regards,
> Biswadip Dutta
>
> On Thu, Apr 12, 2018 at 7:16 PM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> Thanks Karl, for your reply. Problem statement ::-
>>
>> My job is to find out the hostname which belongs to hostclass ess, which 
>> in this case the answer is host002.
>>
>> hostinfo:
>>   'host001':
>> ip: 192.168.43.10
>> hostclass: 'puppet'
>>   'host002':
>> ip: 192.168.43.11
>> hostclass: 'ess'
>>   'host003':
>> ip: 192.168.43.21
>> hostclass: 'mdb'
>>
>>
>> i got one solution from some friend in google ansible groups only, but i 
>> am unable to fit it my ansible playbook.
>>
>>
>> - debug:
>> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>> 'ess')|first|first }}"
>>
>>
>> The playbook i am writing, which is wrong but i am not able to figure out 
>> how to fit the code in my playbook. Can anyone help me in modifying the 
>> code of mine.
>>
>> ---
>>
>> - hosts: somehost
>>   gather_facts: no
>>   vars_files:
>> file: sometext.yaml
>> name: sometext
>>
>>   - debug:
>> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>> 'ess')|first|first }}
>>
>>
>> On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>>>
>>> Can I suggest that you describe what you want to achieve. That is, 
>>> describe the end result that you are seeking.
>>>
>>> That is more likely to get a useful response.
>>>
>>> Regards, K.
>>>
>>>
>>> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
>>> bishwajits...@gmail.com> wrote:
>>>
>>>> Any one can suggest any idea please..
>>>>
>>>> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta 
>>>> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I am a beginner in ansible. If anyone can help me in finding the 
>>>>> answer. It would be great. My problem was finding a phrase in ansible 
>>>>> which 
>>>>> one of the person have helped me. But unfortunately i am not able to fit 
>>>>> the piece of code in my playbook.
>>>>>
>>>>> hostinfo:
>>>>>   host001':
>>>>> ip: 192.168.43.10
>>>>> hostclass: 'puppet'
>>>>>   'host002':
>>>>> ip: 192.168.43.11
>>>>> hostclass: 'ess'
>>>>>   'host003':
>>>>> ip: 192.168.43.21
>>>>> hostclass: 'mdb'
>>>>>
>>>>> the code was::
>>>>>
>>>>> - debug: 
>>>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>>>> 'ess')|first|first }}"
>>>>>
>>>>> Now i am writing the code as given below. I know in this piece of code 
>>>>> i am making mistakes. But since i am a beginner i am not able to 
>>>>> understand 
>>>>> it. Can anyone help me?
>>>>>
>>>>> ---
>>>>> - hosts: test
>>>>>   gather_facts: no 
>>>>>
>>>>> - debug: 
>>>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>>>> 'ess')|first|first }}"
>>>>>
>>>>> -- 
>>>> 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/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

[ansible-project] ansible with elastic search with Jinja2 Template

2018-04-13 Thread Bishwajit Samanta


Hi, my question is :: 


My ansible script will be running for multiple systems. But in 
elasticsearch.jinja2 how can i change the value of node.name for different 
systems.

Jinja 2 Code::-
---

# -- Cluster 
---
#
# Use a descriptive name for your cluster:
#
 cluster.name: {{ my_defined_cluster_name }}
#
#  Node 

#
# Use a descriptive name for the node:
#
 node.name: {{ my_defined_node_name }}
#
# Add custom attributes to the node:
#
# node.rack: r1

If i am running this jinja2 file, across all the systems the value of 
node.name will be same. But i dont want this, i want to put some other 
values when it runs to other systems. 

what modification i can do in Jinja2 file , can anyone help me ??

My ansible playbook looks like this::


---

## Task Related to Configuration of Elastic Search :: 

- name: Copy Configuration file for Elastic Search 
  template:
src: elasticsearch.jinja2
dest: /etc/elasticsearch/elasticsearch.yml
mode: 0750
owner: root
group: elasticsearch


-- 
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/c2c74408-6c49-4e3f-bda7-350c65ecb6d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
Check whether these configurations are there in your host file..

ansible_user: admin
ansible_password: XXX
ansible_winrm_scheme: https
ansible_winrm_transport: credssp
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
validate_certs: false

On Thu 12 Apr, 2018, 17:33 Bishwajit Samanta, <
bishwajitsamanta1...@gmail.com> wrote:

> Share me your host file which you have configured in ansible, where you
> have decalared your connection type as winrm etc. May be i can look into it
> and help you.
>
> On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>>
>> Hi team,
>>
>>
>> I am trying to setup winrm connection to windows 12 but getting below
>> error:
>>
>> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were
>> rejected by the server Traceback (most recent call last): File
>> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py",
>> line 154, in _winrm_connect self.shell_id =
>> protocol.open_shell(codepage=65001) # UTF-8 File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
>> line 132, in open_shell res = self.send_message(xmltodict.unparse(req))
>> File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
>> line 207, in send_message return self.transport.send_message(message) File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py",
>> line 179, in send_message raise InvalidCredentialsError("the specified
>> credentials were rejected by the server") InvalidCredentialsError: the
>> specified credentials were rejected by the server fatal: [10.47.11.89]:
>> UNREACHABLE! => { "changed": false, "msg": "basic: the specified
>> credentials were rejected by the server", "unreachable": true } to retry,
>> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry
>>
>> The user that i am trying is added to administrator group as well still
>> the issue.
>> Can someone please suggest.
>>
>> Regards,
>> Ishita
>>
> --
> 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/6d37d54f-a341-40c3-941d-678cfe69b0a2%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6d37d54f-a341-40c3-941d-678cfe69b0a2%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAPkwwd2z2EVDosuBGowaMEFCEgMC3EnKv4MuCAC%2BKHXvbsszww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Bishwajit Samanta
Thanks Karl, for your reply. Problem statement ::-

My job is to find out the hostname which belongs to hostclass ess, which in 
this case the answer is host002.

hostinfo:
  'host001':
ip: 192.168.43.10
hostclass: 'puppet'
  'host002':
ip: 192.168.43.11
hostclass: 'ess'
  'host003':
ip: 192.168.43.21
hostclass: 'mdb'


i got one solution from some friend in google ansible groups only, but i am 
unable to fit it my ansible playbook.


- debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"


The playbook i am writing, which is wrong but i am not able to figure out 
how to fit the code in my playbook. Can anyone help me in modifying the 
code of mine.

---

- hosts: somehost
  gather_facts: no
  vars_files:
file: sometext.yaml
name: sometext

  - debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}


On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>
> Can I suggest that you describe what you want to achieve. That is, 
> describe the end result that you are seeking.
>
> That is more likely to get a useful response.
>
> Regards, K.
>
>
> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> Any one can suggest any idea please..
>>
>> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta 
>> wrote:
>>>
>>> Hi all,
>>>
>>> I am a beginner in ansible. If anyone can help me in finding the answer. 
>>> It would be great. My problem was finding a phrase in ansible which one of 
>>> the person have helped me. But unfortunately i am not able to fit the piece 
>>> of code in my playbook.
>>>
>>> hostinfo:
>>>   host001':
>>> ip: 192.168.43.10
>>> hostclass: 'puppet'
>>>   'host002':
>>> ip: 192.168.43.11
>>> hostclass: 'ess'
>>>   'host003':
>>> ip: 192.168.43.21
>>> hostclass: 'mdb'
>>>
>>> the code was::
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> Now i am writing the code as given below. I know in this piece of code i 
>>> am making mistakes. But since i am a beginner i am not able to understand 
>>> it. Can anyone help me?
>>>
>>> ---
>>> - hosts: test
>>>   gather_facts: no 
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> -- 
>> 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/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Karl Auer
>
> Email  : ka...@2pisoftware.com 
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>

-- 
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/bacee1a5-37a0-423a-9dcf-a8625c361493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
Share me your host file which you have configured in ansible, where you 
have decalared your connection type as winrm etc. May be i can look into it 
and help you.

On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>
> Hi team,
>
>
> I am trying to setup winrm connection to windows 12 but getting below 
> error:
>
> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were 
> rejected by the server Traceback (most recent call last): File 
> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
> line 154, in _winrm_connect self.shell_id = 
> protocol.open_shell(codepage=65001) # UTF-8 File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 132, in open_shell res = self.send_message(xmltodict.unparse(req)) 
> File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 207, in send_message return self.transport.send_message(message) File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py", 
> line 179, in send_message raise InvalidCredentialsError("the specified 
> credentials were rejected by the server") InvalidCredentialsError: the 
> specified credentials were rejected by the server fatal: [10.47.11.89]: 
> UNREACHABLE! => { "changed": false, "msg": "basic: the specified 
> credentials were rejected by the server", "unreachable": true } to retry, 
> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry 
>
> The user that i am trying is added to administrator group as well still 
> the issue.
> Can someone please suggest.
>
> Regards,
> Ishita
>

-- 
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/6d37d54f-a341-40c3-941d-678cfe69b0a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
i have configured once, this during the time i have change certain 
parameters in the host file, where i declared the connection type as winrm 
etc. If you can share your host file configuaration, may be i can look into 
it.

On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>
> Hi team,
>
>
> I am trying to setup winrm connection to windows 12 but getting below 
> error:
>
> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were 
> rejected by the server Traceback (most recent call last): File 
> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
> line 154, in _winrm_connect self.shell_id = 
> protocol.open_shell(codepage=65001) # UTF-8 File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 132, in open_shell res = self.send_message(xmltodict.unparse(req)) 
> File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 207, in send_message return self.transport.send_message(message) File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py", 
> line 179, in send_message raise InvalidCredentialsError("the specified 
> credentials were rejected by the server") InvalidCredentialsError: the 
> specified credentials were rejected by the server fatal: [10.47.11.89]: 
> UNREACHABLE! => { "changed": false, "msg": "basic: the specified 
> credentials were rejected by the server", "unreachable": true } to retry, 
> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry 
>
> The user that i am trying is added to administrator group as well still 
> the issue.
> Can someone please suggest.
>
> Regards,
> Ishita
>

-- 
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/d6a4b956-d507-4a24-9725-5d0a4491a269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Bishwajit Samanta
Any one can suggest any idea please..

On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta wrote:
>
> Hi all,
>
> I am a beginner in ansible. If anyone can help me in finding the answer. 
> It would be great. My problem was finding a phrase in ansible which one of 
> the person have helped me. But unfortunately i am not able to fit the piece 
> of code in my playbook.
>
> hostinfo:
>   host001':
> ip: 192.168.43.10
> hostclass: 'puppet'
>   'host002':
> ip: 192.168.43.11
> hostclass: 'ess'
>   'host003':
> ip: 192.168.43.21
> hostclass: 'mdb'
>
> the code was::
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
> Now i am writing the code as given below. I know in this piece of code i 
> am making mistakes. But since i am a beginner i am not able to understand 
> it. Can anyone help me?
>
> ---
> - hosts: test
>   gather_facts: no 
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
>

-- 
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/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: current run timestamp

2018-04-12 Thread Bishwajit Samanta
[defaults]
I used callback_whitelist = profile_tasks 

You can set it in ansible.cfg. 

That can solve your problem i guess.

On Wednesday, March 21, 2018 at 3:57:59 AM UTC+5:30, ordered...@gmail.com 
wrote:
>
> I want to set it up so there is a current ansible playbook run timestamp 
> set at the start of every playbook run so I can use this var in various 
> roles.
> The only way so far I have found is to set a pre_task with set fact in 
> every playbook.
> Does anyone have any suggestions or information on a current playbook run 
> start timestamp or a way to set this var so that I dont need to add the 
> set_fact to every playbook?
>

-- 
You 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/b5c39d27-71a8-4b86-acab-15349093372e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: List of running processes form multiple linux hosts using with_items

2018-04-12 Thread Bishwajit Samanta
I just changed the host as devops
---

- hosts: devops
  gather_facts: no
  tasks:
- name: Get the running process across the systems
  command: ps -ef
  register: output

- name: Getting some details of systems
  local_action: copy content={{ output }} dest=/opt/{{ 
inventory_hostname }}file

Output::-
-

[root@ansible-master opt]# ls
192.168.56.111file  192.168.56.116file 

You can try with this and see if your problem get resolved.

On Wednesday, April 11, 2018 at 1:42:45 PM UTC+5:30, smitconsu...@gmail.com 
wrote:
>
> Hi 
> I am trying to achieve all running processes on our linux machines via 
> ansible and get output in a file along with each host name and processes. I 
> have made below playbook but not getting to the point how to get list of 
> processes for each host one by one and store in a file. Can anyone please 
> help with the code how can I achieve this? I am using with_items with list 
> of hosts which is coming from inventory group hostlist. many thanks
>
> ---
> - hosts: all
>   gather_facts: false
>   tasks:
>
>   - name: Get Running Processes
> command: ps -ef
> delegate_to: "{{ item }}"
> run_once: false
> with_items:
>  - "{{ groups['hostlist'] }}"
> register: process_list
>
>

-- 
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/11e0d7f6-4c90-489b-9df0-d2dd9febdc36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] unable to fit the piece of code in ansible

2018-04-11 Thread Bishwajit Samanta
Hi all,

I am a beginner in ansible. If anyone can help me in finding the answer. It 
would be great. My problem was finding a phrase in ansible which one of the 
person have helped me. But unfortunately i am not able to fit the piece of 
code in my playbook.

hostinfo:
  host001':
ip: 192.168.43.10
hostclass: 'puppet'
  'host002':
ip: 192.168.43.11
hostclass: 'ess'
  'host003':
ip: 192.168.43.21
hostclass: 'mdb'

the code was::

- debug: 
  msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"

Now i am writing the code as given below. I know in this piece of code i am 
making mistakes. But since i am a beginner i am not able to understand it. 
Can anyone help me?

---
- hosts: test
  gather_facts: no 

- debug: 
  msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"

-- 
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/da7d078e-2f2f-4e2d-af26-3435a9a28116%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
Hi, thanks for sharing the docs link. In the meanwhile i am not able to go 
in the right direction of solving the problem. so far what i have done is ::

1. converted the text file to json through python.
2. write some ansible codes, which in return it is dumping the contents but 
i am not able to get the thing i want.



---

- hosts: devops
  gather_facts: no
  vars:
contents: "{{ lookup('file', '/root/ansible/sample_1.json') | from_json 
}}"

  tasks:

- debug:
  msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"

- debug:
   msg: "{{ contents }}"



Can you guide in my problem please.. 



On Wednesday, April 11, 2018 at 10:26:47 PM UTC+5:30, Matt Martz wrote:
>
> Templating in Ansible is handled by Jinja2.  You can find documentation on 
> Jinja2 at http://jinja.pocoo.org/docs/dev/templates/
>
> For the `first` filter specifically: 
> http://jinja.pocoo.org/docs/dev/templates/#first
>
> On Wed, Apr 11, 2018 at 11:47 AM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> @Matt Martz : I am sorry to ask silly questions, regarding ansible as by 
>> seeing the small piece of code, i can understand you must be an ansible 
>> expert. If possible you can help me in my problem explanation a bit. 
>>
>> And any such links for learning you want to refer, please refer me. As i 
>> googled selectattr but first|first parameter which you have passed i am not 
>> getting any good document. If you can help me in referring such, it would 
>> be of very nice help.
>>
>>
>>
>> On Wednesday, April 11, 2018 at 9:36:13 PM UTC+5:30, Bishwajit Samanta 
>> wrote:
>>>
>>> I am glad you replied so fast, but sorry to say i am not an ansible 
>>> expert . I am just a beginner . I just typed the code. Can you help me in 
>>> understanding  where i am not correct.
>>>
>>> ---
>>>
>>> - hosts: devops
>>>
>>>   tasks:
>>> - debug:
>>>msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> ~
>>> ~
>>>
>>>
>>>
>>>
>>> On Wednesday, April 11, 2018 at 8:54:15 PM UTC+5:30, Bishwajit Samanta 
>>> wrote:
>>>>
>>>> i am having a problem in finding solution. I have a piece of file which 
>>>> contains data in below format (json type with quotes)::-
>>>>
>>>> hostinfo:
>>>>   'host001':
>>>> ip: x.x.x.x
>>>> hostclass: 'puppet'
>>>>   'host002':
>>>> ip: y.y.y.y
>>>> hostclass: 'ess'
>>>>   'host003':
>>>> ip: z.z.z.z
>>>> hostclass: 'mdb'
>>>>
>>>> Now my task is to find out the hostname of the system belong to 
>>>> hostclass 'ess' , which in this case the answer in host002. I have to 
>>>> write 
>>>> an ansible script to find out the result. Can anyone help me in finding 
>>>> out, or any idea to approach for the problem.
>>>>
>>>> Issue Type:: Finding a phrase through ansible
>>>> Ansible Version:: Ansible 2.4.0
>>>> Component Name:: It looks similar to json type file.
>>>>
>>>>
>>>>
>>>> -- 
>> 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/e685426e-a978-4ae9-be43-6ed342d3225a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/e685426e-a978-4ae9-be43-6ed342d3225a%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

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


[ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
@Matt Martz : I am sorry to ask silly questions, regarding ansible as by 
seeing the small piece of code, i can understand you must be an ansible 
expert. If possible you can help me in my problem explanation a bit. 

And any such links for learning you want to refer, please refer me. As i 
googled selectattr but first|first parameter which you have passed i am not 
getting any good document. If you can help me in referring such, it would 
be of very nice help.


On Wednesday, April 11, 2018 at 9:36:13 PM UTC+5:30, Bishwajit Samanta 
wrote:
>
> I am glad you replied so fast, but sorry to say i am not an ansible expert 
> . I am just a beginner . I just typed the code. Can you help me in 
> understanding  where i am not correct.
>
> ---
>
> - hosts: devops
>
>   tasks:
> - debug:
>msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
> ~
> ~
>
>
>
>
> On Wednesday, April 11, 2018 at 8:54:15 PM UTC+5:30, Bishwajit Samanta 
> wrote:
>>
>> i am having a problem in finding solution. I have a piece of file which 
>> contains data in below format (json type with quotes)::-
>>
>> hostinfo:
>>   'host001':
>> ip: x.x.x.x
>> hostclass: 'puppet'
>>   'host002':
>> ip: y.y.y.y
>> hostclass: 'ess'
>>   'host003':
>> ip: z.z.z.z
>> hostclass: 'mdb'
>>
>> Now my task is to find out the hostname of the system belong to hostclass 
>> 'ess' , which in this case the answer in host002. I have to write an 
>> ansible script to find out the result. Can anyone help me in finding out, 
>> or any idea to approach for the problem.
>>
>> Issue Type:: Finding a phrase through ansible
>> Ansible Version:: Ansible 2.4.0
>> Component Name:: It looks similar to json type file.
>>
>>
>>
>>

-- 
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/e685426e-a978-4ae9-be43-6ed342d3225a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
I am glad you replied so fast, but sorry to say i am not an ansible expert 
. I am just a beginner . I just typed the code. Can you help me in 
understanding  where i am not correct.

---

- hosts: devops

  tasks:
- debug:
   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"

~
~




On Wednesday, April 11, 2018 at 8:54:15 PM UTC+5:30, Bishwajit Samanta 
wrote:
>
> i am having a problem in finding solution. I have a piece of file which 
> contains data in below format (json type with quotes)::-
>
> hostinfo:
>   'host001':
> ip: x.x.x.x
> hostclass: 'puppet'
>   'host002':
> ip: y.y.y.y
> hostclass: 'ess'
>   'host003':
> ip: z.z.z.z
> hostclass: 'mdb'
>
> Now my task is to find out the hostname of the system belong to hostclass 
> 'ess' , which in this case the answer in host002. I have to write an 
> ansible script to find out the result. Can anyone help me in finding out, 
> or any idea to approach for the problem.
>
> Issue Type:: Finding a phrase through ansible
> Ansible Version:: Ansible 2.4.0
> Component Name:: It looks similar to json type file.
>
>
>
>

-- 
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/b649014c-236d-43ab-993b-3ec643fa8cda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta


i am having a problem in finding solution. I have a piece of file which 
contains data in below format (json type with quotes)::-

hostinfo:
  'host001':
ip: x.x.x.x
hostclass: 'puppet'
  'host002':
ip: y.y.y.y
hostclass: 'ess'
  'host003':
ip: z.z.z.z
hostclass: 'mdb'

Now my task is to find out the hostname of the system belong to hostclass 
'ess' , which in this case the answer in host002. I have to write an 
ansible script to find out the result. Can anyone help me in finding out, 
or any idea to approach for the problem.

Issue Type:: Finding a phrase through ansible
Ansible Version:: Ansible 2.4.0
Component Name:: It looks similar to json type file.



-- 
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/f0e5742d-cdcd-473d-854d-decff5b2b283%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.