Re: [ansible-project] User issue while pinging the hosts

2020-07-07 Thread Dick Visser
Read these docs and make sure you understand them:

https://docs.ansible.com/ansible/latest/user_guide/connection_details.html

https://docs.ansible.com/ansible/latest/user_guide/become.html



On Wed, 8 Jul 2020 at 05:49, Mahesh N  wrote:

> Facing the below error while logging as my user (mahesh) and performing
> the actions on service user (service).
>
> ERROR:
> fatal: [10.0.0.1]: UNREACHABLE! => {"changed": false, "msg":
> "Authentication failure.", "unreachable": true}
>
> Tried:
> - name: deploy elasticsearch
>   hosts: all
>   remote_user: mahesh
>   become: yes
>   become_user: service
>
> --
> 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/f7490938-4830-453a-b6be-b4b4e93b0ec0o%40googlegroups.com
> 
> .
>
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOSJEt%2BgZJ0ocHw86T9FWRkDNE9SODJ0oEQBnYAN-%2BwuQ%40mail.gmail.com.


[ansible-project] User issue while pinging the hosts

2020-07-07 Thread Mahesh N
Facing the below error while logging as my user (mahesh) and performing the 
actions on service user (service).

ERROR:
fatal: [10.0.0.1]: UNREACHABLE! => {"changed": false, "msg": 
"Authentication failure.", "unreachable": true}

Tried:
- name: deploy elasticsearch
  hosts: all
  remote_user: mahesh
  become: yes
  become_user: service

-- 
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/f7490938-4830-453a-b6be-b4b4e93b0ec0o%40googlegroups.com.


Re: [ansible-project] Newbie question: Using ansible for runbook automation type of tasks

2020-07-07 Thread Mike Eggleston
Yes, Ansible can do that. 

Mike

> On Jul 7, 2020, at 19:36, Ravi Malghan  wrote:
> 
> 
> I am looking for an application that can be used as a runbook automation tool 
> from a monitoring platform (nagios). From nagios I have the ability to run 
> scripts from the Nagios server. I need to build a simple script that ssh to a 
> remote server, look for some log files, delete them if it exists, restart a 
> process and bring back the results of the commands into a file on the Nagios 
> server. I know I can implement this using Run book Automation tools like Blue 
> Prism. I am very new to Ansible. Can Ansible be used to build something like 
> this and called from another application? Before I spend too much time into 
> learning Ansible, wanted to check if I should consider Ansible for this.
> 
> Thanks
> Ravi
> -- 
> 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/60b1f263-e0c4-4e0d-8ecb-633329611d19o%40googlegroups.com.

-- 
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/8725048C-14D5-4783-9B9F-E75D1C30AC3C%40gmail.com.


[ansible-project] Newbie question: Using ansible for runbook automation type of tasks

2020-07-07 Thread Ravi Malghan
I am looking for an application that can be used as a runbook automation 
tool from a monitoring platform (nagios). From nagios I have the ability to 
run scripts from the Nagios server. I need to build a simple script that 
ssh to a remote server, look for some log files, delete them if it exists, 
restart a process and bring back the results of the commands into a file on 
the Nagios server. I know I can implement this using Run book Automation 
tools like Blue Prism. I am very new to Ansible. Can Ansible be used to 
build something like this and called from another application? Before I 
spend too much time into learning Ansible, wanted to check if I should 
consider Ansible for this.

Thanks
Ravi

-- 
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/60b1f263-e0c4-4e0d-8ecb-633329611d19o%40googlegroups.com.


Re: [ansible-project] Conditional wild card usage

2020-07-07 Thread Vladimir Botka
On Tue, 7 Jul 2020 12:46:07 -0700 (PDT)
sandeep athoti  wrote:

> when: ansible_distribution_major_version|int == 6 or ansible_fqdn == 
> "test[0-1][0-9].example.com"

See "Testing strings"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-strings

For example

  - hosts: localhost
vars:
  hostnames:
- test56.example.com
- testXY.example.com
  my_regex: '^test(\d\d)\.example\.com'
tasks:
  - debug:
  msg: OK
loop: "{{ hostnames }}"
when:
  item is match(my_regex)

gives

  ok: [localhost] => (item=test56.example.com) => 
msg: OK
  skipping: [localhost] => (item=testXY.example.com)


-- 
Vladimir Botka

-- 
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/20200707233537.44ad24f1%40gmail.com.


pgp3O2xDepjUI.pgp
Description: OpenPGP digital signature


[ansible-project] Conditional wild card usage

2020-07-07 Thread sandeep athoti


Is there any way I can use the wild cards or regex in when statements,


when: ansible_distribution_major_version|int == 6 or ansible_fqdn == 
"test[0-1][0-9].example.com"


I actually do not want to pass hostname of my server in vars section. Will 
this regex work with in conjunction with Ansible facts ? 


During my playbook execution time, it need to interpret my hostname of the 
server from fact ansible_fqdn.


Samole playbook,


hosts: localhost
tasks:
name: debug
debug:
msg: "passed"
when: "ansible_distribution_major_version|int == 6 or ansible_fqdn | 
regex_search('test[0-9][0-1]-[0-9][0-9].example.com')"

-- 
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/5e822c65-ca1c-40d1-a7cb-85aa120ff77bo%40googlegroups.com.


[ansible-project] Re: Trying to install Feature update to Windows 10, version 1909 with Ansible

2020-07-07 Thread Alan Woods
Sorry here is the rest of the output from the play with -vvv it got cut off 
for some reason:

TASK [Upgrade Windows 10] 

task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:8
win_updates: running win_updates module
Using module file /usr/lib/python3.6/site-packages/ansible/modules/windows/
win_updates.ps1
Pipelining is enabled.
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
EXEC (via pipeline wrapper)
ok: [win10-pro-1] => {
"changed": false,
"failed_update_count": 0,
"filtered_updates": {},
"found_update_count": 1,
"installed_update_count": 1,
"reboot_required": true,
"updates": {
"ac2b20ab-6186-4267-8d55-4b3ca35197d1": {
"categories": [
"Upgrades"
],
"id": "ac2b20ab-6186-4267-8d55-4b3ca35197d1",
"installed": true,
"kb": [
"4560960"
],
"title": "Feature update to Windows 10, version 1909"
}
}
}

TASK [reboot host if required] 
***
task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:15
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: rebooting server...
EXEC (via pipeline wrapper)
win_reboot: validating reboot
win_reboot: attempting to get system boot time
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
win_reboot: attempting to get system boot time
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
EXEC (via pipeline wrapper)
 ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 
win10-pro-1
win_reboot: attempting post-reboot test command
EXEC (via pipeline wrapper)
win_reboot: system successfully rebooted
changed: [win10-pro-1] => {
"changed": true,
"elapsed": 25,
"rebooted": true
}
META: ran handlers
META: ran handlers

PLAY RECAP 
***
win10-pro-1: ok=4changed=2unreachable=0failed=0 
   skipped=0rescued=0ignored=0   



On Tuesday, July 7, 2020 at 10:53:42 AM UTC-7, Alan Woods wrote:
>
> I have ran this playbook again with the -vvv this was the out put:
>
> [vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml 
> -vvv
> ansible-playbook 2.9.10
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [
> '/home/vagrant/.ansible/plugins/modules', 
> '/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python3.6/site-packages/
> ansible
>   executable location = /usr/bin/ansible-playbook
>   python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 
> 20191121 (Red Hat 8.3.1-5)]
> Using /etc/ansible/ansible.cfg as config file
> host_list declined parsing /etc/ansible/hosts as it did not pass its 
> verify_file() method
> script declined parsing /etc/ansible/hosts as it did not pass its 
> verify_file() method
> auto declined parsing /etc/ansible/hosts as it did not pass its 
> verify_file() method
> Parsed /etc/ansible/hosts inventory source with ini plugin
>
> PLAYBOOK: testFeatureUPdate.yml 
> **
> 1 plays in testFeatureUPdate.yml
>
> PLAY [win10-pro-1] 
> ***
>
> TASK [Gathering Facts] 
> ***
> task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:2
> Using module file /usr/lib/python3.6/site-packages/ansible/modules/windows
> /setup.ps1
> Pipelining is enabled.
>  ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 
> TO win10-pro-1
> EXEC (via pipeline wrapper)
> ok: [win10-pro-1]
> META: ran handlers
>
> TASK [Re-Boot PC before upgrade] 
> *
> task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:5
>  ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 
> TO win10-pro-1
> EXEC (via pipeline wrapper)
> win_reboot: rebooting server...
> EXEC (via pipeline wrapper)
> win_reboot: validating reboot
> win_reboot: attempting to get system 

[ansible-project] Re: Trying to install Feature update to Windows 10, version 1909 with Ansible

2020-07-07 Thread Alan Woods
I have also tired these:

---
- hosts: win10-pro-1
  gather_facts: yes
  tasks:
- name: Re-Boot PC before upgrade
  win_reboot:

- name: Upgrade Windows 10
  win_updates:
category_names:
  - Upgrades
state: installed
reboot: yes

and

---
- hosts: win10-pro-1
  gather_facts: yes
  tasks:
- name: Upgrade Windows 10
  win_updates:
category_names:
  - Upgrades
reboot: yes

On Tuesday, July 7, 2020 at 8:27:09 AM UTC-7, Alan Woods wrote:
>
> Can anyone help with this?
>
> On Monday, July 6, 2020 at 10:59:39 AM UTC-7, Alan Woods wrote:
>>
>> Hello I am trying to install windows 10 feature updates or upgrades. The 
>> playbook I am using seems to download it but it will not install it. I 
>> still need to go into windows updates and hit retry then it installs.  This 
>> is the playbook I am currently using:
>>
>>
>> ---
>> - hosts: win10-pro-1
>>  gather_facts: yes
>>  tasks:
>>- name: Re-Boot PC before upgrade
>>  win_reboot:
>>
>> - name: Upgrade Windows 10
>>  win_updates:
>>category_names:
>>  - Upgrades
>>state: installed
>>  register: update_result
>>
>> - name: reboot host if required
>>  win_reboot:
>>  when: update_result.reboot_required
>>
>> I just added the first task to re-boot the PC first because I get errors 
>> sometimes that the PC needs to be re-booted first. The playbook runs with 
>> no errors and this is the what I get when running it.
>>
>> [vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml 
>>
>>
>> PLAY [win10-pro-1] 
>> ***
>>
>> TASK [Gathering Facts] 
>> ***
>> ok: [win10-pro-1]
>>
>> TASK [Re-Boot PC before upgrade] 
>> *
>> changed: [win10-pro-1]
>>
>> TASK [Upgrade Windows 10] 
>> 
>> changed: [win10-pro-1]
>>
>> TASK [reboot host if required] 
>> ***
>> changed: [win10-pro-1]
>>
>> PLAY RECAP 
>> ***
>> win10-pro-1: ok=4changed=3unreachable=0failed
>> =0skipped=0rescued=0ignored=0   
>>
>> [vagrant@controller win_10_Updates]$ 
>>
>>
>>
>> I am trying to get Ansible to install the upgrade and re-boot the PC if 
>> it needs to be without having to touch the windows 10 PC at all. Does 
>> anyone know if this is achievable? 
>>
>

-- 
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/75d03749-a31a-45a9-9ca8-a82e8f65d5fdo%40googlegroups.com.


[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-07-07 Thread Alan Woods
Hello I am wandering if this ever got resolved. I am also running a play 
book to upgrade a windows 10 box to 1909. The play book seems to run fine 
it says there were changes the windows 10 box re-boots several times but at 
the end it is not upgraded. I tried the play from this post which was:

- name: ensure Windows 10 has 1909 feature upgrade installed
  win_updates:
category_names:
- Upgrades
whitelist:
reboot: yes

with out the KB and it ran for hours but the windows 10 box was never 
updated. I also run a playbook to find what updates are needed and it keeps 
finding these:
{
"updates":  {
"ac2b20ab-6186-4267-8d55-4b3ca35197d1":  {
 
"categories":  [

"Upgrades"

],
 "title":  
"Feature 
update to Windows 10, version 1909",
 "id":  
"ac2b20ab-6186-4267-8d55-4b3ca35197d1",
 "installed"
:  false,
 "kb":  [

"4560960"
]
 }
},
"found_update_count":  1,
"changed":  false,
"reboot_required":  false,
"installed_update_count":  0,
"filtered_updates":  {
 "f9d81e60-32f2-41f3-b553-2261ff953ee8":  {
  
"id":  "f9d81e60-32f2-41f3-b553-2261ff953ee8",
  
"filtered_reason":  "category_names",
  
"title":  "Security Intelligence Update for Microsoft Defender Antivirus - 
KB2267602 (Version 1.319.975.0)",
  
"categories":  [

 "Definition Updates",

 "Microsoft Defender Antivirus"

 ],
  
"kb":  [

 "2267602"

 ],
  
"installed":  false
  }

if you were able to resolve this and get the system upgraded to 1909 I 
would love to know how. I also started a topic on this here that shows teh 
playbook I was using I have changed it several times to see if I can get it 
working to no avail- 
https://groups.google.com/forum/#!searchin/ansible-project/windows$2010$20upgrades|sort:date/ansible-project/GhF7VndaQWU/_F9eVDaIBQAJ

On Wednesday, January 22, 2020 at 11:39:36 AM UTC-8, Jimmy wrote:
>
> Nothing changed on the target host, not even rebooted but able to ping and 
> can do a handshake
> Playbook -
>
> PLAY [windows] 
> *
>
> TASK [Gathering Facts] 
> *
> ok: [MQN-CKMH5E31UM7.corp.medqia.com]
>
> TASK [Install all security, critical, and rollup updates without a 
> scheduled task] 
> *
> ok: [MQN-CKMH5E31UM7.corp.medqia.com]
>
> TASK [Install only security updates as a scheduled task for window 
> machines] 
> ***
> ok: [MQN-CKMH5E31UM7.corp.medqia.com]
>
> TASK [Install only particular updates based on the KB numbers] 
> *
> ok: [MQN-CKMH5E31UM7.corp.medqia.com]
>
> TASK [Install all security updates with automatic reboots] 
> *
> ok: [MQN-CKMH5E31UM7.corp.medqia.com]
>
> TASK [Ensure WinRM starts when the system has settled and is 

[ansible-project] Re: vmware tools update.completed but shows failed status

2020-07-07 Thread tdub...@gmail.com
any idea ?

On Monday, July 6, 2020 at 8:21:15 AM UTC-7 tdub...@gmail.com wrote:

> I got following to update vmware tools on windows vm
>
> ---
> - name: testing win_get_url
>   hosts: all
>   tasks:
> - name: Create Directory if not exist
>   win_file:
> path: C:\temp
> state: directory
>
> - name: Download exe to winbox
>   win_get_url:
> url: 
> https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.1.0-16036546-x86_64.exe
> dest: C:\temp\VMware-tools-11.1.0-16036546-x86_64.exe
>
> - name: Install Vmware tools Silent
>   win_command: C:\temp\VMware-tools-11.1.0-16036546-x86_64.exe /S /v 
> "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"
>
>
> it updates the tools successfully but not sure why its giving a failed 
> status error
>
> TASK [Install Vmware tools Silent] 
> ***
> task path: /home/tony/windows/download2.yml:15
> Using module file 
> /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_command.ps1
> Pipelining is enabled.
>  ESTABLISH WINRM CONNECTION FOR USER: adm...@xxx.xxx 
> on PORT 5986 TO rw-ctxapp-02.xxx.xxx
> EXEC (via pipeline wrapper)
> fatal: [rw-ctxapp-02.xxx.xxx]: FAILED! => {
> "changed": true,
> "cmd": "C:\\temp\\VMware-tools-11.1.0-16036546-x86_64.exe /S /v \"/qn 
> REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs\"",
> "delta": "0:02:31.265796",
> "end": "2020-07-06 03:17:27.895492",
> "msg": "non-zero return code",
> "rc": 3010,
> "start": "2020-07-06 03:14:56.629695",
> "stderr": "",
> "stderr_lines": [],
> "stdout": "",
> "stdout_lines": []
> }
>
> PLAY RECAP 
> ***
> rw-ctxapp-02.xxx.xxx : ok=3changed=1unreachable=0failed=1 
>skipped=0rescued=0ignored=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5696856d-8dfd-47e7-9416-ce62604a5d58n%40googlegroups.com.


[ansible-project] Re: win_update to upgrade windows 10 version

2020-07-07 Thread Alan Woods
Hello. I am trying to upgrade some of my windows 10 boxes with ansible and 
it never seems to work. The play book runs for awhile then it is done but 
with no errors but does not actually upgrade the system. Could you share 
you working playbook to see what I am missing?

I also have my play book posted here - 
https://groups.google.com/forum/#!searchin/ansible-project/windows$20upgrades%7Csort:date/ansible-project/GhF7VndaQWU/_F9eVDaIBQAJ

my version of ANsible is ansible 2.9.10

On Sunday, February 16, 2020 at 3:12:16 PM UTC-8, Ben Lagunilla wrote:
>
> Hi,
>
> I am using win_update to install updates using local WSUS server. However, 
> I can't seem to use win_update to upgrade windows 10 versions. 'Upgrades' 
> category is unknown.
>
> Appreciate any help on this. Thanks.
>
> -- ben
>

-- 
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/9ad34b29-46cf-4b4e-90be-7162c05ada3co%40googlegroups.com.


[ansible-project] Re: Trying to install Feature update to Windows 10, version 1909 with Ansible

2020-07-07 Thread Alan Woods
Can anyone help with this?

On Monday, July 6, 2020 at 10:59:39 AM UTC-7, Alan Woods wrote:
>
> Hello I am trying to install windows 10 feature updates or upgrades. The 
> playbook I am using seems to download it but it will not install it. I 
> still need to go into windows updates and hit retry then it installs.  This 
> is the playbook I am currently using:
>
>
> ---
> - hosts: win10-pro-1
>  gather_facts: yes
>  tasks:
>- name: Re-Boot PC before upgrade
>  win_reboot:
>
> - name: Upgrade Windows 10
>  win_updates:
>category_names:
>  - Upgrades
>state: installed
>  register: update_result
>
> - name: reboot host if required
>  win_reboot:
>  when: update_result.reboot_required
>
> I just added the first task to re-boot the PC first because I get errors 
> sometimes that the PC needs to be re-booted first. The playbook runs with 
> no errors and this is the what I get when running it.
>
> [vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml 
>
>
> PLAY [win10-pro-1] 
> ***
>
> TASK [Gathering Facts] 
> ***
> ok: [win10-pro-1]
>
> TASK [Re-Boot PC before upgrade] 
> *
> changed: [win10-pro-1]
>
> TASK [Upgrade Windows 10] 
> 
> changed: [win10-pro-1]
>
> TASK [reboot host if required] 
> ***
> changed: [win10-pro-1]
>
> PLAY RECAP 
> ***
> win10-pro-1: ok=4changed=3unreachable=0failed=
> 0skipped=0rescued=0ignored=0   
>
> [vagrant@controller win_10_Updates]$ 
>
>
>
> I am trying to get Ansible to install the upgrade and re-boot the PC if it 
> needs to be without having to touch the windows 10 PC at all. Does anyone 
> know if this is achievable? 
>

-- 
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/b64936a8-6ab0-422b-a4b7-b584c38a096co%40googlegroups.com.


Re: [ansible-project] Looping CF Templates with items loops and its reporting an error

2020-07-07 Thread Stefan Hornburg (Racke)
On 7/7/20 4:28 PM, ameya agashe wrote:
> Thanks, Dick, I did try and it is moving forward. But I think still something 
> is fundamentally rooted.
> 
> My main.yml looks like below

with_file puts the *contents* of each file into {{ item }}

So try with_items instead :-)

Regards
   Racke

> 
> ```
> cat main.yml
> ---
> # tasks file for patching-cf-ssm
> - name: create a cloudformation stack
>   cloudformation:
>   #aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
>   #aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
>   #security_token: "{{ assumed_role.sts_creds.session_token }}"
>     stack_name: "ansible-cloudformation"
>     state: "present"
>     disable_rollback: true
>     template: "roles/patching-cf-ssm/files/{{ item }}"
>   with_file:
>     - PatchBaseline.yml
>     - MaintenanceWindow.yml
>   #environment:
>     #AWS_ACCESS_KEY_ID: "{{ assumed_role.sts_creds.access_key }}"
>     #AWS_SECRET_ACCESS_KEY: "{{ assumed_role.sts_creds.secret_key }}"
>     #AWS_SECURITY_TOKEN: "{{ assumed_role.sts_creds.session_token }}"
> ...
> ```
> And, I'm getting long error message as like below:
> 
> ```
> IOError: [Errno 36] File name too long: 
> 'roles/patching-cf-ssm/files/AWSTemplateFormatVersion: 
> 2010-09-09\nDescription:
>>-\n  Creating Maintenance Window for Non-Production Windows Server 
>>Patching.\nResources:\n  MaintenanceWindow:\n   
> Type: AWS::SSM::MaintenanceWindow\n    Properties:\n      
> AllowUnassociatedTargets: false\n      Cutoff: 1\n     
> Description: Maintenance Window to update SSM Agent\n      Duration: 6\n      
> Name: MaintenanceWindowCFN\n     
> Schedule: "cron(0 45 09 ? * TUE *)"\n      ScheduleTimezone: 
> "Australia/Melbourne"\n  MaintenanceWindowTarget:\n   
> Type: AWS::SSM::MaintenanceWindowTarget\n    Properties:\n      WindowId: 
> !Ref MaintenanceWindow\n      ResourceType:
> INSTANCE\n      Targets:\n      - Key: tag:Patch Group\n        Values:\n     
>    - Group A\n      OwnerInformation: SSM
> Target\n      Name: SSMMaintenanceWindow\n      Description: A target for 
> demonstrating maintenance windows \n   
> DependsOn: MaintenanceWindow\n  MaintenanceWindowTask:\n    Type: 
> AWS::SSM::MaintenanceWindowTask\n    Properties:\n   
>   WindowId: !Ref MaintenanceWindow\n      Targets: \n        - Key: 
> WindowTargetIds\n          Values:\n          - !Ref
> MaintenanceWindowTarget\n      TaskArn: AWS-RunPatchBaseline\n      TaskType: 
> RUN_COMMAND\n     
> TaskInvocationParameters:\n          MaintenanceWindowRunCommandParameters:\n 
>            Parameters:\n           
>  Operation:\n              - Install\n      Priority: 1\n      
> MaxConcurrency: 2\n      MaxErrors: 1\n      Name:
> RegistrationTaskwithTargets\n    DependsOn: MaintenanceWindowTarget'
> failed: [localhost] (item=AWSTemplateFormatVersion: 2010-09-09
> Description: >-
>   Creating Maintenance Window for Non-Production Windows Server Patching.
> Resources:
>   MaintenanceWindow:
>     Type: AWS::SSM::MaintenanceWindow
>     Properties:
>       AllowUnassociatedTargets: false
>       Cutoff: 1
>       Description: Maintenance Window to update SSM Agent
>       Duration: 6
>       Name: MaintenanceWindowCFN
>       Schedule: "cron(0 45 09 ? * TUE *)"
>       ScheduleTimezone: "Australia/Melbourne"
>   MaintenanceWindowTarget:
>     Type: AWS::SSM::MaintenanceWindowTarget
>     Properties:
>       WindowId: !Ref MaintenanceWindow
>       ResourceType: INSTANCE
>       Targets:
>       - Key: tag:Patch Group
>         Values:
>         - Group A
>       OwnerInformation: SSM Target
>       Name: SSMMaintenanceWindow
>       Description: A target for demonstrating maintenance windows
>     DependsOn: MaintenanceWindow
>   MaintenanceWindowTask:
>     Type: AWS::SSM::MaintenanceWindowTask
>     Properties:
>       WindowId: !Ref MaintenanceWindow
>       Targets:
>         - Key: WindowTargetIds
>           Values:
>           - !Ref MaintenanceWindowTarget
>       TaskArn: AWS-RunPatchBaseline
>       TaskType: RUN_COMMAND
>       TaskInvocationParameters:
>           MaintenanceWindowRunCommandParameters:
>             Parameters:
>              Operation:
>               - Install
>       Priority: 1
>       MaxConcurrency: 2
>       MaxErrors: 1
>       Name: RegistrationTaskwithTargets
>     DependsOn: MaintenanceWindowTarget) => {
>     "ansible_loop_var": "item",
>     "changed": false,
>     "item": "AWSTemplateFormatVersion: 2010-09-09\nDescription: >-\n  
> Creating Maintenance Window for Non-Production
> Windows Server Patching.\nResources:\n  MaintenanceWindow:\n    Type: 
> AWS::SSM::MaintenanceWindow\n    Properties:\n   
>   AllowUnassociatedTargets: false\n      Cutoff: 1\n      Description: 
> Maintenance Window to update SSM Agent\n     
> Duration: 6\n      Name: MaintenanceWindowCFN\n      Schedule: \"cron(0 45 09 
> ? * TUE *)\"\n      ScheduleTimezone:
> \"Australia/Melbourne\"\n  MaintenanceWindowTarget:\n    Type: 
> 

Re: [ansible-project] Subclassing ansible.utils.display.Display in custom callback plugin

2020-07-07 Thread Nagesh sheregar
Hi Pieter,

sorry for the confus,

i would like to see output like below:

*Socket Locator* *Status* *Size* *Max Supported Frequency* *Technology*
PROC 1 DIMM 3  Good, In Use 32.00 GB 2666 MHz RDIMM

now i am getting below output and it's hard to read so do you have any
example plugin which can show like above

socket 9:
frequency: 1600 MHz
hp_smart_memory: 'Yes'
minimum_voltage: 1.50 v
part:
  number: 647651-081
ranks: 1
size: 8192 MB
socket: 9
status: Good, In Use
technology: RDIMM
type: DIMM DDR3


On Tue, Jul 7, 2020 at 9:31 AM piete...@gmail.com 
wrote:

> Hi ,
>
> excuse me, but I don't get the question here...  How can I help you ?
>
> Op dinsdag 7 juli 2020 om 16:04:32 UTC+2 schreef nage...@gmail.com:
>
>> Hi peter,
>>
>> if you don't mind please send me output, i would like to get something
>> like below
>>
>> *Socket Locator* *Status* *Size* *Max Supported Frequency* *Technology*
>> PROC 1 DIMM 3  Good, In Use 32.00 GB 2666 MHz RDIMM
>>
>> On Tue, Jul 7, 2020 at 5:19 AM piete...@gmail.com 
>> wrote:
>>
>>> Hi all,
>>>
>>> please allow me to ask for any help here...
>>> I once wrote a custom callback plugin, where I
>>> subclassed ansible.utils.display.Display so I could overrule it's display()
>>> method to manipulate the message to be printed, and then call
>>> super(Display, self).display(.
>>> Since Ansible 2.8 the Display object is now a singleton, instantiated
>>> right at 'ansible-playbook'. This means a cannot modify the
>>> Display.display() anymore  right ?
>>>
>>> Any ideas on how to call a customized display() method ?
>>>
>>> Thanks in advance for any help.
>>>
>>> Pieter.
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/bb33b941-7efb-4ec8-83ce-82e2dfb8db92n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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/a106eb27-1960-4b21-8ee1-6b1dedbb9ca2n%40googlegroups.com
> 
> .
>

-- 
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/CAFu5ZNwjWvU3wqxtFjoLXcdB-0QdVfG4UVL5iS0%2BzKWEZrferg%40mail.gmail.com.


Re: [ansible-project] Subclassing ansible.utils.display.Display in custom callback plugin

2020-07-07 Thread piete...@gmail.com
Hi ,

excuse me, but I don't get the question here...  How can I help you ?

Op dinsdag 7 juli 2020 om 16:04:32 UTC+2 schreef nage...@gmail.com:

> Hi peter,
>
> if you don't mind please send me output, i would like to get something 
> like below 
>
> *Socket Locator* *Status* *Size* *Max Supported Frequency* *Technology* 
> PROC 1 DIMM 3  Good, In Use 32.00 GB 2666 MHz RDIMM
>
> On Tue, Jul 7, 2020 at 5:19 AM piete...@gmail.com  
> wrote:
>
>> Hi all,
>>
>> please allow me to ask for any help here...
>> I once wrote a custom callback plugin, where I 
>> subclassed ansible.utils.display.Display so I could overrule it's display() 
>> method to manipulate the message to be printed, and then call 
>> super(Display, self).display(.
>> Since Ansible 2.8 the Display object is now a singleton, instantiated 
>> right at 'ansible-playbook'. This means a cannot modify the 
>> Display.display() anymore  right ?
>>
>> Any ideas on how to call a customized display() method ?
>>
>> Thanks in advance for any help.
>>
>> Pieter.
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/bb33b941-7efb-4ec8-83ce-82e2dfb8db92n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/a106eb27-1960-4b21-8ee1-6b1dedbb9ca2n%40googlegroups.com.


Re: [ansible-project] Looping CF Templates with items loops and its reporting an error

2020-07-07 Thread ameya agashe
Thanks, Dick, I did try and it is moving forward. But I think still 
something is fundamentally rooted.

My main.yml looks like below

```
cat main.yml
---
# tasks file for patching-cf-ssm
- name: create a cloudformation stack
  cloudformation:
  #aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
  #aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
  #security_token: "{{ assumed_role.sts_creds.session_token }}"
stack_name: "ansible-cloudformation"
state: "present"
disable_rollback: true
template: "roles/patching-cf-ssm/files/{{ item }}"
  with_file:
- PatchBaseline.yml
- MaintenanceWindow.yml
  #environment:
#AWS_ACCESS_KEY_ID: "{{ assumed_role.sts_creds.access_key }}"
#AWS_SECRET_ACCESS_KEY: "{{ assumed_role.sts_creds.secret_key }}"
#AWS_SECURITY_TOKEN: "{{ assumed_role.sts_creds.session_token }}"
...
```
And, I'm getting long error message as like below:

```
IOError: [Errno 36] File name too long: 
'roles/patching-cf-ssm/files/AWSTemplateFormatVersion: 
2010-09-09\nDescription: >-\n  Creating Maintenance Window for 
Non-Production Windows Server Patching.\nResources:\n  
MaintenanceWindow:\nType: AWS::SSM::MaintenanceWindow\n
Properties:\n  AllowUnassociatedTargets: false\n  Cutoff: 1\n  
Description: Maintenance Window to update SSM Agent\n  Duration: 6\n
  Name: MaintenanceWindowCFN\n  Schedule: "cron(0 45 09 ? * TUE *)"\n  
ScheduleTimezone: "Australia/Melbourne"\n  MaintenanceWindowTarget:\n  
  Type: AWS::SSM::MaintenanceWindowTarget\nProperties:\n  WindowId: 
!Ref MaintenanceWindow\n  ResourceType: INSTANCE\n  Targets:\n  
- Key: tag:Patch Group\nValues:\n- Group A\n  
OwnerInformation: SSM Target\n  Name: SSMMaintenanceWindow\n  
Description: A target for demonstrating maintenance windows \n
DependsOn: MaintenanceWindow\n  MaintenanceWindowTask:\nType: 
AWS::SSM::MaintenanceWindowTask\nProperties:\n  WindowId: !Ref 
MaintenanceWindow\n  Targets: \n- Key: WindowTargetIds\n
  Values:\n  - !Ref MaintenanceWindowTarget\n  TaskArn: 
AWS-RunPatchBaseline\n  TaskType: RUN_COMMAND\n  
TaskInvocationParameters:\n  
MaintenanceWindowRunCommandParameters:\nParameters:\n  
   Operation:\n  - Install\n  Priority: 1\n  
MaxConcurrency: 2\n  MaxErrors: 1\n  Name: 
RegistrationTaskwithTargets\nDependsOn: MaintenanceWindowTarget'
failed: [localhost] (item=AWSTemplateFormatVersion: 2010-09-09
Description: >-
  Creating Maintenance Window for Non-Production Windows Server Patching.
Resources:
  MaintenanceWindow:
Type: AWS::SSM::MaintenanceWindow
Properties:
  AllowUnassociatedTargets: false
  Cutoff: 1
  Description: Maintenance Window to update SSM Agent
  Duration: 6
  Name: MaintenanceWindowCFN
  Schedule: "cron(0 45 09 ? * TUE *)"
  ScheduleTimezone: "Australia/Melbourne"
  MaintenanceWindowTarget:
Type: AWS::SSM::MaintenanceWindowTarget
Properties:
  WindowId: !Ref MaintenanceWindow
  ResourceType: INSTANCE
  Targets:
  - Key: tag:Patch Group
Values:
- Group A
  OwnerInformation: SSM Target
  Name: SSMMaintenanceWindow
  Description: A target for demonstrating maintenance windows
DependsOn: MaintenanceWindow
  MaintenanceWindowTask:
Type: AWS::SSM::MaintenanceWindowTask
Properties:
  WindowId: !Ref MaintenanceWindow
  Targets:
- Key: WindowTargetIds
  Values:
  - !Ref MaintenanceWindowTarget
  TaskArn: AWS-RunPatchBaseline
  TaskType: RUN_COMMAND
  TaskInvocationParameters:
  MaintenanceWindowRunCommandParameters:
Parameters:
 Operation:
  - Install
  Priority: 1
  MaxConcurrency: 2
  MaxErrors: 1
  Name: RegistrationTaskwithTargets
DependsOn: MaintenanceWindowTarget) => {
"ansible_loop_var": "item",
"changed": false,
"item": "AWSTemplateFormatVersion: 2010-09-09\nDescription: >-\n  
Creating Maintenance Window for Non-Production Windows Server 
Patching.\nResources:\n  MaintenanceWindow:\nType: 
AWS::SSM::MaintenanceWindow\nProperties:\n  
AllowUnassociatedTargets: false\n  Cutoff: 1\n  Description: 
Maintenance Window to update SSM Agent\n  Duration: 6\n  Name: 
MaintenanceWindowCFN\n  Schedule: \"cron(0 45 09 ? * TUE *)\"\n  
ScheduleTimezone: \"Australia/Melbourne\"\n  MaintenanceWindowTarget:\n
Type: AWS::SSM::MaintenanceWindowTarget\nProperties:\n  WindowId: 
!Ref MaintenanceWindow\n  ResourceType: INSTANCE\n  Targets:\n  
- Key: tag:Patch Group\nValues:\n- Group A\n  
OwnerInformation: SSM Target\n  Name: SSMMaintenanceWindow\n  
Description: A target for demonstrating maintenance windows \n
DependsOn: MaintenanceWindow\n  MaintenanceWindowTask:\n  

Re: [ansible-project] Subclassing ansible.utils.display.Display in custom callback plugin

2020-07-07 Thread Nagesh sheregar
Hi peter,

if you don't mind please send me output, i would like to get something like
below

*Socket Locator* *Status* *Size* *Max Supported Frequency* *Technology*
PROC 1 DIMM 3  Good, In Use 32.00 GB 2666 MHz RDIMM

On Tue, Jul 7, 2020 at 5:19 AM piete...@gmail.com 
wrote:

> Hi all,
>
> please allow me to ask for any help here...
> I once wrote a custom callback plugin, where I
> subclassed ansible.utils.display.Display so I could overrule it's display()
> method to manipulate the message to be printed, and then call
> super(Display, self).display(.
> Since Ansible 2.8 the Display object is now a singleton, instantiated
> right at 'ansible-playbook'. This means a cannot modify the
> Display.display() anymore  right ?
>
> Any ideas on how to call a customized display() method ?
>
> Thanks in advance for any help.
>
> Pieter.
>
> --
> 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/bb33b941-7efb-4ec8-83ce-82e2dfb8db92n%40googlegroups.com
> 
> .
>

-- 
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/CAFu5ZNxu%2B%2BZDHWPqCcQuKn_RBcXcTCb1796GntyM5SF6kqBbeA%40mail.gmail.com.


Re: [ansible-project] How to structure variables to distinguish different environments

2020-07-07 Thread Xinhuan Zheng
Hello,

That construct actually makes sense to me. The fact of Development vs. 
Production is controlled by their network. We can just create custom fact 
based on each host IP address, and return customer fact variable. Then we 
can set nfs_server per that custom fact.

Thanks for showing this tip.

- Xinhuan

On Thursday, July 2, 2020 at 6:23:27 AM UTC-4, Srinivas Naram wrote:
>
> There could be some distinction between both the environments. Can you use 
> gather_facts and get the differentiating value ?
>
> if you are able to get it using gather_facts, you can use set_facts
>
> Example
>
> set_facts:
>nfs_server: xyx
> when: ansible_distribution= 'CentOS'
>
> set_fact:
>nfs_server: abc
> when: ansible_distribution ='Ubuntu'
>
> On Thu, Jul 2, 2020 at 12:26 AM Xinhuan Zheng  > wrote:
>
>> Hello,
>>
>> I want to define a variable for playbook in *group_vars/server_genre* 
>> file. However, I don't know if Ansible can support something like 
>> server_genre@environment syntax notation. Here is the detail:
>>
>> *In inventory/environment*:
>> ---
>> [server_genre]
>> myserver1.example.com
>>
>> *In group_vars/server_genre:*
>> ---
>> nfs_server: mynfsserver1.example.com
>>
>> *In server_genre.yml playbook:*
>> ---
>> - name: Playbook for server_genre
>>   hosts: server_genre
>>   gather_facts: yes
>>
>>   tasks:
>>
>>   - name: Install Nfs client
>> package:
>>   name: nfs-utils
>>   state: present
>>   - name: mount nfs
>> mount:
>>   path: /mymount
>>   src: "{{ nfs_server }}"
>>   fstype: nfs
>>   opts: ro
>>   state: mounted
>>
>> In a different environment, the variable {{ nfs_server }} will have 
>> different value, however, I can't separate the different values using one 
>> single group_var/server_genre file, unless Ansible supports something like 
>> group_vars/server_genre@enviornment.
>>
>> How do I accomplish the variable value distinction in my case?
>>
>> Thanks,
>>
>> - Xinhuan
>>
>>
>> -- 
>> 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/96edc459-2fec-4626-b7ac-2dae6d330505o%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/9bbe8409-2805-442d-af8c-f092195a8f89o%40googlegroups.com.


[ansible-project] Re: Subclassing ansible.utils.display.Display in custom callback plugin

2020-07-07 Thread piete...@gmail.com
To answer myself...   I figured this simple solution :

in '__init__()'

self.realdisplay = self._display.display
self._display.display = self.display

then add a 'display()' method that intercept my message, and then calls 
'self.realdisplay()'

Gonna run some tests now.  Thanks for your time so far...

Pieter


Op dinsdag 7 juli 2020 om 12:19:18 UTC+2 schreef piete...@gmail.com:

> Hi all,
>
> please allow me to ask for any help here...
> I once wrote a custom callback plugin, where I 
> subclassed ansible.utils.display.Display so I could overrule it's display() 
> method to manipulate the message to be printed, and then call 
> super(Display, self).display(.
> Since Ansible 2.8 the Display object is now a singleton, instantiated 
> right at 'ansible-playbook'. This means a cannot modify the 
> Display.display() anymore  right ?
>
> Any ideas on how to call a customized display() method ?
>
> Thanks in advance for any help.
>
> Pieter.
>
>

-- 
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/673cfc59-886f-4925-a8bc-64f142aad048n%40googlegroups.com.


Re: [ansible-project] Looping CF Templates with items loops and its reporting an error

2020-07-07 Thread Dick Visser
with_file should be indented back

On Tue, 7 Jul 2020 at 07:13, ameya agashe  wrote:
>
> Hello,
>
> Here is the tasks/main.yml content
> ```
> roles/patching-cf-ssm/tasks/main.yml
> ---
> # tasks file for patching-cf-ssm
> - name: create a cloudformation stack
>   cloudformation:
> stack_name: "ansible-cloudformation"
> state: "present"
> disable_rollback: true
> template: roles/patching-cf-ssm/files/{{ item }}
> with_file:
>   - PatchBaseline.yml
>   - MaintenanceWindow.yml
> ...
> ```
>
> Unfortunately throws me back an error as below
>
> fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
> undefined variable. The error was: 'item' is undefined\n\nThe error appears 
> to be in 'roles/patching-cf-ssm/tasks/main.yml': line 3, column 3, but 
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
> offending line appears to be:\n\n# tasks file for patching-cf-ssm\n- name: 
> create a cloudformation stack\n  ^ here\n"}
>
> I used double quotes for roles/patching-cf-ssm/files/{{ item }} but still no 
> luck.
>
> Any idea why?
>
> Regards,
> Ameya
>
> --
> 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/833d4832-ea66-4dc8-937f-5e4a99ab4075o%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/CAL8fbwM2YBLuOCS%3Dt5jL2FTmK%2B8LjNyQWtujo%3Dqn1bBrrgn-%3Dw%40mail.gmail.com.


[ansible-project] Subclassing ansible.utils.display.Display in custom callback plugin

2020-07-07 Thread piete...@gmail.com
Hi all,

please allow me to ask for any help here...
I once wrote a custom callback plugin, where I 
subclassed ansible.utils.display.Display so I could overrule it's display() 
method to manipulate the message to be printed, and then call 
super(Display, self).display(.
Since Ansible 2.8 the Display object is now a singleton, instantiated right 
at 'ansible-playbook'. This means a cannot modify the Display.display() 
anymore  right ?

Any ideas on how to call a customized display() method ?

Thanks in advance for any help.

Pieter.

-- 
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/bb33b941-7efb-4ec8-83ce-82e2dfb8db92n%40googlegroups.com.


Re: [ansible-project] cisco ios connect ssh error

2020-07-07 Thread Srinivas Naram
Username, Password is null. How are you passing user credentials ?

Would it be possible to share playbook ?

On Tue, Jul 7, 2020 at 2:50 PM  wrote:

> Yes , I can connect ssh,but still show error
>
>
>
>
>
> “ssh sandy@
>
> Password:
>
>
>
>---  Global Limited ---
>
>
>
>   Unauthorized access is strictly prohibited *** tpesw-01#
>
> tpesw-01#   “
>
>
>
>
>
> fatal: [tpesw-01]: FAILED! => {
>
> "ansible_facts": {},
>
> "changed": false,
>
> "failed_modules": {
>
> "ios_facts": {
>
> "exception": "WARNING: The below traceback may *not* be
> related to t he actual failure.\n  File
> \"/tmp/ansible_ios_facts_payload_NZrxLz/ansible_ios_f
> acts_payload.zip/ansible/module_utils/network/common/network.py\", line
> 229, in  get_capabilities\ncapabilities =
> Connection(module._socket_path).get_capabil
> ities()\n  File
> \"/tmp/ansible_ios_facts_payload_NZrxLz/ansible_ios_facts_payloa
>  d.zip/ansible/module_utils/connection.py\", line 185, in
> __rpc__\nraise Conn ectionError(to_text(msg,
> errors='surrogate_then_replace'), code=code)\n",
>
> "failed": true,
>
> "invocation": {
>
> "module_args": {
>
> "auth_pass": null,
>
> "authorize": null,
>
> "gather_network_resources": null,
>
> "gather_subset": [
>
> "all"
>
> ],
>
> "host": null,
>
> "password": null,
>
> "port": null,
>
> "provider": null,
>
> "ssh_keyfile": null,
>
> "timeout": null,
>
> "username": null
>
> }
>
> },
>
> "msg": "[Errno -2] Name or service not known"
>
> }
>
> },
>
> "msg": "The following modules failed to execute: ios_facts\n"
>
> }
>
> BR
>
>
>
>
>
> Sandy
>
>
>
> *From:* ansible-project@googlegroups.com 
> *On Behalf Of *Srinivas Naram
> *Sent:* Tuesday, July 7, 2020 3:49 PM
> *To:* ansible-project@googlegroups.com
> *Subject:* Re: [ansible-project] cisco ios connect ssh error
>
>
>
> Are you able to connect to Cisco Switch from Ansible server via ssh ? The
> error says 'Connection Error'.
>
>
>
> On Tue, Jul 7, 2020 at 1:03 PM Sandy Hung  wrote:
>
> I connect cisco switch run playbook show error msg
>
> please help thanks.
>
> fatal: [tpesw-01]: FAILED! => {
>
> "ansible_facts": {},
>
> "changed": false,
>
> "failed_modules": {
>
> "ios_facts": {
>
> "exception": "WARNING: The below traceback may *not* be
> related to the actual failure.\n  File
> \"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/network/common/network.py\",
> line 229, in get_capabilities\ncapabilities =
> Connection(module._socket_path).get_capabilities()\n  File
> \"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/connection.py\",
> line 185, in __rpc__\nraise ConnectionError(to_text(msg,
> errors='surrogate_then_replace'), code=code)\n",
>
> "failed": true,
>
> "invocation": {
>
> "module_args": {
>
> "auth_pass": null,
>
> "authorize": null,
>
> "gather_network_resources": null,
>
> "gather_subset": [
>
> "all"
>
> ],
>
> "host": null,
>
> "password": null,
>
> "port": null,
>
> "provider": null,
>
> "ssh_keyfile": null,
>
> "timeout": null,
>
> "username": null
>
> }
>
> },
>
> "msg": "[Errno -2] Name or service not known"
>
> }
>
> },
>
> "msg": "The following modules failed to execute: ios_facts\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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7bf542cc-2a7a-45ba-b94d-9332327f7e6bn%40googlegroups.com
> 
> .
>
> --
> 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
> 

RE: [ansible-project] cisco ios connect ssh error

2020-07-07 Thread sandy.hung
Yes , I can connect ssh,but still show error 

 �

 �

“ssh sandy@

Password:

 �

   ---  Global Limited ---

 �

  Unauthorized access is strictly prohibited *** tpesw-01#

tpesw-01#   “

 �

 �

fatal: [tpesw-01]: FAILED! => {

"ansible_facts": {},

"changed": false,

"failed_modules": {

"ios_facts": {

"exception": "WARNING: The below traceback may *not* be related to 
t he actual failure.\n  File 
\"/tmp/ansible_ios_facts_payload_NZrxLz/ansible_ios_f 
acts_payload.zip/ansible/module_utils/network/common/network.py\", line 229, in 
 get_capabilities\ncapabilities = 
Connection(module._socket_path).get_capabil ities()\n  
File \"/tmp/ansible_ios_facts_payload_NZrxLz/ansible_ios_facts_payloa   
  d.zip/ansible/module_utils/connection.py\", line 185, in 
__rpc__\nraise Conn ectionError(to_text(msg, 
errors='surrogate_then_replace'), code=code)\n",

"failed": true,

"invocation": {

"module_args": {

"auth_pass": null,

"authorize": null,

"gather_network_resources": null,

"gather_subset": [

"all"

],

"host": null,

"password": null,

"port": null,

"provider": null,

"ssh_keyfile": null,

"timeout": null,

"username": null

}

},

"msg": "[Errno -2] Name or service not known"

}

},

"msg": "The following modules failed to execute: ios_facts\n"

}

BR

 �

 �

Sandy

 �

From: ansible-project@googlegroups.com  On 
Behalf Of Srinivas Naram
Sent: Tuesday, July 7, 2020 3:49 PM
To: ansible-project@googlegroups.com
Subject: Re: [ansible-project] cisco ios connect ssh error

 �

Are you able to connect to Cisco Switch from Ansible server via ssh ? The error 
says 'Connection Error'.

 �

On Tue, Jul 7, 2020 at 1:03 PM Sandy Hung mailto:sandy.h...@abagile.com> > wrote:

I connect cisco switch run playbook show error msg

please help thanks.

fatal: [tpesw-01]: FAILED! => {

 �  � "ansible_facts": {},

 �  � "changed": false,

 �  � "failed_modules": {

 �  �  �  � "ios_facts": {

 �  �  �  �  �  � "exception": "WARNING: The below traceback may *not* be 
related to the actual failure.\n � File 
\"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/network/common/network.py\",
 line 229, in get_capabilities\n �  � capabilities = 
Connection(module._socket_path).get_capabilities()\n � File 
\"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/connection.py\",
 line 185, in __rpc__\n �  � raise ConnectionError(to_text(msg, 
errors='surrogate_then_replace'), code=code)\n",

 �  �  �  �  �  � "failed": true,

 �  �  �  �  �  � "invocation": {

 �  �  �  �  �  �  �  � "module_args": {

 �  �  �  �  �  �  �  �  �  � "auth_pass": null,

 �  �  �  �  �  �  �  �  �  � "authorize": null,

 �  �  �  �  �  �  �  �  �  � "gather_network_resources": null,

 �  �  �  �  �  �  �  �  �  � "gather_subset": [

 �  �  �  �  �  �  �  �  �  �  �  � "all"

 �  �  �  �  �  �  �  �  �  � ],

 �  �  �  �  �  �  �  �  �  � "host": null,

 �  �  �  �  �  �  �  �  �  � "password": null,

 �  �  �  �  �  �  �  �  �  � "port": null,

 �  �  �  �  �  �  �  �  �  � "provider": null,

 �  �  �  �  �  �  �  �  �  � "ssh_keyfile": null,

 �  �  �  �  �  �  �  �  �  � "timeout": null,

 �  �  �  �  �  �  �  �  �  � "username": null

 �  �  �  �  �  �  �  � }

 �  �  �  �  �  � },

 �  �  �  �  �  � "msg": "[Errno -2] Name or service not known"

 �  �  �  � }

 �  � },

 �  � "msg": "The following modules failed to execute: ios_facts\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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7bf542cc-2a7a-45ba-b94d-9332327f7e6bn%40googlegroups.com
 

 .

-- 
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 

[ansible-project] Challenge Response based authentication in ansible

2020-07-07 Thread 'Akshay Rathod' via Ansible Project
Hi,
I want to maintain linux servers with challenge response based 
authentication with ansible, not able to find document around it. Please 
help me out with any useful document.


-- 
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/5e1562af-ba7c-4021-9aaf-edeb8f1e5424n%40googlegroups.com.


Re: [ansible-project] cisco ios connect ssh error

2020-07-07 Thread Srinivas Naram
Are you able to connect to Cisco Switch from Ansible server via ssh ? The
error says 'Connection Error'.

On Tue, Jul 7, 2020 at 1:03 PM Sandy Hung  wrote:

> I connect cisco switch run playbook show error msg
> please help thanks.
> fatal: [tpesw-01]: FAILED! => {
> "ansible_facts": {},
> "changed": false,
> "failed_modules": {
> "ios_facts": {
> "exception": "WARNING: The below traceback may *not* be
> related to the actual failure.\n  File
> \"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/network/common/network.py\",
> line 229, in get_capabilities\ncapabilities =
> Connection(module._socket_path).get_capabilities()\n  File
> \"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/connection.py\",
> line 185, in __rpc__\nraise ConnectionError(to_text(msg,
> errors='surrogate_then_replace'), code=code)\n",
> "failed": true,
> "invocation": {
> "module_args": {
> "auth_pass": null,
> "authorize": null,
> "gather_network_resources": null,
> "gather_subset": [
> "all"
> ],
> "host": null,
> "password": null,
> "port": null,
> "provider": null,
> "ssh_keyfile": null,
> "timeout": null,
> "username": null
> }
> },
> "msg": "[Errno -2] Name or service not known"
> }
> },
> "msg": "The following modules failed to execute: ios_facts\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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7bf542cc-2a7a-45ba-b94d-9332327f7e6bn%40googlegroups.com
> 
> .
>

-- 
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/CAG-N3P4jR8-OoF80TbjoYo42F7BgFUaZ7cTCvRLevRXudjiT2Q%40mail.gmail.com.


[ansible-project] cisco ios connect ssh error

2020-07-07 Thread Sandy Hung
I connect cisco switch run playbook show error msg
please help thanks.
fatal: [tpesw-01]: FAILED! => {
"ansible_facts": {},
"changed": false,
"failed_modules": {
"ios_facts": {
"exception": "WARNING: The below traceback may *not* be related 
to the actual failure.\n  File 
\"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/network/common/network.py\",
 
line 229, in get_capabilities\ncapabilities = 
Connection(module._socket_path).get_capabilities()\n  File 
\"/tmp/ansible_ios_facts_payload_8veYSP/ansible_ios_facts_payload.zip/ansible/module_utils/connection.py\",
 
line 185, in __rpc__\nraise ConnectionError(to_text(msg, 
errors='surrogate_then_replace'), code=code)\n",
"failed": true,
"invocation": {
"module_args": {
"auth_pass": null,
"authorize": null,
"gather_network_resources": null,
"gather_subset": [
"all"
],
"host": null,
"password": null,
"port": null,
"provider": null,
"ssh_keyfile": null,
"timeout": null,
"username": null
}
},
"msg": "[Errno -2] Name or service not known"
}
},
"msg": "The following modules failed to execute: ios_facts\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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7bf542cc-2a7a-45ba-b94d-9332327f7e6bn%40googlegroups.com.


[ansible-project] Booting custom ISO file by ansible hpilo_boot on a physical server

2020-07-07 Thread DevOps Automation
Hi,

Has anyone booted an ISO file through HP ILO by using ansible?
1. If yes, can you please explain how the connection is established between 
remote and host server. Also the booting procedure.
2. After booting the server how can we automate the process/pass the 
variables to assign the hostname, IP address for the physical server.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/61d7092e-8c8d-4677-bf9d-578ba6c505fao%40googlegroups.com.


Re: [ansible-project] How to split value from list

2020-07-07 Thread Srinivas Naram
How do we incorporate if-else in set_fact ?

On Tue, Jul 7, 2020 at 11:26 AM Jenisha T  wrote:

> This logic works. Thankyou
>
> On Tuesday, 7 July 2020 at 10:52:51 UTC+5:30 Karl Auer wrote:
>
>> so what's wrong with:
>>
>> USR="jenisha"
>> FOUND=`grep $USR /etc/passwd | cut -d: -f1`
>> if [ -z "$FOUND" ] ; then
>>echo "No such user: $USR"
>> else
>># do whatever...
>> fi
>>
>> ?
>>
>> Regards, K.
>>
>>
>> On Tue, Jul 7, 2020 at 3:11 PM T. JENISHA  wrote:
>>
>>> In my case cut doesn't work. I m searching for a particular user from a
>>> password.
>>> $ grep anil /etc/passwd
>>>
>>>
>>> Best Regards
>>> Jenisha T
>>> Whatsapp: +91 07598087866 <+91%2075980%2087866>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, 6 Jul 2020 at 19:50, Stefan Hornburg (Racke) 
>>> wrote:
>>>
 On 7/6/20 3:32 PM, Srinivas Naram wrote:
 > Hello Jenisha,
 >
 > Assuming that you are getting this value from /etc/passwd., try to
 change you command
 >
 >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}'
 >

 cut -d : -f 1 is more concise and readable than your awk command.

 Otherwise I would really like to know why Jenisha resorts to reading
 the password file.

 Regards
  racke


 > On Mon, Jul 6, 2020 at 6:35 PM Dick Visser >>> > wrote:
 >
 > you should either use set_fact, or register. Both doesn't make
 sense.
 >
 > On Mon, 6 Jul 2020 at 13:44, Jenisha T >>> joy...@gmail.com>> wrote:
 > >
 > > Hi
 > > Could you pls help me with the splitting value from the list. I
 need to extract first value anil before ('':')
 > >
 > >  grep_atm.stdout_lines output below
 > >
 > > ok: [localhost] => {
 > > "msg": "anil:x:500:500:Anil:/home/anil:/bin/bash
 > > "
 > > }
 > >
 > > I tried,
 > > - set_fact:
 > >user_name: "{{ grep_atm.stdout_lines }}"
 > > register: user_name.split(':')[0]
 > >  - debug:
 > > var: user_name.split(':')[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-proje...@googlegroups.com >>> ansible-project%2bunsu...@googlegroups.com>.
 > > To view this discussion on the web visit
 >
 https://groups.google.com/d/msgid/ansible-project/42fb2917-8336-42a2-979a-44573e91fd77n%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-proje...@googlegroups.com >>> ansible-project%2bunsu...@googlegroups.com>.
 > To view this discussion on the web visit
 >
 https://groups.google.com/d/msgid/ansible-project/CAL8fbwMo1%3D9XhddQY_BDaREzKLRGS_xDvZbtu1o5UCj0R1h%3Duw%40mail.gmail.com
 .
 >
 > --
 > 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 >>> ansible-proje...@googlegroups.com>.
 > To view this discussion on the web visit
 >
 https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com
 > <
 https://groups.google.com/d/msgid/ansible-project/CAG-N3P7NNjnbv7fZ5Vx0vmmTTyd9KntKpY-yOm75csqJ50cBmA%40mail.gmail.com?utm_medium=email_source=footer
 >.


 --
 Ecommerce and Linux consulting + Perl and web application programming.
 Debian and Sympa administration. Provisioning with Ansible.

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/b4c85876-5359-f104-cd6f-03667cd7f93b%40linuxia.de
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAAGhZYjxvOgKKa1pFfh5oAp2JDzyeOmW0SE8zFM_j3vTefgaUw%40mail.gmail.com
>>>