Re: [ansible-project] Failed to install package NTP

2023-07-22 Thread Mike Eggleston
ntpd?MikeOn Jul 22, 2023, at 14:27, arjungoel 1995  wrote:Hi, I was just testing a basic playbook in Ansible. Here is the playbook code: name: Set up NTP on all servers  hosts: all  become: true  tasks:    - name: Ensure NTP is installed      yum:         name: ntp         state: present    - name: Ensure NTP is running      service:         name: ntpd         state: started         enabled: yesWhen I am running the ansible-playbook playbook.yaml command, I am getting this error:TASK [Ensure NTP is installed] fatal: [3.226.126.95]: FAILED! => {"changed": false, "failures": ["No package ntp available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}PLAY RECAP 3.226.126.95               : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   Please 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/07819a01-fc33-48d4-b2fe-3645699e1701n%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/E6C1B59A-5166-47D0-AEE7-311E5048A858%40gmail.com.


Re: [ansible-project] role with in a role

2023-06-01 Thread Mike Eggleston
import_plays and import_playbookMikeOn Jun 1, 2023, at 12:15, Dick Visser  wrote:You can have a playbook with multiple plays. One targets localhost to fetch api results. You register that. The subsequent plays target real host and use the registered data On Thu, 1 Jun 2023 at 16:50, Narmada Karthika  wrote:I have one more question please, can we call a play in another play, because I have a playbook which needs to run some curl commands and fetch data, and the second play book has to perform the configurations. When I want to run configuration playbook, first it needs to run curl playbook and fetch data. On Wednesday, May 31, 2023 at 10:58:01 AM UTC-7 Narmada Karthika wrote:got it.. thankyouOn Wednesday, May 31, 2023 at 9:55:10 AM UTC-7 Dick Visser wrote:Something without the nested roles, as those are clearly not doing
what you want.
It's a bit hard to understand what needs to be executed where.
I would start out with a playbook and not bother with roles initially.

On Wed, 31 May 2023 at 17:32, Narmada Karthika  wrote:
>
> So, is there any other alternate solution you would suggest  for my requirement.
>
> On Tue, May 30, 2023, 4:24 PM Kosala Atapattu  wrote:
>>
>> I've done this before for a complicated piece of work I did. I had roles running on several delegate proxies (yeah I called them that, since we had 5-6 of them :)).
>>
>> However I did not delegate a role in mycase, but all the tasks were written with delegate_to: "{{ delgate_host }}" where I can override delegate_host variable at the role level.
>>
>> I do not believe this is a widely used regime, and I did ran in to some issues when you call role -> role -> role, the last layer lost visibility to all the top level variables. Like @Dick Visser said this will not be the smoothest sailing, but surely works.
>>
>> I wrote this originally for Ansible 2.9, but when I tested with 2.11, most of the issues I faced were gone.
>>
>> Kosala
>>
>>
>>
>>
>> On Wed, May 31, 2023 at 7:42 AM Narmada Karthika  wrote:
>>>
>>> any suggestions please to satisfy my above request...
>>>
>>> On Friday, May 26, 2023 at 10:48:02 AM UTC-7 Narmada Karthika wrote:

 local host is the ansible master where the role2 has to be executed. because the role2 is to run some api commands and get server details
 role1` is to install components on the server which I get from role2

 On Fri, May 26, 2023 at 10:34 AM Dick Visser  wrote:
>
> I haven't tried this myself (as it sounds too complicated and error prone), but I'm guessing because you first run on the remote Windows  host, and from there during the other role, localhost is in fact that remote host.
> It makes sense, in a way.
>
> I may be completely wrong though
>
> On Fri, 26 May 2023 at 19:24, Narmada Karthika  wrote:
>>
>> I am trying a playbook for a role and calling another role with in it.
>> role1 where i am running playbook need to be executed on windows hosts, role 2 which is being called in role1 needs to be executed on localhost(linux).
>> this is from the tasks/main.yml file for role1.
>> but still it is picking windows node from role1 and failing..
>> - name: calling serverdata role here
>>   include_role:
>> name: serverdata (role2)
>> tasks_from: main.yml
>> apply:
>>   delegate_to: localhost
>>
>> --
>> 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/18f6e3a2-5f79-43a2-9d44-2b09e18fa73en%40googlegroups.com.
>
> --
> Sent from Gmail Mobile
>
> --
> 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/CAF8BbLaKuC8mNa159X8ePAuVop7jCpCkYs7--hqteHRLqmy2Kw%40mail.gmail.com.



 --
  Thanks,
 Narmada Karthika Chitturi

>>>
>>> --
>>> 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/1f82284f-386c-4389-a269-474dd5d0a38cn%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 

Re: [ansible-project] How to generate and store passwords securely with lookup?

2023-04-19 Thread Mike Eggleston
Add the change to the module is my vote.

Mike

> On Apr 19, 2023, at 05:05, Mélodie O  wrote:
> 
> Hello,
> 
> I am generating random passwords using the lookup plugin. My issue is that I 
> would like these passwords to be stored securely. I have searched everywhere 
> but haven't found a solution to my problem.
> 
> Therefore, I modified the lookup plugin and am using ansible-vault to encrypt 
> and store the passwords in a file.
> 
> Does this feature seem interesting to you and should I contribute to the 
> project ?
> Or, am I approaching this with the wrong logic?
> 
> Thank you in advance for your response.
> 
> -- 
> 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/7eec6b06-207a-4e67-a319-2a82935f229bn%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/45E55269-6039-430F-A57F-4004AB13F5F3%40gmail.com.


Re: [ansible-project] Not able to pass hostname as extra var from ansible tower

2023-03-19 Thread Mike Eggleston
Write the data to a file on the local host then delegate to the local host to read and delete the file, then continue with the playbook?MikeOn Mar 19, 2023, at 12:00, Linux Study  wrote: i am creating jenkins pipe line to pass extra variable and want run playbook on host which i want to pass from jenkins...On Sat, 18 Mar 2023, 19:35 Todd Lewis,  wrote:
  

  
  
Abhi,

Is this "hostname" the name of the host you want Ansible to manage?
If so, why pass that through an extra variable rather than using the
limit parameter?

In Ansible Tower, you have projects which define where your
playbooks are stored and several more parameters such as
credentials. Here's what a typical project looks like.


Each project can have any number of job templates,
where each template allows you to configure which hosts or Ansible
host groups to run the playbook on ("Limit" in the red box below),
what extra variables to use, what parameters to prompt for, etc.
Here's a typical job template.

Note that the nearly empty box below "Variables" would be where
extra variables are defined. This job template doesn't use any extra
variables. When editing a job template, almost any of the fields
shown above can be marked "Prompt on launch", in which case you can
override the default values at the time you launch the job.

Job templates can also be scheduled to run at regular intervals.
Parameters which normally generate prompts can be filled in by the
schedule just as if someone had manually started a job.

So, to address your question, "[H]ow can I add this hostname to [a]
playbook?" If you really want to pass an extra variable called
"hostname" that you can use in a playbook, you do that when you edit
your job template. Be sure to check "Prompt on launch" if you want
to override the default value when you run your job, like this:


In your playbook, you simply use the variable like any other:
- name: My task
  ansible.builtin.debug:
msg: "My hostname variable is {{ hostname }}."

I hope this helps. Good luck.

On 3/18/23 5:09 AM, Linux Study wrote:


  
  Hi there,


I want to pass hostname as extra variable from
  ansible tower to Playbook.how can i do this and how can i add
  this hostname to playbook?




Regards,
Abhi
  
  -- 
  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/CAEcjLFwUoRLfQG7Yy4NVpfjuwEAL4bqHwmFo-OijUFgmxLD0ng%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/946107ed-d83f-c8d3-d641-5b1e65ace095%40gmail.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/CAEcjLFw4Q75%3DDMpYzQhs9B2gio9iW%3DSeJUHgwo0AKgtRSEh%2BVA%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/40289ED9-5F16-4FCF-A073-43886949922E%40gmail.com.


Re: [ansible-project] ansible connection issue on remote RHE5 linux server

2023-02-02 Thread Mike Eggleston
I built the most current (at the time) Python and installed the Python 
executable in my home directory, then I used an Ansible variable in my 
inventory file (I don’t remember which variable) to specify an alternate Python 
interpreter and things were fine when I had an old Python interpreter on a 
remote system.

Mike

> On Feb 2, 2023, at 00:49, Abhijeet Kasurde  wrote:
> 
> Please upgrade your RHEL 5 machine to the latest RHEL version.
> 
> On Thu, Feb 2, 2023 at 11:27 AM Dick Visser  > wrote:
> upgrade your server 
> 
> On Thu, 2 Feb 2023 at 06:02, anish kumar  > wrote:
> I am running the ansible playbook through AWX and its getting failed with the 
> subjected error. But same playbook is running on another server successfully. 
> Kindly help to resolve the issue.
> 
> Successful login on sever :- os config Redhat enterprise linux 7.9
> 
> Error while login on server:- os config  Redhat enterprise linux 5.0
> 
> Error :-
> 
> fatal localhost->192.168.101.12]: FAILED! => changed": false, 
> "module_stderr": "Shared connection to 192.168.101.12]closed in", 
> "module.stdout":"File 
> W/home/web/ak1/ansible/tmp/ansible-tmp-1675175673.3860075-51234- 
> 280095385528185/AnsiballZ_command.py\", line 72n with open(args.path. 'rb) as 
> fin "Ventadmor invalid syntaxin", "msg": "MODULE FAILURE\See stdout/stderr 
> for the exact error, "rc":1}
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/900f41b5-72f2-4373-b326-02ef107d9368n%40googlegroups.com
>  
> .
> -- 
> Sent from Gmail Mobile
> 
> -- 
> 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/CAF8BbLbG9HO4NbBSJ_nAkqry2izqkXfSk1p98o3vx86JpAqvUQ%40mail.gmail.com
>  
> .
> 
> 
> -- 
> Thanks,
> Abhijeet Kasurde
> 
> -- 
> 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/CAFwWkHqMF8hmRUt8MgJxwUB-u8U91NBtRN8Z8D68eGHVtjfZfg%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/D25334C6-C255-4413-9BCA-26C47D3FB825%40gmail.com.


Re: [ansible-project] Get all key from output

2023-01-05 Thread Mike Eggleston
Are you missing a parameter “snapshot_id” in your definition of “ec2_snapshot”?

> On Jan 5, 2023, at 08:24, SysAdmin EM  wrote:
> 
> 
> Hello! I can’t solve the problem.
> 
> This is the output
> 
> changed: [localhost] => (item=vol-) => { 
>"ansible_loop_var": "item", 
>"changed": true, 
>"invocation": { 
>"module_args": { 
>"aws_access_key": null, 
>"aws_ca_bundle": null, 
>"aws_config": null, 
>"aws_secret_key": null, 
>"debug_botocore_endpoint_logs": false, 
>"description": null, 
>"device_name": null, 
>"ec2_url": null, 
>"instance_id": null, 
>"last_snapshot_min_age": 0, 
>"profile": null, 
>"region": null, 
>"security_token": null, 
>"snapshot_id": null, 
>"snapshot_tags": { 
>"MarkedForDeletion": true 
>}, 
>"state": "present", 
>"validate_certs": true, 
>"volume_id": "vol-", 
>"wait": true, 
>"wait_timeout": 900 
>} 
>}, 
>"item": "vol-", 
>"snapshot_id": "snap-", 
>"snapshots": [ 
>{ 
>"description": "", 
>"encrypted": false, 
>"owner_id": "xxx", 
>"progress": "", 
>"response_metadata": { 
>"http_headers": { 
>"cache-control": "no-cache, no-store", 
>"content-length": "674", 
>"content-type": "text/xml;charset=UTF-8", 
>"date": "Thu, 05 Jan 2023 14:17:16 GMT", 
>"server": "AmazonEC2", 
>"strict-transport-security": "max-age=31536000; 
> includeSubDomains", 
>"x-amzn-requestid": "" 
>}, 
>"http_status_code": 200, 
>"request_id": "x", 
>"retry_attempts": 0 
>}, 
>"snapshot_id": "snap-xxx", 
>"start_time": "2023-01-05T14:17:16.785000+00:00", 
>"state": "pending", 
>"tags": { 
>"MarkedForDeletion": "True" 
>}, 
>"volume_id": "vol-xx", 
>"volume_size": 400 
>} 
>], 
>"tags": { 
>"MarkedForDeletion": "True" 
>}, 
>"volume_id": "vol-x", 
>"volume_size": 400 
> }
> 
> i see this error
> 
> TASK [Debug] 
> **
>  
> task path: /etc/ansible/ec2/create_ec2_instance/playbook/test.yaml:19 
> fatal: [localhost]: FAILED! => { 
>"msg": "The task includes an option with an undefined variable. The error 
> was: 'dict object' has no attribute 'snapshot_id'\n\nThe error appears to be 
> in '/etc/ans
> ible/ec2/create_ec2_instance/playbook/test.yaml': line 19, column 7, but 
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
> offending line app
> ears to be:\n\n\n- name: \"Debug\"\n  ^ here\n"   
>   
> 
> } 
> 
> PLAY RECAP 
> 
>  
> localhost  : ok=1changed=1unreachable=0failed=1   
>  skipped=0rescued=0ignored=0   
> 
> Here my playbook:
> 
> ---
> - name: "test"
>   hosts: localhost
>   gather_facts: no
>   vars:
> aws_volume_id:
>   - vol-x
>   - vol-x
>   tasks:
> - name: "test"
>   amazon.aws.ec2_snapshot:
> volume_id: "{{ item }}"
> wait_timeout: 900
> snapshot_tags:
> MarkedForDeletion: true
>   register: snapshotid
>   with_items: "{{ aws_volume_id }}"
> 
> - name: "Debug"
>   debug:
> msg: "{{ item.snapshot_id }}" 
>   with_items: "{{ snapshotid }}"
> 
> 
> 
> -- 
> 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/CAGUDtnmaJLW_9d1UNukaR-amduefyoSRqz_K0s1qFB8bg7aSRg%40mail.gmail.com
>  
> .

-- 
You received this message because you are 

Re: [ansible-project] Ansible inaccessible due to Cisco Secure Endpoint antivirus

2023-01-03 Thread Mike Eggleston
Modify your inventory list removing the device…?

Mike

> On Jan 3, 2023, at 01:58, Joëlle Boillat  wrote:
> 
> Good Morning,
> 
> At the beginning of December I can't reach a server from a client. This is 
> due to Cisco Secure Endpoint.
> 
> So I want to create an exclusion for this specific server.
> 
> Can anyone help me on what to exclude from the antivirus to make it work 
> again ?
> 
> The first thing I did it's to allow the process 
> 59d3cdc7d51fa34c6b27b8b04ea17992955466eb25022b7bd64880ab35df0bbc but it's 
> always impossible to access to the server. You will find the error here 
> attached.
> 
> I have created the following exclusions but it doesn't work :
> - IOC : W32.CscriptRemoteSystemScript.ioc 
> 
> - Process : 59d3cdc7d51fa34c6b27b8b04ea17992955466eb25022b7bd64880ab35df0bbc
> - Executable : cscript.exe
> 
> Someone could help me please ?
> 
> Many thanks in advance for your help.
> 
> Kind regards,
> Joëlle
> 
> 
> -- 
> 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/cefdc2e1-0aa3-4a3e-8c99-609881bab4c6n%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/16732079-CC47-433F-9E4B-DA3A58B01EB6%40gmail.com.


Re: [ansible-project] Getting an error...

2022-12-10 Thread Mike Eggleston
My current hypothesis is that “gather_facts: true” is causing the issue with 
4400 (4403) hosts.

> On Dec 9, 2022, at 16:04, Mike Eggleston  wrote:
> 
> I would if I could. The Ansible controller should easily get by with 6G free 
> and I can only update to what’s in the company’s update pipeline.
> 
> Mike
> 
>> On Dec 9, 2022, at 16:02, Jorge Rúa > <mailto:jruarive...@gmail.com>> wrote:
>> 
>> I'd try two things if I were on your shoes:
>> Increase memory on the ansible controller
>> Update python to a more up-to-date version
>> Regards,
>> 
>> El vie, 9 dic 2022 a las 21:44, Mike Eggleston (> <mailto:mikeegg1...@gmail.com>>) escribió:
>> I’ve set “forks = 1” and rerun my test which does an ansible-playbook and an 
>> uptime.
>> Could it be the register rather than a memory leak?
>> Here free(1) keeps going down:
>> 
>>> [meggleston@pc1uepsiadm01 ~]$ while true
>>> > do
>>> > date
>>> > free -m
>>> > sleep 60
>>> > done
>>> Fri Dec  9 16:30:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782111396190  18 490
>>> 6408
>>> Swap:  409528971198
>>> Fri Dec  9 16:31:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782111496127  19 544
>>> 6398
>>> Swap:  409528961199
>>> Fri Dec  9 16:32:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782111636112  19 544
>>> 6383
>>> Swap:  409528961199
>>> Fri Dec  9 16:33:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782111736100  19 546
>>> 6373
>>> Swap:  409528961199
>>> Fri Dec  9 16:34:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782111846081  19 554
>>> 6362
>>> Swap:  409528951200
>>> Fri Dec  9 16:35:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112156042  20 562
>>> 6329
>>> Swap:  409528851210
>>> Fri Dec  9 16:36:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112256032  20 563
>>> 6319
>>> Swap:  409528841211
>>> Fri Dec  9 16:37:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112296028  20 563
>>> 6315
>>> Swap:  409528801215
>>> Fri Dec  9 16:38:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112575999  20 563
>>> 6287
>>> Swap:  409528611234
>>> Fri Dec  9 16:39:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112865971  21 563
>>> 6259
>>> Swap:  409528601235
>>> Fri Dec  9 16:40:31 EST 2022
>>>   totalusedfree  shared  buff/cache   
>>> available
>>> Mem:   782112955961  21 563
>>> 6249
>>> Swap:  409528601235
>>> 
>> 
>> The playbook is really stupid:
>> 
>> [meggleston@pc1uepsiadm01 playbooks]$ cat y.yml
>> # $Id$
>> # $Log$
>>  
>> # set cyberark to a known point
>>  
>> # :!ansible-playbook --syntax-check %
>> # :!ansible-playbook --check --limit pc1uepsiadm01.res.prod.global %
>> # :!ansible-playbook --limit pc1uepsiadm01.res.prod.global %
>

Re: [ansible-project] Getting an error...

2022-12-09 Thread Mike Eggleston
I would if I could. The Ansible controller should easily get by with 6G free 
and I can only update to what’s in the company’s update pipeline.

Mike

> On Dec 9, 2022, at 16:02, Jorge Rúa  wrote:
> 
> I'd try two things if I were on your shoes:
> Increase memory on the ansible controller
> Update python to a more up-to-date version
> Regards,
> 
> El vie, 9 dic 2022 a las 21:44, Mike Eggleston ( <mailto:mikeegg1...@gmail.com>>) escribió:
> I’ve set “forks = 1” and rerun my test which does an ansible-playbook and an 
> uptime.
> Could it be the register rather than a memory leak?
> Here free(1) keeps going down:
> 
>> [meggleston@pc1uepsiadm01 ~]$ while true
>> > do
>> > date
>> > free -m
>> > sleep 60
>> > done
>> Fri Dec  9 16:30:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111396190  18 490
>> 6408
>> Swap:  409528971198
>> Fri Dec  9 16:31:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111496127  19 544
>> 6398
>> Swap:  409528961199
>> Fri Dec  9 16:32:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111636112  19 544
>> 6383
>> Swap:  409528961199
>> Fri Dec  9 16:33:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111736100  19 546
>> 6373
>> Swap:  409528961199
>> Fri Dec  9 16:34:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111846081  19 554
>> 6362
>> Swap:  409528951200
>> Fri Dec  9 16:35:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112156042  20 562
>> 6329
>> Swap:  409528851210
>> Fri Dec  9 16:36:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112256032  20 563
>> 6319
>> Swap:  409528841211
>> Fri Dec  9 16:37:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112296028  20 563
>> 6315
>> Swap:  409528801215
>> Fri Dec  9 16:38:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112575999  20 563
>> 6287
>> Swap:  409528611234
>> Fri Dec  9 16:39:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112865971  21 563
>> 6259
>> Swap:  409528601235
>> Fri Dec  9 16:40:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782112955961  21 563
>> 6249
>> Swap:  409528601235
>> 
> 
> The playbook is really stupid:
> 
> [meggleston@pc1uepsiadm01 playbooks]$ cat y.yml
> # $Id$
> # $Log$
>  
> # set cyberark to a known point
>  
> # :!ansible-playbook --syntax-check %
> # :!ansible-playbook --check --limit pc1uepsiadm01.res.prod.global %
> # :!ansible-playbook --limit pc1uepsiadm01.res.prod.global %
> # :!ansible-playbook %
>  
> ---
> - hosts: all
>   become: no
>   gather_facts: true
>  
>   vars:
> reportfile: 
> "/tmp/inventory-report-{{ansible_date_time.year}}{{ansible_date_time.month}}{{ansible_date_time.day}}.csv"
> uptime_host: "UNKNOWN"
>  
>   tasks:
> - name: "get the uptime"
>   command: uptime
>   register: uptime
>  
> - set_fact:
> uptime_host="{{uptime.stdout}}"
>   when: uptime is match("")
>  
> - name: "create the file and write the h

Re: [ansible-project] Getting an error...

2022-12-09 Thread Mike Eggleston
I don’t think it’s the “register”. I removed the “register” (and changed the 
value of “forks =“ by commenting it out so things don’t take so long) and the 
free memory still goes down:

while true; do date; free -m; sleep 60; done
Fri Dec  9 16:48:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782113815864  21 5756163
Swap:  409528581237
Fri Dec  9 16:49:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782113805864  21 5756164
Swap:  409528581237
Fri Dec  9 16:50:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   7821 6586586  21 5766886
Swap:  409528581237
Fri Dec  9 16:51:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   7821 8746369  21 5776670
Swap:  409528571238
Fri Dec  9 16:52:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782112465997  21 5766298
Swap:  409528571238
Fri Dec  9 16:53:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782112475996  21 5776297
Swap:  409528561239
Fri Dec  9 16:54:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782113045939  21 5776240
Swap:  409528561239
Fri Dec  9 16:55:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782113535889  21 5776190
Swap:  409528551240
Fri Dec  9 16:56:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782114145828  21 5776129
Swap:  409528551240
Fri Dec  9 16:57:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782114995743  21 5786044
Swap:  409528551240
Fri Dec  9 16:58:31 EST 2022
  totalusedfree  shared  buff/cache   available
Mem:   782120055237  21 5785538
Swap:  409528551240

My playbook is now:

[meggleston@pc1uepsiadm01 playbooks]$ cat y2.yml
# $Id$
# $Log$
 
# set cyberark to a known point
 
# :!ansible-playbook --syntax-check %
# :!ansible-playbook --check --limit pc1uepsiadm01.res.prod.global %
# :!ansible-playbook --limit pc1uepsiadm01.res.prod.global %
# :!ansible-playbook %
 
---
- hosts: all
  become: no
  gather_facts: true
 
  vars:
reportfile: 
"/tmp/inventory-report-{{ansible_date_time.year}}{{ansible_date_time.month}}{{ansible_date_time.day}}.csv"
uptime_host: "UNKNOWN"
 
  tasks:
- name: "get the uptime"
  command: uptime


> On Dec 9, 2022, at 15:44, Mike Eggleston  wrote:
> 
> I’ve set “forks = 1” and rerun my test which does an ansible-playbook and an 
> uptime.
> Could it be the register rather than a memory leak?
> Here free(1) keeps going down:
> 
>> [meggleston@pc1uepsiadm01 ~]$ while true
>> > do
>> > date
>> > free -m
>> > sleep 60
>> > done
>> Fri Dec  9 16:30:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111396190  18 490
>> 6408
>> Swap:  409528971198
>> Fri Dec  9 16:31:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111496127  19 544
>> 6398
>> Swap:  409528961199
>> Fri Dec  9 16:32:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111636112  19 544
>> 6383
>> Swap:  409528961199
>> Fri Dec  9 16:33:31 EST 2022
>>   totalusedfree  shared  buff/cache   
>> available
>> Mem:   782111736100  19 546
>> 6373
>> Swap:  409528961199
>> Fri Dec  9 

Re: [ansible-project] Getting an error...

2022-12-09 Thread Mike Eggleston
I’ve set “forks = 1” and rerun my test which does an ansible-playbook and an 
uptime.
Could it be the register rather than a memory leak?
Here free(1) keeps going down:

> [meggleston@pc1uepsiadm01 ~]$ while true
> > do
> > date
> > free -m
> > sleep 60
> > done
> Fri Dec  9 16:30:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782111396190  18 490
> 6408
> Swap:  409528971198
> Fri Dec  9 16:31:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782111496127  19 544
> 6398
> Swap:  409528961199
> Fri Dec  9 16:32:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782111636112  19 544
> 6383
> Swap:  409528961199
> Fri Dec  9 16:33:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782111736100  19 546
> 6373
> Swap:  409528961199
> Fri Dec  9 16:34:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782111846081  19 554
> 6362
> Swap:  409528951200
> Fri Dec  9 16:35:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112156042  20 562
> 6329
> Swap:  409528851210
> Fri Dec  9 16:36:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112256032  20 563
> 6319
> Swap:  409528841211
> Fri Dec  9 16:37:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112296028  20 563
> 6315
> Swap:  409528801215
> Fri Dec  9 16:38:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112575999  20 563
> 6287
> Swap:  409528611234
> Fri Dec  9 16:39:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112865971  21 563
> 6259
> Swap:  409528601235
> Fri Dec  9 16:40:31 EST 2022
>   totalusedfree  shared  buff/cache   
> available
> Mem:   782112955961  21 563
> 6249
> Swap:  409528601235
> 

The playbook is really stupid:

[meggleston@pc1uepsiadm01 playbooks]$ cat y.yml
# $Id$
# $Log$
 
# set cyberark to a known point
 
# :!ansible-playbook --syntax-check %
# :!ansible-playbook --check --limit pc1uepsiadm01.res.prod.global %
# :!ansible-playbook --limit pc1uepsiadm01.res.prod.global %
# :!ansible-playbook %
 
---
- hosts: all
  become: no
  gather_facts: true
 
  vars:
reportfile: 
"/tmp/inventory-report-{{ansible_date_time.year}}{{ansible_date_time.month}}{{ansible_date_time.day}}.csv"
uptime_host: "UNKNOWN"
 
  tasks:
- name: "get the uptime"
  command: uptime
  register: uptime
 
- set_fact:
uptime_host="{{uptime.stdout}}"
  when: uptime is match("")
 
- name: "create the file and write the header"
  lineinfile:
path="{{reportfile}}"
state="present"
insertafter="EOF"
create="true"
line="\"hostname\",\"uptime\""
  delegate_to: localhost
 
- name: "write the line for this host"
  lineinfile:
path="{{reportfile}}"
state="present"
insertafter="EOF"
create="true"
line="\"{{ansible_host}}\",\"{{uptime_host}}\""
  delegate_to: localhost


Mike


> On Dec 9, 2022, at 15:29, Mike Eggleston  wrote:
> 
> Does Ansible have a memory leak (that only shows up with a high number of 
> hosts)?
> 
> Mike
> 
> [meggleston@pc1uepsiadm01 ~]$ rpm -qa | grep -i ansible
> ansible-2.9.27-1.el7.noarch
> 
>> On Dec 9, 2022, at 09:16, Mike Eggleston > <mailto:mikeegg1...@gmail

Re: [ansible-project] Getting an error...

2022-12-09 Thread Mike Eggleston
Does Ansible have a memory leak (that only shows up with a high number of 
hosts)?

Mike

[meggleston@pc1uepsiadm01 ~]$ rpm -qa | grep -i ansible
ansible-2.9.27-1.el7.noarch

> On Dec 9, 2022, at 09:16, Mike Eggleston  wrote:
> 
> I changed forks = back to 5 (commented out my change) and still I get the out 
> of memory error. I removed all hosts that are in AWS so I’m not using the 
> proxy in ssh(1). My inventory is down to 4400 hosts. I wonder what’s eating 
> the memory…? Any ideas….?
> 
> Current stack trace:
> 82"]}, "sectors": "7812935680", "start": "2048", "holders": [], "size": "3.64 
> TB"}}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": 
> "RAID bus controller: Broadcom / LSI MegaRAID SAS-3 3108 [Invader] (rev 02)", 
> "sectorsize": "512", "removable": "0", "support_discard": "0", "model": "PERC 
> H730P Mini", "wwn": "0x61866da06192eb0024e6a07712d7ee30", "holders": [], 
> "size": "3.64 TB"}, "dm-4": {"scheduler_mode": "", "rotational": "1", 
> "vendor": null, "sectors": "104857600", "links": {"masters": [], "labels": 
> [], "ids": ["dm-name-rootvg-optvol", 
> "dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52yneJbOfXRJ6QddDY581MzfUj6Ai4MOtle8"],
>  "uuids": ["51166620-cd67-4954-8b5f-cf91926b036d"]}, "sas_device_handle": 
> null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
> "removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
> "holders": [], "size": "50.00 GB"}, "dm-5": {"scheduler_mode": "", 
> "rotational": "1", "vendor": null, "sectors": "62914560", "links": 
> {"masters": [], "labels": [], "ids": ["dm-name-rootvg-tmpvol", 
> "dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynDjjkCPQW51kaWpzKqwJkcPy2qbRW0Fxm"],
>  "uuids": ["38f0cd51-d7e1-4bca-a062-1b39ede2fed2"]}, "sas_device_handle": 
> null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
> "removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
> "holders": [], "size": "30.00 GB"}, "dm-2": {"scheduler_mode": "", 
> "rotational": "1", "vendor": null, "sectors": "125829120", "links": 
> {"masters": [], "labels": [], "ids": ["dm-name-rootvg-varvol", 
> "dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynRn8k3kCCl3ICeXjPbpYKBa1d9B7s2bhs"],
>  "uuids": ["5cb9ffc3-fd77-4906-98d7-edb27aa63f40"]}, "sas_device_handle": 
> null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
> "removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
> "holders": [], "size": "60.00 GB"}, "dm-3": {"scheduler_mode": "", 
> "rotational": "1", "vendor": null, "sectors": "8388608", "links": {"masters": 
> [], "labels": [], "ids": ["dm-name-rootvg-homevol", 
> "dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynVWpzyMe28x7F4igthHHVgvTM2K8ZI08R"],
>  "uuids": ["8627acb7-4c2b-4394-95d0-6a084066a23a"]}, "sas_device_handle": 
> null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
> "removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
> "holders": [], "size": "4.00 GB"}, "dm-0": {"scheduler_mode": "", 
> "rotational": "1", "vendor": null, "sectors": "8388608", "links": {"masters": 
> [], "labels": [], "ids": ["dm-name-rootvg-lv_swap"

Re: [ansible-project] Getting an error...

2022-12-09 Thread Mike Eggleston
I changed forks = back to 5 (commented out my change) and still I get the out 
of memory error. I removed all hosts that are in AWS so I’m not using the proxy 
in ssh(1). My inventory is down to 4400 hosts. I wonder what’s eating the 
memory…? Any ideas….?

Current stack trace:
82"]}, "sectors": "7812935680", "start": "2048", "holders": [], "size": "3.64 
TB"}}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": 
"RAID bus controller: Broadcom / LSI MegaRAID SAS-3 3108 [Invader] (rev 02)", 
"sectorsize": "512", "removable": "0", "support_discard": "0", "model": "PERC 
H730P Mini", "wwn": "0x61866da06192eb0024e6a07712d7ee30", "holders": [], 
"size": "3.64 TB"}, "dm-4": {"scheduler_mode": "", "rotational": "1", "vendor": 
null, "sectors": "104857600", "links": {"masters": [], "labels": [], "ids": 
["dm-name-rootvg-optvol", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52yneJbOfXRJ6QddDY581MzfUj6Ai4MOtle8"],
 "uuids": ["51166620-cd67-4954-8b5f-cf91926b036d"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "50.00 GB"}, "dm-5": {"scheduler_mode": "", 
"rotational": "1", "vendor": null, "sectors": "62914560", "links": {"masters": 
[], "labels": [], "ids": ["dm-name-rootvg-tmpvol", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynDjjkCPQW51kaWpzKqwJkcPy2qbRW0Fxm"],
 "uuids": ["38f0cd51-d7e1-4bca-a062-1b39ede2fed2"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "30.00 GB"}, "dm-2": {"scheduler_mode": "", 
"rotational": "1", "vendor": null, "sectors": "125829120", "links": {"masters": 
[], "labels": [], "ids": ["dm-name-rootvg-varvol", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynRn8k3kCCl3ICeXjPbpYKBa1d9B7s2bhs"],
 "uuids": ["5cb9ffc3-fd77-4906-98d7-edb27aa63f40"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "60.00 GB"}, "dm-3": {"scheduler_mode": "", 
"rotational": "1", "vendor": null, "sectors": "8388608", "links": {"masters": 
[], "labels": [], "ids": ["dm-name-rootvg-homevol", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynVWpzyMe28x7F4igthHHVgvTM2K8ZI08R"],
 "uuids": ["8627acb7-4c2b-4394-95d0-6a084066a23a"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "4.00 GB"}, "dm-0": {"scheduler_mode": "", "rotational": 
"1", "vendor": null, "sectors": "8388608", "links": {"masters": [], "labels": 
[], "ids": ["dm-name-rootvg-lv_swap", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynqqkyDshARxIJhfyP1hRtk5SrMN3BK79c"],
 "uuids": ["799e361d-7fee-4f6b-ae45-75d75f518985"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "4.00 GB"}, "dm-1": {"scheduler_mode": "", "rotational": 
"1", "vendor": null, "sectors": "41943040", "links": {"masters": [], "labels": 
[], "ids": ["dm-name-rootvg-rootvol", 
"dm-uuid-LVM-h8Zoe5OZiBjf9awu8HyY4OuQIIZK52ynPxpNeSPUUNGqorDA6GDRwK4jFcd9IzuW"],
 "uuids": ["798d9b72-8fc1-475f-92f0-0fad71bd3e5a"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "20.00 GB"}}, "ansible_user_uid": 2101067335, 
"ansible_ssh_host_key_dsa_public": 
"B3NzaC1kc3MAAACBAPPCrb44cIbwiG15T60D7doNgsOgwLOW4N76U3gvkeiJUafrLqGexH0XMMEwRhFnGGxckQGhgQE3O2ZKmlgTAYFG+qaCDBjHPGBIxKE9PcMO+enFTUYKHd4KY+xid9f3J4QnpauJZXoB4Et2GGwE0Q8fBJB7bLevybjAgAbMfM51FQCFf6SYNVwXyG0c1RYjCzeaLMB22wAAAIBm8je+yytTJ7DigfHYoleH4LrWKD0g0PeSBFVKG0snNlorhBtCGa5QIKwgR9OE+BNXQddwcqHf1jwmn54wcROWicNbdJFdIrDHHSnbzBm2tOkiNqovTLx92676L45uOZlBzNHi/bqOSzbSem9Piukn6pDu2XsfLmXfd4wz1Z3XagAAAIEA4B7lnz4xWwgjZCnX2oXiOPOOkVH2Xo7MG3YibLr8DnuK1L8n3m/pkX3WhAqrfw87OHECkCE3Kg4EPnXwW9FfNLR4YQnJBXWCU5IJ5M+HSOE5IDSTyNlj3HEs3SaGC0EU8APei7SvRc4k+TlonHu3m1XeKsB6yCNYZdtGhm5q4Ps=",
 "ansible_bios_date": "11/26/2019", "ansible_system_capabilities": [""]}}\r\n', 
'Connection to pc1udtlhhad561.prodc1.harmony.global closed.\r\n')
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=no -o 
ControlPersist=30s -o ConnectTimeout=15s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/e963c4e7ae 
pc1udtlhhad561.prodc1.harmony.global '/bin/sh -c '"'"'rm -f -r 

Re: [ansible-project] Getting an error...

2022-12-06 Thread Mike Eggleston
I’ve not changed “strategy”, but I did change “forks” from 5 to 50.
I have copied /etc/ansible.cfg to ~/.ansible.cfg and changed forks = 50, 
inventory = $HOME/src/ansible/inventory and log_path = /tmp/${USER}_ansible.log.

> On Dec 5, 2022, at 17:21, Todd Lewis  wrote:
> 
> Have you changed any defaults for "strategy" or "forks"?
> 
> Also I see your ssh is config'd for "-o ControlMaster=auto -o 
> ControlPersist=60s". I'm not sure how many hosts you're caching connections 
> for during any give 60 second window, or how much memory that would eat, but 
> it may be a significant factor.
> 
> On Monday, December 5, 2022 at 6:03:42 PM UTC-5 mikee...@gmail.com wrote:
> 5709
> 
> 
>> On Dec 5, 2022, at 15:56, Todd Lewis > > wrote:
>> 
> 
>> How many hosts are in your inventory?
>> 
>> On Monday, December 5, 2022 at 4:52:39 PM UTC-5 mikee...@gmail.com 
>>  wrote:
>> I’m getting: 
>> 
>> e/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/ > 
>> /dev/null 2>&1 && sleep 0'"'"'' 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
>> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
>> pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ 
>> > /dev/null 2>&1 && sleep 0'"'"'' 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  SSH: EXEC ssh -C -o ControlMaster=auto 
>> -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/754f3010c5 
>> pa2udtlhsql1023.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/
>>  > /dev/null 2>&1 && sleep 0'"'"'' 
>>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
>> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/09c53a2792 
>> pa2udtlhsql604.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263853.52-8164-79599240649234/ 
>> > /dev/null 2>&1 && sleep 0'"'"'' 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  SSH: EXEC ssh -C -o ControlMaster=auto 
>> -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/3301cea578 
>> pa2udtlhsql1020.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.15-8057-21113899783559/ 
>> > /dev/null 2>&1 && sleep 0'"'"'' 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
>> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
>> pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ 
>> > /dev/null 2>&1 && sleep 0'"'"'' 
>>  ESTABLISH SSH CONNECTION FOR USER: None 
>>  SSH: EXEC ssh -C -o ControlMaster=auto 
>> -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/a501b68168 
>> pa2udtlhsql1022.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
>> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.07-8072-136961495388876/
>>  > /dev/null 2>&1 && sleep 0'"'"'' 
>> ERROR! Unexpected Exception, this is probably a bug: [Errno 12] Cannot 
>> allocate memory 
>> the full traceback was: 
>> 
>> Traceback (most recent call last): 
>> File "/usr/bin/ansible-playbook", line 123, in  
>> exit_code = cli.run() 
>> File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 128, 
>> in run 
>> results = pbex.run() 
>> File 
>> "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", 
>> line 169, in run 
>> result = self._tqm.run(play=play) 
>> File 
>> "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", 
>> line 282, in run 
>> play_return = strategy.run(iterator, play_context) 
>> File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/linear.py", 
>> line 311, in run 
>> self._queue_task(host, task, 

Re: [ansible-project] Getting an error...

2022-12-05 Thread Mike Eggleston
5709

> On Dec 5, 2022, at 15:56, Todd Lewis  wrote:
> 
> How many hosts are in your inventory?
> 
> On Monday, December 5, 2022 at 4:52:39 PM UTC-5 mikee...@gmail.com wrote:
> I’m getting: 
> 
> e/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/ > 
> /dev/null 2>&1 && sleep 0'"'"'' 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
> pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/754f3010c5 
> pa2udtlhsql1023.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/09c53a2792 
> pa2udtlhsql604.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263853.52-8164-79599240649234/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/3301cea578 
> pa2udtlhsql1020.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.15-8057-21113899783559/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
> pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
>  ESTABLISH SSH CONNECTION FOR USER: None 
>  SSH: EXEC ssh -C -o ControlMaster=auto -o 
> ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
> PasswordAuthentication=no -o ConnectTimeout=10 -o 
> ControlPath=/home/meggleston/.ansible/cp/a501b68168 
> pa2udtlhsql1022.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
> /home/meggleston/.ansible/tmp/ansible-tmp-1670263852.07-8072-136961495388876/ 
> > /dev/null 2>&1 && sleep 0'"'"'' 
> ERROR! Unexpected Exception, this is probably a bug: [Errno 12] Cannot 
> allocate memory 
> the full traceback was: 
> 
> Traceback (most recent call last): 
> File "/usr/bin/ansible-playbook", line 123, in  
> exit_code = cli.run() 
> File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 128, in 
> run 
> results = pbex.run() 
> File 
> "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", 
> line 169, in run 
> result = self._tqm.run(play=play) 
> File 
> "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", 
> line 282, in run 
> play_return = strategy.run(iterator, play_context) 
> File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/linear.py", 
> line 311, in run 
> self._queue_task(host, task, task_vars, play_context) 
> File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/__init__.py", 
> line 390, in _queue_task 
> worker_prc.start() 
> File "/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py", 
> line 100, in start 
> return super(WorkerProcess, self).start() 
> File "/usr/lib64/python2.7/multiprocessing/process.py", line 130, in start 
> self._popen = Popen(self) 
> File "/usr/lib64/python2.7/multiprocessing/forking.py", line 121, in __init__ 
> self.pid = os.fork() 
> 
> When I run a stupid playbook with the command: anssible-playbook -vvv 1.yml 
> 
> for the playbook: 
> — 
> - hosts: all 
> become: yes 
> gather_facts: true 
> 
> tasks: 
> - name: “remove the file” 
> file: 
> path=/tmp/getspace.sh 
> state=absent 
> 
> I added the “-vvv” when 

[ansible-project] Getting an error...

2022-12-05 Thread Mike Eggleston
I’m getting:

e/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/ > 
/dev/null 2>&1 && sleep 0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ > 
/dev/null 2>&1 && sleep 0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/754f3010c5 
pa2udtlhsql1023.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263852.31-8085-175291763336523/ > 
/dev/null 2>&1 && sleep 0'"'"''
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/09c53a2792 
pa2udtlhsql604.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263853.52-8164-79599240649234/ > 
/dev/null 2>&1 && sleep 0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/3301cea578 
pa2udtlhsql1020.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263852.15-8057-21113899783559/ > 
/dev/null 2>&1 && sleep 0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/f012ac57b9 
pa2udtlhsql602.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263852.91-8148-50804275661258/ > 
/dev/null 2>&1 && sleep 0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/a501b68168 
pa2udtlhsql1022.prod.harmony.aws2 '/bin/sh -c '"'"'rm -f -r 
/home/meggleston/.ansible/tmp/ansible-tmp-1670263852.07-8072-136961495388876/ > 
/dev/null 2>&1 && sleep 0'"'"''
ERROR! Unexpected Exception, this is probably a bug: [Errno 12] Cannot allocate 
memory
the full traceback was:

Traceback (most recent call last):
 File "/usr/bin/ansible-playbook", line 123, in 
   exit_code = cli.run()
 File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 128, in 
run
   results = pbex.run()
 File "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", 
line 169, in run
   result = self._tqm.run(play=play)
 File 
"/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 
282, in run
   play_return = strategy.run(iterator, play_context)
 File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/linear.py", 
line 311, in run
   self._queue_task(host, task, task_vars, play_context)
 File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/__init__.py", 
line 390, in _queue_task
   worker_prc.start()
 File "/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py", 
line 100, in start
   return super(WorkerProcess, self).start()
 File "/usr/lib64/python2.7/multiprocessing/process.py", line 130, in start
   self._popen = Popen(self)
 File "/usr/lib64/python2.7/multiprocessing/forking.py", line 121, in __init__
   self.pid = os.fork()

When I run a stupid playbook with the command: anssible-playbook -vvv 1.yml

for the playbook:
—
- hosts: all
 become: yes
 gather_facts: true

 tasks:
   - name: “remove the file”
 file:
   path=/tmp/getspace.sh
   state=absent

I added the “-vvv” when the previous run told me to. Any ideas what’s going on 
(besides the obvious “out of memory”) and how to fix this?

Mike

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

Re: [ansible-project] Print output in tabular column format.

2022-11-16 Thread Mike Eggleston
I used the delegate to localhost to create a CSV report of inventory details. HTHMikeOn Nov 16, 2022, at 07:40, saravanan jothilingam  wrote:Thanks for this input.Could you please share one sample playbook code which does that? Appreciate your help!On Wed, Nov 16, 2022 at 5:43 PM 'Rowe, Walter P. (Fed)' via Ansible Project  wrote:




The command module runs the ping. It won't display the output you register in ping_result. You need a debug task if you want to see the result. If you want formatted output you may want to look at using a jinja2 template.


Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123



On Nov 15, 2022, at 11:11 PM, saravanan jothilingam  wrote:


We have around 300+ on-prem linux servers to manage its availability. We found ansible is one easy tool to manage it.


On Wed, Nov 16, 2022 at 9:20 AM Dick Visser  wrote:


Hi
What is the reason you need to use ansible for this?


On Wed, 16 Nov 2022 at 04:09, saravanan jothilingam  wrote:


Hi,
I need to get the ping status of all remote hosts and print its results in one neat tabular column format. Since I am a novice to ansible, I am looking for the appropriate playbook which does this. 


note - the below task doesnt give any clear output .
- name: check reachable hosts
  hosts: remote-hosts
  gather_facts: no
  tasks:
    - command: ping -c1 {{ inventory_hostname }}
      delegate_to: localhost
      register: ping_result

Thanks



saravanan



-- 
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/CAE7H9qoRWWw%3D1gbLETVztDvWrgC_hupW_X_7OxJWTAc70mRvSw%40mail.gmail.com.



-- 
Sent from Gmail Mobile


-- 
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/CAF8BbLZDyGa7VpRiQ5f1%3D%3Dup1CBb32pRDu_6vHULW_BOhNR%2BBA%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAE7H9qp9%3DiwQeekbLTHeBRZXqGntff19SxtqUfjVt4Z63_q0vg%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/AE75345F-80D8-43CB-BB4F-CEFBC41A9352%40nist.gov.




-- 
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/CAE7H9qpyudHd6k4x52fm1%2Bheh0fPzdPP1TycfNRAMc_LPjdUhg%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/782605B0-D5BA-459B-AB1D-A84019E4B08D%40gmail.com.


Re: [ansible-project] Forks?

2022-11-01 Thread Mike Eggleston
Great explanation. Thank you. MikeOn Nov 1, 2022, at 12:41, Matt Martz  wrote:With 16k hosts, it's possible that you never actually see the max 50 forks in use.  We've made some pretty big performance improvements to large host counts, but you might only see somewhere around 30 forks in use, maybe less, even though you have specified a higher count.The forking limitation is caused by having a high fork count, with a CPU (single CPU core) bound process.  Effectively, we have a single process that orchestrates forking, and processing results.  The more forks, the more CPU bound that process is.  The more hosts you have in inventory, the more CPU is used to calculate variables when spawning workers and processing results.Once the first sets of results start coming in, the process becomes busier, and is unable to process results and spawn new processes to keep the fork count up.  So what happens is results take longer to process, which delays spawning new workers, and before you reach the theoretical max of your 50 configured forks, other forks are exiting, and the process never gets back to the max.So ultimately, what you have to do is baseline your use case, and adjust forks to a more appropriate level.  Decrease forks, or split your inventory into smaller chunks, or do both.On Tue, Nov 1, 2022 at 12:28 PM Mike Eggleston <mikeegg1...@gmail.com> wrote:I’ll look at the docs you mention. My command is: ansible all -I list -m command -m ‘rpm -qa openssl’. Other than the forks setting and the log setting I’ve not changed the configuration. (forks = 50 and log = /tmp/${USER}-ansible.logMikeOn Nov 1, 2022, at 12:22, Andrew Latham <lath...@gmail.com> wrote:MikeThere are dedicated docs pages[1][2] for this topic. I must admit there is a fair bit of missing info in your query.So to recap what we know:* ~16k hosts* forks set to 50* unknown strategy* unknown config for async, throttle, serial and the other settings that can affect* unknown number of running ansible forks/processes on the control node* unknown if still polling for async* unknown other things as I am typing this in a hurry1. https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html2. https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.htmlOn Tue, Nov 1, 2022 at 10:48 AM Mike Eggleston <mikeegg1...@gmail.com> wrote:I have my forks set to 50 in ~/.Ansible.CTG and the forks setting seems to work for the first set of boxes, but doesn’t seem to work for the rest. I thought the forks setting would keep $forks connections going until all boxes in the inventory have been touched. 

Was I thinking wrong? (I’m running an ad hoc command on 16k boxes.)

Mike

-- 
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/1EB21F73-144F-4F43-A696-0BA08D4CB2BA%40gmail.com.
-- - Andrew "lathama" Latham -



-- 
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/CA%2Bqj4S-7xuwUmb02hjO2WbiVqr7PBbZgsoYm7tSMaheBxrO7wQ%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4D5A0D53-A4E5-450B-938F-BEA5DC69C3FF%40gmail.com.
-- Matt Martz@sivelsivel.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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-ZA8brU%3DCrVr7zp-NrimvhSw3RchZkznb6uZkiHSzESw%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9C826946-A6B0-40CA-B7ED-569E1B3D3B4D%40gmail.com.


Re: [ansible-project] Forks?

2022-11-01 Thread Mike Eggleston
I’ll look at the docs you mention. My command is: ansible all -I list -m command -m ‘rpm -qa openssl’. Other than the forks setting and the log setting I’ve not changed the configuration. (forks = 50 and log = /tmp/${USER}-ansible.logMikeOn Nov 1, 2022, at 12:22, Andrew Latham  wrote:MikeThere are dedicated docs pages[1][2] for this topic. I must admit there is a fair bit of missing info in your query.So to recap what we know:* ~16k hosts* forks set to 50* unknown strategy* unknown config for async, throttle, serial and the other settings that can affect* unknown number of running ansible forks/processes on the control node* unknown if still polling for async* unknown other things as I am typing this in a hurry1. https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html2. https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.htmlOn Tue, Nov 1, 2022 at 10:48 AM Mike Eggleston <mikeegg1...@gmail.com> wrote:I have my forks set to 50 in ~/.Ansible.CTG and the forks setting seems to work for the first set of boxes, but doesn’t seem to work for the rest. I thought the forks setting would keep $forks connections going until all boxes in the inventory have been touched. 

Was I thinking wrong? (I’m running an ad hoc command on 16k boxes.)

Mike

-- 
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/1EB21F73-144F-4F43-A696-0BA08D4CB2BA%40gmail.com.
-- - Andrew "lathama" Latham -



-- 
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/CA%2Bqj4S-7xuwUmb02hjO2WbiVqr7PBbZgsoYm7tSMaheBxrO7wQ%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4D5A0D53-A4E5-450B-938F-BEA5DC69C3FF%40gmail.com.


[ansible-project] Forks?

2022-11-01 Thread Mike Eggleston
I have my forks set to 50 in ~/.Ansible.CTG and the forks setting seems to work 
for the first set of boxes, but doesn’t seem to work for the rest. I thought 
the forks setting would keep $forks connections going until all boxes in the 
inventory have been touched. 

Was I thinking wrong? (I’m running an ad hoc command on 16k boxes.)

Mike

-- 
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/1EB21F73-144F-4F43-A696-0BA08D4CB2BA%40gmail.com.


Re: [ansible-project] create a file based on grep result

2022-10-21 Thread Mike Eggleston
>From memory and untested:

- name: “do grep to get a name”
  command:
cmd=“grep ssh {{pgconfiguration}}”
  register: grep

- name: “set the filename”
  setfact:
filename=grep.stdout

...

> On Oct 21, 2022, at 10:07, dulhaver via Ansible Project 
>  wrote:
> 
> I want to create a file based on a grep result of another file on the host
> It can be achieved with a shell TASK I believe ...
> 
>   - name: create 10-ssl.conf based on old postgresql.conf
> ansible.builtin.shell:
>   cmd: grep ssh /var/lib/pgsql/13/data/postgresql.conf > 
> /var/lib/pgsql/14/data/conf.d/10-ssl.conf
> 
> ... but am wondering whether there was a more anible-ish way to approach this
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0f7ab823-cc9d-b194-5b69-eb347578fcf7%40mailbox.org
>  
> .

-- 
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/8D334243-67EE-493B-AEEA-81CCF69054B4%40gmail.com.


Re: [ansible-project] ansible --check mode for shift left

2022-09-07 Thread Mike Eggleston
Try a dry run with —check on a remote host (—limit $HOST). I forgot, —check 
does a dry run. 

Mike

> On Sep 7, 2022, at 10:36, Steve Button  wrote:
> 
> Hi,
> 
> I'm trying to add some "shift left" to my Ansible, so that mistakes don't 
> creep in. Firstly, I thought I would run --check (perhaps as a git pre-commit 
> hook or perhaps in Jenkins pipeline eventually). So, I tried it locally. 
> Unfortunately it bombs out in several places, as some tasks are reliant on 
> the output of other tasks. Not a great problem, as I've added 
> 
> when: not ansible_check_mode
> 
> to those tasks. 
> 
> Is there a better way of achieving this? Particularly it would be useful to 
> check that variables are set to something sensible (catch typos or just 
> missed variables) BEFORE it goes into production. We have vars files based on 
> environments, so these don't get checked until we actually deploy to that 
> environment. 
> 
> 
> -- 
> 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/aa334744-9303-42ea-8017-58e2afd52719n%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/35EBBFA5-EB99-4BEC-AABE-B746AF0C681E%40gmail.com.


Re: [ansible-project] hostname variable inside of a file

2022-08-25 Thread Mike Eggleston
Are you doing this in a shell loop? Look at the -e option. 

Mike

> On Aug 25, 2022, at 13:04, Frederick  wrote:
> 
> Good Day!
> 
> I am very new to Ansible so I apologize. I am trying to make a playbook where 
> I push a file to the client host with the hostname/fqdn inside the file. For 
> example:
> 
> My file: cluster/files/etciscsi-initiatorname.iscsi
> 
> InitiatorName=iqn.1994-05.com.redhat:{|rhn.system.hostname|}
> 
> 
> Where {|rhn.system.hostname|} is replaced with the fqdn that the file is 
> being pushed to. I figured out how to get the ansible_fqdn from the 
> ansible_facts but i'm struggling beyond that.
> 
> 
> [root@walter tasks]# cat initiatorname.iscsi.yml 
> 
> ---
> - name: Copy configuration file
>   copy: src=files/etciscsi-initiatorname.iscsi 
> dest=/etc/iscsi/initiatorname.iscsi
> 
> 
> Thank you
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/c69e5b9a-144c-4234-a00d-23b3eaa13fben%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/89F4C894-3DC9-4180-B015-FA333652D43A%40gmail.com.


Re: [ansible-project] identation and spaces with lininfile

2022-07-20 Thread Mike Eggleston
Add spaces inside the double quote?

Mike

> On Jul 20, 2022, at 11:44, Tony Wong  wrote:
> 
> I am really stuck trying to insert a line with lineinfile with 5 space 
> indentation
> 
> any idea?
> 
> task is
> 
> - name: add line
> lineinfile:
> backup: no
> #backrefs: yes
> state: present
> path: "{{ file_path }}"
> #regexp: '^(\s*)[#]?{{ item.search }}(: )*'
> insertafter: "{{ line.replace_with }}"
> line: "\n{{ line.line_to_add }}"
> #line: '\1{{ item.search }}\2\n\1{{ item.add }}'
> with_items:
> - { search: "{{ line.replace_with }}", add: "{{ line.line_to_add }}" }
> -- 
> 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/96481aa3-abba-4448-a48c-3870e15a76f2n%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/1F17C409-5710-42AC-8225-8C507D4518C9%40gmail.com.


Re: [ansible-project] Passing a variable that is a list to a parameter that expects a list

2022-07-12 Thread Mike Eggleston
The balrog key could interfere with the Gandalf key. :)

Mike

> On Jul 12, 2022, at 15:54, Ben Coleman  wrote:
> 
> In a variables file, I have a series of ssh keys assigned to variables:
> 
> samwise_key: 'ssh-rsa.
> legolas_key: 'ssh-rsa
> gandalf_key: 'ssh-rsa.
> 
> I then have variable defined to be a list of said keys:
> 
> ssh_keys:
>  - "{{ samwise_key }}"
>  - "{{ legolas_key }}"
>  - "{{ gandalf_key }}"
> 
> The idea is to be able to set up such keys (which are used in multiple places 
> in my Ansible scripts) in one place, instead of having to put them in each 
> place they're used.
> 
> One of the places I need to use them is when creating a new linode.  The 
> linode_v4 module has a parameter authorized_keys, which expects a list.
> 
> I've got this set up as:
> 
> - name: Create a new linode
>  linode_v4:
>label: "{{ label }}.domainname.com
>type: g6-nanode-1
>region: us-southeast
>image: linode/ubuntu20.04
>root_pass: "yeah, like I'm going to include that in here"
>authorized_keys: "{{ ssh_keys }}"
>state: present
>  register: my_linode
> 
> 
> I believe this has worked in the past, but currently (under ansible 2.12.3), 
> when I run this, I'm getting:
> 
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to query the 
> Linode API.  Saw: authorized_keys must be either paths to the key files or a 
> list of raw public key of one of these types: ('ssh-dss', 'ssh-rsa', 
> 'ecdsa-sha2-nistp', 'ssh-ed25519')"}
> 
> If I copy the keys to an explicit list under authorized keys, like so:
> 
>authorized_keys:
>  - 'ssh-rsa..
>  - 'ssh-rsa..
>  - 'ssh-rsa..
> 
> it works, which seems to eliminate the possibility that I'm using a key type 
> that's not recognized (my actual list has more than ssh-rsa keys).
> 
> Which leaves me wondering: how do I pass this ssh_keys variable to the 
> authorized_keys parameter correctly?
> 
> Ben
> -- 
> Ben Coleman olo...@benshome.net | For the wise man, doing right trumps
> http://oloryn.benshome.net/ | looking right.  For the fool, looking
> Amateur Radio NJ8J  | right trumps doing right.
> 
> -- 
> 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/8e9e9524-33ba-3bcb-0d19-9ee9236bc675%40benshome.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/B7F63942-160C-4903-9450-19D6F0C6E184%40gmail.com.


OpenPGP_signature
Description: Binary data


Re: [ansible-project] Naming convention for remote user

2022-06-13 Thread Mike Eggleston
I’ve used fname (First letter first name and all of the last name) and “svc.” 
for service accounts.

Mike

> On Jun 13, 2022, at 13:50, Brian Coca  wrote:
> 
> There is no 'standard', just use the user name that you think best
> represents it's usage. 'ansible_user_for_automation' is taken though
> ;-)
> 
> 
> -- 
> --
> Brian Coca
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CACVha7dwbzZ-KCs2_6zLx7bVd5m6%2B-aMV3WSxzJYw7bWmHSujA%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/72E694E0-9E59-4510-9FA9-C02A2371E2C3%40gmail.com.


Re: [ansible-project] Run playbook against multiple hosts

2022-03-01 Thread Mike Eggleston
I must have missed something… why wouldn’t -i $FILE not work?

> On Mar 1, 2022, at 10:14, Stefan Hornburg (Racke)  wrote:
> 
> On 01/03/2022 16:51, Nitrous wrote:
>> I have defined my hosts in the variable file:
>> [servers]
>> server1 ansible_host=ip address of server 1
>> server2 ansible_host=ip address of server 2
>> etc
>> I have a playbook that looks like this:
>> - hosts: '{{ hostname }}'
>>   gather_facts: no
>>   tasks:
>>   - name: Include vars for vcenter
>> include_vars:
>> file: /etc/ansible/roles/createvm/vars/main.yml
>> name: vcenter
>> vars:
>>   ansible_become_password: "{{ domain_password }}"
>>   - name: Include vars of server.yaml file
>> include_vars:
>> file: /etc/ansible/servers/{{ hostname }}.yaml
>> name: server
>>   - name: Wait For Connection to Continue
>> wait_for_connection:
>>   connect_timeout: 30
>>   - name: Reboot to check for second round of updates
>> ansible.windows.win_reboot:
>>   msg: "Reboot to check for second round of updates"
>>   - import_role:
>>   name: windowsupdates
>> This playbook works fine if I run the command to specify 1 hostname:
>> ansible-playbook playbooks/file.yml -e "hostname=server1" -.
>> How can I run my file.yml against server1,server2 etc at the same time?
> 
> I suppose that -e "hostname=servers" should do the trick.
> 
> Regards
> Racke
> 
>> 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/adaee4d9-0c58-4d00-a355-eeb4fe8bdba2n%40googlegroups.com
>>  
>> .
> 
> 
> -- 
> Automation expert - Ansible and friends
> Linux administrator & Debian maintainer
> Perl Dancer & conference hopper
> 
> -- 
> 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/a89fe0ef-bf32-9d0e-7a1d-f0f9111b8d54%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/64AE13A5-41F8-49A8-8ACD-5723610A7EBE%40gmail.com.


Re: [ansible-project] Formatting date in Ansible

2021-12-16 Thread Mike Eggleston
I suggest you change the format to year, month then day. This format sorts 
naturally when you use ls(1).
(The command in vi(1) is :!cp -p % %.211216 (or whatever is the current date).)

Mike

> On Dec 16, 2021, at 08:25, Antony Stone  
> wrote:
> 
> On Thursday 16 December 2021 at 15:20:46, lift...@gmail.com wrote:
> 
>> I get that, but I want to show it as 10/13/2021.  How do I do that???
> 
> I would try strftime('%m/%d/%Y') provided you are happy with dates in the 
> first 
> 12 days of each month being highly ambiguous for an international audience.
> 
> 
> Antony.
> 
> -- 
> "There is no reason for any individual to have a computer in their home."
> 
> - Ken Olsen, President of Digital Equipment Corporation (DEC, later consumed 
> by Compaq, later merged with HP)
> 
>   Please reply to the list;
> please *don't* CC 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/75095ECC-4B9E-4F21-A99D-F18B34F1295D%40gmail.com.


Re: [ansible-project] A general question about looping

2021-12-13 Thread Mike Eggleston
Thank you to everyone. :)

Mike

> On Dec 13, 2021, at 07:11, Todd Lewis  wrote:
> 
>   - name: loop over beofulf nodes
> include_tasks: create-a-node.yml
> loop: "{{ range(0, 1000) | list }}"
> vars:
>   nodename: "{{ 'beofulfnode%03d' | format(item) }}"
> On Saturday, December 11, 2021 at 3:23:08 AM UTC-5 dick@geant.org wrote:
> Apparently the recommendation these days is to use the range filter:
> 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-sequence
>  
> 
> 
> On Fri, 10 Dec 2021 at 22:55, Todd Lewis  > wrote:
> It's something close to this, but "create-a-node.yml" isn't a playbook in 
> this case, but rather just a task file.
> 
> - name: loop over beofulf nodes
>   include_tasks: create-a-node.yml
>   with_sequence: start=000 end=999
>   vars:
> nodename: "beofulfnode{{ item }}"
> 
> On Friday, December 10, 2021 at 4:05:31 PM UTC-5 mikee...@gmail.com 
>  wrote:
> I know I can do this from a shell script. I wonder if I can do this in pure 
> Ansible. 
> I was thinking about clusters recently. I know I can use the VM module to 
> spin up a VM. 
> If I wanted 1,000 nodes, how would I loop inside Ansible for the nodes? 
> Using the shell I would do something like (not tested): 
> 
> for i in `seq 000 999` 
> do 
> ansible-playbook -e nodename=“beofulfnode$i” create-a-node.yml 
> done 
> 
> How to do this looping in pure Ansible? 
> 
> Mike
> 
> -- 
> 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/dedab6d9-0b77-4313-949e-7e495f32e086n%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/2578137e-ba7a-481a-82f2-67e5f694b293n%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/05B9DB39-A81F-49AE-A411-78B512468CD6%40gmail.com.


[ansible-project] A general question about looping

2021-12-10 Thread Mike Eggleston
I know I can do this from a shell script. I wonder if I can do this in pure 
Ansible.
I was thinking about clusters recently. I know I can use the VM module to spin 
up a VM.
If I wanted 1,000 nodes, how would I loop inside Ansible for the nodes?
Using the shell I would do something like (not tested):

for i in `seq 000 999`
do
ansible-playbook -e nodename=“beofulfnode$i” create-a-node.yml
done

How to do this looping in pure Ansible?

Mike

-- 
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/A6093B7A-C19D-4060-9320-A2F50540677B%40gmail.com.


Re: [ansible-project] Run shell script that needs user input

2021-12-08 Thread Mike Eggleston
You can also use the Ansible -e and use the variable is the script. 

Mike

> On Dec 8, 2021, at 16:28, Antony Stone  
> wrote:
> 
> On Wednesday 08 December 2021 at 23:23:10, Aleksandar Ilic wrote:
> 
>> Hello everyone,
>> 
>> I have been trying to find a solution to run a sh script via ansible but
>> the script requires users that run the script to enter username and
>> password.
>> 
>> Is it possible to pass those vars via ansible?
> 
> a) not unless the script supports it
> 
> b) you might try using 'expect' to see if that can pretend to be a user at a 
> keyboard.
> 
> Antony.
> 
> -- 
> "In fact I wanted to be John Cleese and it took me some time to realise that 
> the job was already taken."
> 
> - Douglas Adams
> 
>   Please reply to the list;
> please *don't* CC 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/C87050A0-499D-4D96-8AC0-3E0F23EDC862%40gmail.com.


Re: [ansible-project] Use Ansible variable in AWS Cloudformation template

2021-10-12 Thread Mike Eggleston
$ ansible-playbook -e variable=value

> On Oct 12, 2021, at 04:56, 'Tony' via Ansible Project 
>  wrote:
> 
> Hi,
> 
> I am trying to use an ansible variable in my AWS cloudformation template, see 
> below red where I am trying to use the variable from Ansible.
> 
> Parameters:
> 
> Environment:
> Description: 'Environment definition.'
> Type: 'String'
> Default: 'Dev'
> 
> Resources:
> 
> VPC:
> Type: 'AWS::EC2::VPC'
> Properties:
> CidrBlock:
>  "{{ ansible variable here }}"
> EnableDnsSupport: true
> EnableDnsHostnames: true
> InstanceTenancy: 'default'
> Tags:
> - Key: 'Environment'
>   Value:
>   Ref: 'Environment'
> 
> Does anyone know how to pass this on to Ansible?
> 
> Thank you!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/faae7897-90bd-41c0-9966-a5e459e80686n%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/9F6AC9EB-F469-4F35-9D7A-1A3B89507EF0%40gmail.com.


Re: [ansible-project] Trying to gather facts to write to local file on ansible server

2021-09-29 Thread Mike Eggleston
I’m over at FTC. Give me your email at NOAA and I’ll forward you the playbook I 
use.

> On Sep 29, 2021, at 15:12, 'Chris Bidwell - NOAA Federal' via Ansible Project 
>  wrote:
> 
> Hi all!
> 
> So this has worked at one point but is no longer.  
> 
> I'm trying to gather information on each of my rhel clients and write that 
> information to one file on my answer server.  
> 
> Here is my playbook:
> 
> ---
> - hosts: 'ALL_LINUX'
>   become: yes
>   become_method: sudo
>   vars_files:
> - passwd.yml
> - vars.yml
>
>   vars:
> - RHEL_INV: "/home/chris.bidwell/rhel_inventory"
> - VAR: "{{ hostvars[item].facter_virtual }}"
>
>   tasks:
> - name: Workstation or Server?
>   shell: cat /etc/redhat-release | awk '{print $5}'
>   register: rh_type
>   tags: name
>
> - name: Append to file
>   lineinfile:
> dest: "{{ RHEL_INV }}"
> line: "{{ ansible_default_ipv4.address }},{{ inventory_hostname }},{{ 
> ansible_default_ipv4.macaddress }},{{ansible_distribution }}, {{ 
> ansible_distribution_major_version }}, {{ rh_type.stdout }}"
> insertafter: EOF
> create: yes
>   delegate_to: localhost
>
> - debug:
> msg: "{{ ansible_default_ipv4.address }},{{ inventory_hostname }},{{ 
> ansible_default_ipv4.macaddress }},{{ ansible_distribution }} {{ 
> ansible_distribution_major_version }} {{ rh_type.stdout }}"
>   with_items: "{{ ansible_play_hosts }}"
> 
> Where my output is saying:
> chris.bidwell@atsb-swpc-pup-svr-lx:roles$ ap rhel_inventory.yml -K --limit 
> 'rhel8-base-lx'
> BECOME password: 
> 
> PLAY [ALL_LINUX] 
> **
> 
> TASK [Gathering Facts] 
> 
> ok: [rhel8-base-lx]
> 
> TASK [Make sure files exist] 
> **
> Sorry, try again.
> failed: [rhel8-base-lx] (item=/home/chris.bidwell/rhel.svr) => 
> {"ansible_loop_var": "item", "changed": false, "item": 
> "/home/chris.bidwell/rhel.svr", "module_stderr": "[sudo via ansible, 
> key=hkjseytyeuvgdyqbndymptpnvkghxbld] password:\nsudo: no password was 
> provided\nsudo: 1 incorrect password attempt\n", "module_stdout": "", "msg": 
> "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
> Sorry, try again.
> failed: [rhel8-base-lx] (item=/home/chris.bidwell/rhel.wkstn) => 
> {"ansible_loop_var": "item", "changed": false, "item": 
> "/home/chris.bidwell/rhel.wkstn", "module_stderr": "[sudo via ansible, 
> key=vhtrrvzwdhssvgmxrexsvvhxvzyonmeu] password:\nsudo: no password was 
> provided\nsudo: 1 incorrect password attempt\n", "module_stdout": "", "msg": 
> "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
> 
> PLAY RECAP 
> 
> rhel8-base-lx  : ok=1changed=0unreachable=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/CAHKi8CgdMkrnAeCarf5S1eJiigr%2B9orVj8RYRq2ttRxF%3DPrOnA%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/A72FC5EC-5EC2-4687-B70A-3FFABE39A470%40gmail.com.


[ansible-project] looping over users?

2021-08-17 Thread Mike Eggleston
Does someone have a playbook already that loops over users? I have to generate 
a report (I’ll give them a CSV file) of users, a description if I can and if 
the account has access to root (though sudo?)

TIA

Mike

-- 
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/AAA2FE31-9177-4E6C-B4D1-035F44B7AA28%40gmail.com.


Re: [ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
Well, I changed things around and used the shell module rather than the command 
module. I put “cd {{installdir}} ; sh {{script}}” in the playbook. The full 
playbook is here:

---
- hosts: linux
  gather_facts: yes
  become: yes
 
  vars:
file: "CarbonBlackLinuxInstaller-v6.3.4.10012-Default-Group-210309.tar.gz"
installdir: "/tmp/CarbonBlack-install"
script: "CarbonBlackClientSetup-linux-v6.3.4.10012.sh"
description: "install and start the Carbon Black Reponse agent"
 
  tasks:
- set_fact:
file="CarbonBlackLinuxDevelopment-210721.tar.gz"
script="b9install.sh"
  when: (ansible_host is match("hqd-") or ansible_host is 
match("unix-dev-") or ansible_host is match(".dev") or 
ansible_all_ipv4_addresses[0] is match ("192.168.60.")) == true
 
- name: "create {{installdir}}"
  file:
path="{{installdir}}"
mode="0755"
state="directory"
 
- name: "copy {{file}} to the {{ansible_host}}"
  copy:
src="../templates/{{file}}"
dest="{{installdir}}/{{file}}"
owner="root"
group="root"
mode="0644"
backup="yes"
 
- name: "extract {{file}}"
  unarchive:
src="../templates/{{file}}"
   dest="{{installdir}}"
 
- name: "run {{script}}"
  shell: "cd {{installdir}} ; sh {{script}}"
  register: x
 
#- debug: msg="pwd='{{x}}'"
 
#- fail: msg="doing this for testing"
 
- name: "delete {{installdir}}"
  file:
path: "{{installdir}}"
state: absent
 
- name: "update /ChangeLog - {{description}}"
  lineinfile:
path: /ChangeLog
regexp: "^changeme"
    line: "{{ansible_date_time.iso8601}} {{lookup('env', 'USER') | 
default('UNKNOWN', true)}} {{description}}"
insertafter: EOF
    create: yes
mode: 0644
backup: no

I just realized I don’t need “copy” and “unarchive”, so I’ll remove “copy” and 
test again.

> On Jul 23, 2021, at 10:22, Mike Eggleston  wrote:
> 
> Duh. Thank you. :)
> 
>> On Jul 23, 2021, at 10:16, Stefan Hornburg (Racke)  wrote:
>> 
>> On 23/07/2021 17:12, Mike Eggleston wrote:
>>> The file is on the remote host, as shown in the output below the error 
>>> message, but the error message does say the file for “unarchive” "on the 
>>> Ansible Controller”. Why is “unarchive” module looking on the Ansible 
>>> controller for the file?
>> 
>> It is all in the error message:
>> 
>> expect the file to exist on the remote, see the remote_src option
>> 
>> Works the same way as "copy" module does.
>> 
>> Regards
>>   Racke
>> 
>>>> On Jul 23, 2021, at 10:04, Mike Eggleston  wrote:
>>>> 
>>>> Below the error message I showed where the file does exist on the remote 
>>>> host.
>>>> 
>>>>> On Jul 23, 2021, at 10:01, Stefan Hornburg (Racke)  
>>>>> wrote:
>>>>> 
>>>>> On 23/07/2021 16:53, Mike Eggleston wrote:
>>>>>> I looked for a “tar” module; I had forgotten about “unarchive”. I have 
>>>>>> changed my playbook and the relevant changed sections are below. I still 
>>>>>> get an error:
>>>>> 
>>>>> "msg": "Could not find or access 
>>>>> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on 
>>>>> the Ansible Controller.\nIf you are using a module and expect the file to 
>>>>> exist on the remote, see the remote_src option"
>>>>> 
>>>>> What part of this error message is unclear?
>>>>> 
>>>>> Regards
>>>>>  Racke
>>>>> 
>>>>>> The changed sections of the playbook:
>>>>>>   - name: "copy {{file}} to the {{ansible_host}}"
>>>>>> copy:
>>>>>>   src="../templates/{{file}}"
>>>>>>   dest="{{installdir}}/{{file}}"
>>>>>>   owner="root"
>>>>>>   group="root"
>>>>>>   mode="0644"
>>>>>>   backup="yes"
>>>>>>   - name: "extract {{file}}"
>>>>>> unarchive:
>>>>>>   src="{{installdir}}/{{file}}"
>>>>>>  

Re: [ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
Duh. Thank you. :)

> On Jul 23, 2021, at 10:16, Stefan Hornburg (Racke)  wrote:
> 
> On 23/07/2021 17:12, Mike Eggleston wrote:
>> The file is on the remote host, as shown in the output below the error 
>> message, but the error message does say the file for “unarchive” "on the 
>> Ansible Controller”. Why is “unarchive” module looking on the Ansible 
>> controller for the file?
> 
> It is all in the error message:
> 
> expect the file to exist on the remote, see the remote_src option
> 
> Works the same way as "copy" module does.
> 
> Regards
>Racke
> 
>>> On Jul 23, 2021, at 10:04, Mike Eggleston  wrote:
>>> 
>>> Below the error message I showed where the file does exist on the remote 
>>> host.
>>> 
>>>> On Jul 23, 2021, at 10:01, Stefan Hornburg (Racke)  
>>>> wrote:
>>>> 
>>>> On 23/07/2021 16:53, Mike Eggleston wrote:
>>>>> I looked for a “tar” module; I had forgotten about “unarchive”. I have 
>>>>> changed my playbook and the relevant changed sections are below. I still 
>>>>> get an error:
>>>> 
>>>> "msg": "Could not find or access 
>>>> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on 
>>>> the Ansible Controller.\nIf you are using a module and expect the file to 
>>>> exist on the remote, see the remote_src option"
>>>> 
>>>> What part of this error message is unclear?
>>>> 
>>>> Regards
>>>>   Racke
>>>> 
>>>>> The changed sections of the playbook:
>>>>>- name: "copy {{file}} to the {{ansible_host}}"
>>>>>  copy:
>>>>>src="../templates/{{file}}"
>>>>>dest="{{installdir}}/{{file}}"
>>>>>owner="root"
>>>>>group="root"
>>>>>mode="0644"
>>>>>backup="yes"
>>>>>- name: "extract {{file}}"
>>>>>  unarchive:
>>>>>src="{{installdir}}/{{file}}"
>>>>>dest="{{installdir}}"
>>>>>  register: x
>>>>>- debug:
>>>>>msg="installdir='{{installdir}}' file='{{file}}' command='{{y}}' 
>>>>> unarchive='{{x}}"
>>>>>- fail: msg="doing fail for testing"
>>>>> Output from: ansible-playbook —limit had-dbora-s1 -vvv 
>>>>> carbonblackresponse.yml
>>>>> 2021-07-23 10:38:59,326 p=3699 u=meggleston n=ansible | TASK [extract 
>>>>> CarbonBlackLinuxDevelopment-210721.tar.gz] 
>>>>> **
>>>>> 2021-07-23 10:38:59,346 p=3751 u=meggleston n=ansible |  
>>>>> ESTABLISH SSH CONNECTION FOR USER: None
>>>>> 2021-07-23 10:38:59,347 p=3751 u=meggleston n=ansible |  
>>>>> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>>>>> KbdInteractiveAuthentication=no -o 
>>>>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>>>>> -o PasswordAuthentication=no -o ConnectTimeout=10 -o 
>>>>> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh 
>>>>> -c '"'"'( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo 
>>>>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" && echo 
>>>>> ansible-tmp-1627051139.35-3751-266795384375758="` echo 
>>>>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" ) && sleep 0'"'"''
>>>>> 2021-07-23 10:38:59,399 p=3751 u=meggleston n=ansible |  
>>>>> (0, 
>>>>> 'ansible-tmp-1627051139.35-3751-266795384375758=/tmp/ansible-tmp-1627051139.35-3751-266795384375758\n',
>>>>>  '')
>>>>> 2021-07-23 10:38:59,400 p=3751 u=meggleston n=ansible |  
>>>>> ESTABLISH SSH CONNECTION FOR USER: None
>>>>> 2021-07-23 10:38:59,401 p=3751 u=meggleston n=ansible |  
>>>>> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>>>>> KbdInteractiveAuthentication=no -o 
>>>>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>>>>> -o PasswordAuthentication=no -o ConnectTimeout=1

Re: [ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
The file is on the remote host, as shown in the output below the error message, 
but the error message does say the file for “unarchive” "on the Ansible 
Controller”. Why is “unarchive” module looking on the Ansible controller for 
the file?

> On Jul 23, 2021, at 10:04, Mike Eggleston  wrote:
> 
> Below the error message I showed where the file does exist on the remote host.
> 
>> On Jul 23, 2021, at 10:01, Stefan Hornburg (Racke)  wrote:
>> 
>> On 23/07/2021 16:53, Mike Eggleston wrote:
>>> I looked for a “tar” module; I had forgotten about “unarchive”. I have 
>>> changed my playbook and the relevant changed sections are below. I still 
>>> get an error:
>> 
>> "msg": "Could not find or access 
>> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the 
>> Ansible Controller.\nIf you are using a module and expect the file to exist 
>> on the remote, see the remote_src option"
>> 
>> What part of this error message is unclear?
>> 
>> Regards
>>   Racke
>> 
>>> The changed sections of the playbook:
>>>- name: "copy {{file}} to the {{ansible_host}}"
>>>  copy:
>>>src="../templates/{{file}}"
>>>dest="{{installdir}}/{{file}}"
>>>owner="root"
>>>group="root"
>>>mode="0644"
>>>backup="yes"
>>>- name: "extract {{file}}"
>>>  unarchive:
>>>src="{{installdir}}/{{file}}"
>>>dest="{{installdir}}"
>>>  register: x
>>>- debug:
>>>msg="installdir='{{installdir}}' file='{{file}}' command='{{y}}' 
>>> unarchive='{{x}}"
>>>- fail: msg="doing fail for testing"
>>> Output from: ansible-playbook —limit had-dbora-s1 -vvv 
>>> carbonblackresponse.yml
>>> 2021-07-23 10:38:59,326 p=3699 u=meggleston n=ansible | TASK [extract 
>>> CarbonBlackLinuxDevelopment-210721.tar.gz] 
>>> **
>>> 2021-07-23 10:38:59,346 p=3751 u=meggleston n=ansible |  
>>> ESTABLISH SSH CONNECTION FOR USER: None
>>> 2021-07-23 10:38:59,347 p=3751 u=meggleston n=ansible |  SSH: 
>>> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>>> KbdInteractiveAuthentication=no -o 
>>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>>> -o PasswordAuthentication=no -o ConnectTimeout=10 -o 
>>> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh 
>>> -c '"'"'( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo 
>>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" && echo 
>>> ansible-tmp-1627051139.35-3751-266795384375758="` echo 
>>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" ) && sleep 0'"'"''
>>> 2021-07-23 10:38:59,399 p=3751 u=meggleston n=ansible |  (0, 
>>> 'ansible-tmp-1627051139.35-3751-266795384375758=/tmp/ansible-tmp-1627051139.35-3751-266795384375758\n',
>>>  '')
>>> 2021-07-23 10:38:59,400 p=3751 u=meggleston n=ansible |  
>>> ESTABLISH SSH CONNECTION FOR USER: None
>>> 2021-07-23 10:38:59,401 p=3751 u=meggleston n=ansible |  SSH: 
>>> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>>> KbdInteractiveAuthentication=no -o 
>>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>>> -o PasswordAuthentication=no -o ConnectTimeout=10 -o 
>>> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh 
>>> -c '"'"'rm -f -r /tmp/ansible-tmp-1627051139.35-3751-266795384375758/ > 
>>> /dev/null 2>&1 && sleep 0'"'"''
>>> 2021-07-23 10:38:59,444 p=3751 u=meggleston n=ansible |  (0, 
>>> '', '')
>>> 2021-07-23 10:38:59,449 p=3699 u=meggleston n=ansible | fatal: 
>>> [hqd-dbora-n2]: FAILED! => {
>>>"changed": false,
>>>"msg": "Could not find or access 
>>> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the 
>>> Ansible Controller.\nIf you are using a module and expect the file to exist 
>>> on the remote, see the remote_src option"
>>> }
>>> 2021-07-23 10:38:59,450 p=3699 u=meggleston n=ansible | PLAY RECAP 
>>> ***

Re: [ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
Below the error message I showed where the file does exist on the remote host.

> On Jul 23, 2021, at 10:01, Stefan Hornburg (Racke)  wrote:
> 
> On 23/07/2021 16:53, Mike Eggleston wrote:
>> I looked for a “tar” module; I had forgotten about “unarchive”. I have 
>> changed my playbook and the relevant changed sections are below. I still get 
>> an error:
> 
>  "msg": "Could not find or access 
> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the 
> Ansible Controller.\nIf you are using a module and expect the file to exist 
> on the remote, see the remote_src option"
> 
> What part of this error message is unclear?
> 
> Regards
>Racke
> 
>> The changed sections of the playbook:
>> - name: "copy {{file}} to the {{ansible_host}}"
>>   copy:
>> src="../templates/{{file}}"
>> dest="{{installdir}}/{{file}}"
>> owner="root"
>> group="root"
>> mode="0644"
>> backup="yes"
>> - name: "extract {{file}}"
>>   unarchive:
>> src="{{installdir}}/{{file}}"
>> dest="{{installdir}}"
>>   register: x
>> - debug:
>> msg="installdir='{{installdir}}' file='{{file}}' command='{{y}}' 
>> unarchive='{{x}}"
>> - fail: msg="doing fail for testing"
>> Output from: ansible-playbook —limit had-dbora-s1 -vvv 
>> carbonblackresponse.yml
>> 2021-07-23 10:38:59,326 p=3699 u=meggleston n=ansible | TASK [extract 
>> CarbonBlackLinuxDevelopment-210721.tar.gz] 
>> **
>> 2021-07-23 10:38:59,346 p=3751 u=meggleston n=ansible |  
>> ESTABLISH SSH CONNECTION FOR USER: None
>> 2021-07-23 10:38:59,347 p=3751 u=meggleston n=ansible |  SSH: 
>> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>> KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c 
>> '"'"'( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo 
>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" && echo 
>> ansible-tmp-1627051139.35-3751-266795384375758="` echo 
>> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" ) && sleep 0'"'"''
>> 2021-07-23 10:38:59,399 p=3751 u=meggleston n=ansible |  (0, 
>> 'ansible-tmp-1627051139.35-3751-266795384375758=/tmp/ansible-tmp-1627051139.35-3751-266795384375758\n',
>>  '')
>> 2021-07-23 10:38:59,400 p=3751 u=meggleston n=ansible |  
>> ESTABLISH SSH CONNECTION FOR USER: None
>> 2021-07-23 10:38:59,401 p=3751 u=meggleston n=ansible |  SSH: 
>> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
>> KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
>> PasswordAuthentication=no -o ConnectTimeout=10 -o 
>> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c 
>> '"'"'rm -f -r /tmp/ansible-tmp-1627051139.35-3751-266795384375758/ > 
>> /dev/null 2>&1 && sleep 0'"'"''
>> 2021-07-23 10:38:59,444 p=3751 u=meggleston n=ansible |  (0, 
>> '', '')
>> 2021-07-23 10:38:59,449 p=3699 u=meggleston n=ansible | fatal: 
>> [hqd-dbora-n2]: FAILED! => {
>> "changed": false,
>> "msg": "Could not find or access 
>> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the 
>> Ansible Controller.\nIf you are using a module and expect the file to exist 
>> on the remote, see the remote_src option"
>> }
>> 2021-07-23 10:38:59,450 p=3699 u=meggleston n=ansible | PLAY RECAP 
>> 
>> 2021-07-23 10:38:59,451 p=3699 u=meggleston n=ansible | hqd-dbora-n2 
>>   : ok=4changed=0unreachable=0failed=1skipped=0
>> rescued=0ignored=0
>> Output of the directory showing the file is there:
>> [meggleston@hq-mgtlinux-s1 ~]$ ssh hqd-dbora-n2 ls -l /tmp 
>> /tmp/CarbonBlack-install 
>> /tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz ; date
>> -rw-r--r--.  1 root root 52643490 Jul 23 09:50 
&g

Re: [ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
I looked for a “tar” module; I had forgotten about “unarchive”. I have changed 
my playbook and the relevant changed sections are below. I still get an error:

The changed sections of the playbook:
- name: "copy {{file}} to the {{ansible_host}}"
  copy:
src="../templates/{{file}}"
dest="{{installdir}}/{{file}}"
owner="root"
group="root"
mode="0644"
backup="yes"
 
- name: "extract {{file}}"
  unarchive:
src="{{installdir}}/{{file}}"
dest="{{installdir}}"
  register: x
 
- debug:
msg="installdir='{{installdir}}' file='{{file}}' command='{{y}}' 
unarchive='{{x}}"
 
- fail: msg="doing fail for testing"

Output from: ansible-playbook —limit had-dbora-s1 -vvv carbonblackresponse.yml
2021-07-23 10:38:59,326 p=3699 u=meggleston n=ansible | TASK [extract 
CarbonBlackLinuxDevelopment-210721.tar.gz] 
**
2021-07-23 10:38:59,346 p=3751 u=meggleston n=ansible |  
ESTABLISH SSH CONNECTION FOR USER: None
2021-07-23 10:38:59,347 p=3751 u=meggleston n=ansible |  SSH: 
EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c 
'"'"'( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo 
/tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" && echo 
ansible-tmp-1627051139.35-3751-266795384375758="` echo 
/tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" ) && sleep 0'"'"''
2021-07-23 10:38:59,399 p=3751 u=meggleston n=ansible |  (0, 
'ansible-tmp-1627051139.35-3751-266795384375758=/tmp/ansible-tmp-1627051139.35-3751-266795384375758\n',
 '')
2021-07-23 10:38:59,400 p=3751 u=meggleston n=ansible |  
ESTABLISH SSH CONNECTION FOR USER: None
2021-07-23 10:38:59,401 p=3751 u=meggleston n=ansible |  SSH: 
EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c 
'"'"'rm -f -r /tmp/ansible-tmp-1627051139.35-3751-266795384375758/ > /dev/null 
2>&1 && sleep 0'"'"''
2021-07-23 10:38:59,444 p=3751 u=meggleston n=ansible |  (0, '', 
'')
2021-07-23 10:38:59,449 p=3699 u=meggleston n=ansible | fatal: [hqd-dbora-n2]: 
FAILED! => {
"changed": false,
"msg": "Could not find or access 
'/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the 
Ansible Controller.\nIf you are using a module and expect the file to exist on 
the remote, see the remote_src option"
}
2021-07-23 10:38:59,450 p=3699 u=meggleston n=ansible | PLAY RECAP 

2021-07-23 10:38:59,451 p=3699 u=meggleston n=ansible | hqd-dbora-n2
   : ok=4changed=0unreachable=0failed=1skipped=0rescued=0   
 ignored=0

Output of the directory showing the file is there:
[meggleston@hq-mgtlinux-s1 ~]$ ssh hqd-dbora-n2 ls -l /tmp 
/tmp/CarbonBlack-install 
/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz ; date
-rw-r--r--.  1 root root 52643490 Jul 23 09:50 
/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz
 
/tmp:
total 0
drwxr-xr-x. 2 root   root   55 Jul 23 09:50 CarbonBlack-install
 
/tmp/CarbonBlack-install:
total 51412
-rw-r--r--. 1 root root 52643490 Jul 23 09:50 
CarbonBlackLinuxDevelopment-210721.tar.gz
Fri Jul 23 10:42:39 EDT 2021

> On Jul 23, 2021, at 09:23, Stefan Hornburg (Racke)  wrote:
> 
> On 23/07/2021 16:07, Mike Eggleston wrote:
>> Seems like the module command: parameter isn’t working. Anyone have the same 
>> error?
> 
> Hello Mike,
> 
> the tar binary is probably missing in the $PATH Ansible is using. The $PATH 
> is most likely different compared to $PATH
> the interactive shell is using on the host.
> 
> Also consider to use the unarchive module instead.
> 
> Regards
> Racke
> 
>> playbook:
>> ---
>> - hosts: linux
>>   gather_facts: yes
>>   become: yes
>> vars:
>> file: 
>> "CarbonBlackLinuxInstaller-v6.3.4.10012-Default-Group-210309.tar.gz"
>> installdir: "/tmp/CarbonBlack-install"
>> script: "CarbonBlackClientSetup-linux-v6.3.

[ansible-project] Should be simple... Seems like command's chdir parameter doesn't work...

2021-07-23 Thread Mike Eggleston
Seems like the module command: parameter isn’t working. Anyone have the same 
error?

playbook:
---
- hosts: linux
  gather_facts: yes
  become: yes
 
  vars:
file: "CarbonBlackLinuxInstaller-v6.3.4.10012-Default-Group-210309.tar.gz"
installdir: "/tmp/CarbonBlack-install"
script: "CarbonBlackClientSetup-linux-v6.3.4.10012.sh"
description: "install and start the Carbon Black Reponse agent"
 
  tasks:
- set_fact:
file="CarbonBlackLinuxDevelopment-210721.tar.gz"
script="b9daemon.sh"
  when: (ansible_host is match("hqd-") or ansible_host is 
match("unix-dev-") or ansible_host is match(".dev") or 
ansible_all_ipv4_addresses[0] is match ("192.168.60.")) == true
 
- name: "create {{installdir}}"
  file:
path="{{installdir}}"
mode="0755"
state="directory"
 
- name: "copy {{file}} to the {{ansible_host}}"
  copy:
src="../templates/{{file}}"
dest="{{installdir}}"
owner="root"
group="root"
mode="0644"
backup="yes"
 
- name: "extract {{file}}"
  command:
cmd="tar -xzvf {{file}}"
chdir="{{installdir}}"
  register: x
 
- debug:
msg="installdir='{{installdir}}' file='{{file}}' shell='{{x}}"
 
- fail: msg="doing fail for testing"
 
- name: "run {{script}}"
  command:
cmd="sh {{script}}"
chdir="{{installdir}}"
 
- name: "delete {{installdir}}"
  file:
path: "{{installdir}}"
state: absent

output:
ansible-playbook --limit hqd-dbora-n2 carbonblackresponse.yml
 
PLAY [linux] 
**
 
TASK [Gathering Facts] 

ok: [hqd-dbora-n2]
 
TASK [set_fact] 
***
ok: [hqd-dbora-n2]
 
TASK [create /tmp/CarbonBlack-install] 

ok: [hqd-dbora-n2]
 
TASK [copy {{file}} to the {{ansible_host}}] 
**
ok: [hqd-dbora-n2]
 
TASK [extract CarbonBlackLinuxDevelopment-210721.tar.gz] 
**
fatal: [hqd-dbora-n2]: FAILED! => {"changed": false, "cmd": "'cmd=tar -xzvf 
CarbonBlackLinuxDevelopment-210721.tar.gz'", "msg": "[Errno 2] No such file or 
directory", "rc": 2}
 
PLAY RECAP 

hqd-dbora-n2   : ok=4changed=0unreachable=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/C76641E9-694B-4C64-BDB1-39A1BA803BBE%40gmail.com.


Re: [ansible-project] Owasp ZAP installation errors

2021-04-22 Thread Mike Eggleston
What’s the solution?

Mike

> On Apr 22, 2021, at 08:18, rebecca acheampong  wrote:
> 
> Thanks I have been able to work it out
> 
> On Thu, Apr 22, 2021 at 4:11 PM rebecca acheampong  > wrote:
> Hello Vadud, Please like what? How do i put the command in one line?
> I am sorry I don't quite understand 
> 
> On Thu, Apr 22, 2021 at 4:00 PM mailto:vad...@gmail.com>> 
> wrote:
> I would put the command in one line and run again. It looks like ansible 
> thinks there are two lines and confusing it with a YAML definition.
> 
> On Thu, Apr 22, 2021 at 8:55 AM rebecca acheampong  > wrote:
> I need help to install Owasp ZAP on Kali. I have this errors and I don't know 
> what to do to fix it. Thank you.
> 
> ERROR! Syntax Error while loading YAML.
>   could not find expected ':'
> 
> The error appears to be in 
> '/home/ansible/ansible-demo/kali_ansible/owas_zap.yml': line 34, column 23, 
> but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> api.disablekey=true -config api.addrs.addr.name 
> =.* -config
>   ^ here
> 
> There appears to be both 'k=v' shorthand syntax and YAML in this task. Only 
> one syntax may be used.
> 
> 
> This is my playbook:
> 
> --
> - name: setting up owasp zap container
>   hosts: zap
>   remote_user: "{{ remote_user_name }}"
>   gather_facts: no
>   become: yes
>   vars:
> remote_user_name: ubuntu
> owasp_zap_image_name: owasp/zap2docker-weekly
>   vars_files:
>  - var_zap.yml
> 
>   tasks:
> - vmware_guest:
> hostname: "{{ VMWARE_HOST}}"
> username: "{{ VMWARE_USER }}"
> password: "{{ VMWARE_PASSWORD }}"
> validate_certs: no
> folder: ha-datacenter/vm/
> name: "{{ item }}"
>   with_items:
> - my_vm_06
> - name: pulling {{ owasp_zap_image_name }} container
>   docker_image:
> name: "{{ owasp_zap_image_name }}"
> - name: running owasp zap container
>   docker_container:
> name: owasp-zap
> image: "{{ owasp_zap_image_name }}"
> interactive: yes
> state: started
>user: zap
> command: zap.sh -daemon -host 127.0.0.1 -port 8090 -config
> api.disablekey=true -config api.addrs.addr.name 
> =.* -config
> api.addrs.addr.regex=true
> ports:
>   - "8090:8090"
> 
> 
> 
> 
> -- 
> 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/e9980b1e-44b6-4d52-be0f-30c401217aa7n%40googlegroups.com
>  
> .
> 
> 
> -- 
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu 
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/vBcFIWk4inI/unsubscribe 
> .
> To unsubscribe from this group and all its topics, 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/CAOHBbgUUA4FUucBEnCLC9%2BpM2Zc0HGRHE58%2BC1v7D9SNKFoSTA%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-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAKQAy6rx4dO_ayQ0O7t%2BFrugyTEcwSnB45x-6iv9%2BDwiLQDiNg%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-project] import_playbook?

2021-03-24 Thread Mike Eggleston
I want to provision my servers. I have a provision-1.yml that is run as root 
and a provision-2.yml that is run as a regular user. The sub playbooks are 
individually tested. I did this once before, but I forget how I did it. How do 
I make a playbook of playbooks? This is what I’m trying:

---
- hosts: all
  gather_facts: no

  vars:
playbooks:
  - label: “SNMP”
playbook: “snmp.yml”
  - label: “cron”
playbook: “cron.yml"

tasks:
  - name: “{{item.label}}”
import_playbook: “{{item.playbook}}”
with_items: “{{playbooks}}"

-- 
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/46753A46-0945-49B0-8584-EBF5C3D0FF43%40gmail.com.


Re: [ansible-project] ssh root access remain closed

2021-03-17 Thread Mike Eggleston
The thing that works for me is:

$ ansible all -m command -a ’sudo uptime’ -o

I get no errors and I get a response from all my servers.

> On Mar 17, 2021, at 03:05, Michael Barber  wrote:
> 
> This is more of a Unix question than an ansible question.
> 
> Your login ID should not be root.
> Your sudo file ,on destination host, should have your login ID defined with 
> appropriate permissions.
> Use ssh keys for your login ID
> 
> Hope this helps.
> 
> On Wed, Mar 17, 2021 at 03:37 reredok  <mailto:rere...@gmail.com>> wrote:
> Hello,
> i tried everything possible with "become" in the playbook:
> 
> Either the password is wrong or a password is needed. 
> 
> To rule out that I have a problem with root, I temporarily set 
> PermitRootLogin Yes in /etc/ssh/sshd_config and then it works. 
> 
> I have looked at the ansible documentation which I may not understand in 
> full. Again for understanding: 
> 
> There is an "ansible_user" who connects remotely via ssh and I give him the 
> password in the "Inventory" with ansible_ssh_pass. In the "playbook" I set 
> "become: yes"," become_user: root", "become_method: sudo". This then changes 
> the ssh user to root and runs my "apt:" command. 
> 
> Do you have an example that works for you? Thanks a lot
> 
> 
> 
> dick@geant.org <mailto:dick@geant.org> schrieb am Dienstag, 16. März 
> 2021 um 21:22:36 UTC+1:
> Explained in detail here 
> https://docs.ansible.com/ansible/latest/user_guide/become.html 
> <https://docs.ansible.com/ansible/latest/user_guide/become.html>
> 
> On Tue, 16 Mar 2021 at 21:13, Mike Eggleston > wrote:
> Use “become”.
> 
> 
>> On Mar 16, 2021, at 14:54, reredok > wrote:
>> 
>> Hello all,
>> 
>> one thing is not clear to me about ansible. On all my Linux VM the root ssh 
>> access, for security reasons, is blocked. So the ad-hoc, playbook access 
>> only works via a non-administrative user. But then, for example, to install 
>> something on the Linux VM, how do you change the user to root? I don't want 
>> to work with ssh and public keys in my small environment and the root ssh 
>> access should remain closed.
>> Thanks for any feedback
>> 
>> reredok
>> 
>> -- 
>> 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/869e69b8-67b2-475d-b06a-10f287d54de2n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/869e69b8-67b2-475d-b06a-10f287d54de2n%40googlegroups.com?utm_medium=email_source=footer>.
> 
> 
> -- 
> 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/33BF877F-88A3-48B1-ABD4-67A701B2AA38%40gmail.com
>  
> <https://groups.google.com/d/msgid/ansible-project/33BF877F-88A3-48B1-ABD4-67A701B2AA38%40gmail.com?utm_medium=email_source=footer>.
> 
> -- 
> 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 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/d2404f8c-8626-4bd8-88d6-4dd9f7a9a143n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/d2404f8c-8626-4bd8-88d6-4dd9f7a9a143n%40googlegroups.com?utm_medium=email_source=footer>.
> -- 
> Thanks,
> MJ Barber
> 
> -- 
> 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 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAFVMVpmxULgBkCAD3QfrqV5%2BGnY02y4ru_4%3DhH%2BqPz-e3K-Guw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/ansible-project/CAFVMVpmxULgBkCAD3QfrqV5%2BGnY02y4ru_4%3DhH%2BqPz-e3K-Guw%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
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/DC1D41B9-96ED-4298-BCCD-60C79D618DB1%40gmail.com.


Re: [ansible-project] ssh root access remain closed

2021-03-16 Thread Mike Eggleston
Use “become”.

> On Mar 16, 2021, at 14:54, reredok  wrote:
> 
> Hello all,
> 
> one thing is not clear to me about ansible. On all my Linux VM the root ssh 
> access, for security reasons, is blocked. So the ad-hoc, playbook access only 
> works via a non-administrative user. But then, for example, to install 
> something on the Linux VM, how do you change the user to root? I don't want 
> to work with ssh and public keys in my small environment and the root ssh 
> access should remain closed.
> Thanks for any feedback
> 
> reredok
> 
> -- 
> 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/869e69b8-67b2-475d-b06a-10f287d54de2n%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/33BF877F-88A3-48B1-ABD4-67A701B2AA38%40gmail.com.


Re: [ansible-project] intersection of groups in inventory

2021-02-19 Thread Mike Eggleston
Works great. Thank you!

Mike

> On Feb 19, 2021, at 12:32, Rich Megginson  wrote:
> 
> Something like this? 
> https://docs.ansible.com/ansible/2.9/user_guide/intro_patterns.html#common-patterns
> 
> On 2/19/21 11:15 AM, Mike Eggleston wrote:
>> Hi,
>> 
>> In my inventory file I have “[linux]” and “[development]” groups. I want to 
>> patch the intersection of those groups. I know for one I can 
>> “ansible-playbook —limit linux patching.yml”, but how do I do the 
>> intersection?
>> 
>> Mike
>> 
> 
> -- 
> 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/d4cdad7a-a11d-7f25-c9e2-66a9c91d9f98%40redhat.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/E8FC1C0C-C72C-43F2-AA40-AE337BA9973F%40gmail.com.


[ansible-project] intersection of groups in inventory

2021-02-19 Thread Mike Eggleston
Hi,

In my inventory file I have “[linux]” and “[development]” groups. I want to 
patch the intersection of those groups. I know for one I can “ansible-playbook 
—limit linux patching.yml”, but how do I do the intersection?

Mike

-- 
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/D609CE48-205B-4CFE-9C83-A7F5F56EDF99%40gmail.com.


Re: [ansible-project] AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_all_ipv4_addresses'"

2021-01-30 Thread Mike Eggleston
I don’t mind at all. :)

—
- hosts: all
  gather_facts: yes

  vars:
ip0: “”
ip1: “”
ip2: “”

  tasks:
- set_fact:
ip0: “{{ansible_all_ipv4_addressess[0]}}”
  when: ansible_all_ipv4_addresses[0] is defined

And the same for 1 and 2.

Mike

> On Jan 30, 2021, at 09:13, Aris Aguirre  wrote:
> 
> DO you mind showing me, Is this a new problem?
> 
> On Friday, January 29, 2021 at 5:28:09 PM UTC-6 mikee...@gmail.com wrote:
> I just solved this for me today. I’m away from work so I can’t copy my code. 
> I created ip0, ip1 and ip2 in vars, set gather facts and did a set facts 
> using a when is defined. 
> 
> Mike
> 
>> On Jan 29, 2021, at 16:18, Aris Aguirre > > wrote:
>> 
>> 
> 
>> NO funky it is just not working if it is being user in FOR LOOP. As ive 
>> said..its working fine in Jinja template or 2.3 2.7. But its not workin in 
>> the for loop like before.
>> 
>> ansible dev -m setup |grep -i ipv4
>> "ansible_all_ipv4_addresses": [
>> "ansible_default_ipv4": {
>> "tx_checksum_ipv4": "off [fixed]",
>> "ipv4": {
>> "tx_checksum_ipv4": "off [fixed]",
>> "tx_checksum_ipv4": "off [fixed]",
>> "ipv4": {
>> 
>> 
>> 
>> On Friday, January 29, 2021 at 2:34:17 PM UTC-6 raub...@gmail.com 
>>  wrote:
>> On Fri, Jan 29, 2021 at 10:46 AM Aris Aguirre > wrote: 
>> > 
>> > Below is working when I was still using ansible 2.3 or maybe 2.7 But no 
>> > longer ansible 2.8 or 2.9. Please be advise no matter what it is not 
>> > working. 
>> > Thanks 
>> > 
>> > {% for host in groups.all %} 
>> > {{ hostvars[host]['ansible_all_ipv4_addresses'][0] }} {{ 
>> > hostvars[host]['ansible_fqdn'] }} {{ 
>> > hostvars[host]['inventory_hostname_short'] }} 
>> > {% endfor %} 
>> > 
>> > Below is the actual error. 
>> > 
>> > FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 
>> > 'ansible.vars.hostvars.HostVarsVars object' has no attribute 
>> > 'ansible_all_ipv4_addresses'"} 
>> > 
>> Something else might be funky there: 
>> 
>> raub@desktop:~/dev/ansible$ ansible dns2 -m setup |grep -i ipv4 
>> "ansible_all_ipv4_addresses": [ 
>> "ansible_default_ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> raub@desktop:~/dev/ansible$ ansible --version 
>> ansible 2.9.17 
>> config file = /home/raub/dev/ansible/ansible.cfg 
>> configured module search path = 
>> [u'/home/raub/.ansible/plugins/modules', 
>> u'/usr/share/ansible/plugins/modules'] 
>> ansible python module location = /usr/lib/python2.7/dist-packages/ansible 
>> executable location = /usr/bin/ansible 
>> python version = 2.7.12 (default, Oct 5 2020, 13:56:01) [GCC 5.4.0 20160609] 
>> raub@desktop:~/dev/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/0bc08e12-07aa-4df5-854c-4bcba9324605n%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-proje...@googlegroups.com 
>> .
> 
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/9e77fa1d-66b5-4959-a933-01cea5110053n%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/f1053ed2-8a14-42d1-ae13-191758235a60n%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/59FCD0D4-959D-4E82-BE70-BA0C8BC30998%40gmail.com.


Re: [ansible-project] AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_all_ipv4_addresses'"

2021-01-29 Thread Mike Eggleston
I just solved this for me today. I’m away from work so I can’t copy my code. I 
created ip0, ip1 and ip2 in vars, set gather facts and did a set facts using a 
when is defined. 

Mike

> On Jan 29, 2021, at 16:18, Aris Aguirre  wrote:
> 
> 
> NO funky it is just not working if it is being user in FOR LOOP. As ive 
> said..its working fine in Jinja template or 2.3 2.7. But its not workin in 
> the for loop like before.
> 
> ansible dev -m setup |grep -i ipv4
> "ansible_all_ipv4_addresses": [
> "ansible_default_ipv4": {
> "tx_checksum_ipv4": "off [fixed]",
> "ipv4": {
> "tx_checksum_ipv4": "off [fixed]",
> "tx_checksum_ipv4": "off [fixed]",
> "ipv4": {
> 
> 
> 
>> On Friday, January 29, 2021 at 2:34:17 PM UTC-6 raub...@gmail.com wrote:
>> On Fri, Jan 29, 2021 at 10:46 AM Aris Aguirre  wrote: 
>> > 
>> > Below is working when I was still using ansible 2.3 or maybe 2.7 But no 
>> > longer ansible 2.8 or 2.9. Please be advise no matter what it is not 
>> > working. 
>> > Thanks 
>> > 
>> > {% for host in groups.all %} 
>> > {{ hostvars[host]['ansible_all_ipv4_addresses'][0] }} {{ 
>> > hostvars[host]['ansible_fqdn'] }} {{ 
>> > hostvars[host]['inventory_hostname_short'] }} 
>> > {% endfor %} 
>> > 
>> > Below is the actual error. 
>> > 
>> > FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 
>> > 'ansible.vars.hostvars.HostVarsVars object' has no attribute 
>> > 'ansible_all_ipv4_addresses'"} 
>> > 
>> Something else might be funky there: 
>> 
>> raub@desktop:~/dev/ansible$ ansible dns2 -m setup |grep -i ipv4 
>> "ansible_all_ipv4_addresses": [ 
>> "ansible_default_ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> "tx_checksum_ipv4": "off [fixed]", 
>> "ipv4": { 
>> raub@desktop:~/dev/ansible$ ansible --version 
>> ansible 2.9.17 
>> config file = /home/raub/dev/ansible/ansible.cfg 
>> configured module search path = 
>> [u'/home/raub/.ansible/plugins/modules', 
>> u'/usr/share/ansible/plugins/modules'] 
>> ansible python module location = /usr/lib/python2.7/dist-packages/ansible 
>> executable location = /usr/bin/ansible 
>> python version = 2.7.12 (default, Oct 5 2020, 13:56:01) [GCC 5.4.0 20160609] 
>> raub@desktop:~/dev/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/0bc08e12-07aa-4df5-854c-4bcba9324605n%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/9e77fa1d-66b5-4959-a933-01cea5110053n%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/8D858536-AC3A-4455-8FEE-8DD93E54591E%40gmail.com.


Re: [ansible-project] hosts syntax?

2020-11-12 Thread Mike Eggleston
Duh, thank you.

Mike

> On Nov 12, 2020, at 11:01, Brian Coca  wrote:
> 
> You need something to negate
> 
> hosts: all:!A:!B
> 
> 
> FYI all hosts are always in at least 2 groups,  'all' being always one
> of them, if no other group is assigned 'ungrouped' becomes the 2nd.
> -- 
> --
> Brian Coca
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CACVha7d6zdXHm9cDQXp-ygUU4qaNeu%3DF2JX0xUS-8qwh7bsgNg%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/DB2F4632-A51B-4994-8AE7-411A47D95D29%40gmail.com.


[ansible-project] hosts syntax?

2020-11-12 Thread Mike Eggleston
Normally in my playbooks I say “hosts: all”. For a new playbook I want to say 
“hosts: !A,!B”, but that is not a valid syntax. What is the syntax to exclude 
two hosts (not in a group)?

Mike

-- 
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/0657E76E-5A67-409C-88D9-7F671F387F11%40gmail.com.


Re: [ansible-project] ansible taking a really long time

2020-10-21 Thread Mike Eggleston
This morning the command “ansible all -m ping” took 34 seconds and my 
“standard” command “audible all -m command -a uptime -o” took 15 seconds. Maybe 
it was a fluke. Thank you Joseph for answering. I’ll monitor throughout the day.

Mike

> On Oct 20, 2020, at 17:32, Mike Eggleston  wrote:
> 
> Inventory is static and I’ll run the command when I back online. :)
> 
> Mike
> 
>> On Oct 20, 2020, at 16:36, Joseph Alexander  
>> wrote:
>> 
>> 
>> two questions:
>> 
>> is your inventory dynamic? Is it running a script to fetch and create it 
>> each time?
>> second, what about running: ansible all -m ping
>> does that also take ~31 minutes to return?
>> 
>> 
>> On Tue, Oct 20, 2020 at 5:22 PM mikee...@gmail.com 
>> <mailto:mikee...@gmail.com> > <mailto:mikeegg1...@gmail.com>> wrote:
>> When I run: $ ansible all -m command -a uptime -o
>> for 97 hosts (Solaris and GNU/Linux) the command (just ran) takes 31 minutes.
>> 
>> How can I find where the time is being spent?
>> I have a custom ~/.ansible.cfg that specifies my inventory and “remote_tmp = 
>> $HOME/.ansible/tmp” (to get around a Solaris issue).
>> I have environment variables of ANSIBLE_INVENTORY and ANSIBLE_LOG_PATH. I’m 
>> running this on a RHEL 7 box that is idle.
>> 
>> TIA
>> 
>> Mike
>> 
>> -- 
>> 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 
>> <mailto:ansible-project+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/6082c936-bc96-4152-80b8-994c8fb31a04n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/6082c936-bc96-4152-80b8-994c8fb31a04n%40googlegroups.com?utm_medium=email_source=footer>.
>> 
>> -- 
>> 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 
>> <mailto:ansible-project+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CANhJoDyUx%2BqqYS3NSwx816ce9Qyu8i9R58p3OH7qfaPTzfs%3DvQ%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/CANhJoDyUx%2BqqYS3NSwx816ce9Qyu8i9R58p3OH7qfaPTzfs%3DvQ%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
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/C6B60EF1-FC0F-43A9-8C07-4CB584109DB2%40gmail.com.


Re: [ansible-project] ansible taking a really long time

2020-10-20 Thread Mike Eggleston
Inventory is static and I’ll run the command when I back online. :)

Mike

> On Oct 20, 2020, at 16:36, Joseph Alexander  
> wrote:
> 
> 
> two questions:
> 
> is your inventory dynamic? Is it running a script to fetch and create it each 
> time?
> second, what about running: ansible all -m ping
> does that also take ~31 minutes to return?
> 
> 
>> On Tue, Oct 20, 2020 at 5:22 PM mikee...@gmail.com  
>> wrote:
>> When I run: $ ansible all -m command -a uptime -o
>> for 97 hosts (Solaris and GNU/Linux) the command (just ran) takes 31 minutes.
>> 
>> How can I find where the time is being spent?
>> I have a custom ~/.ansible.cfg that specifies my inventory and “remote_tmp = 
>> $HOME/.ansible/tmp” (to get around a Solaris issue).
>> I have environment variables of ANSIBLE_INVENTORY and ANSIBLE_LOG_PATH. I’m 
>> running this on a RHEL 7 box that is idle.
>> 
>> TIA
>> 
>> Mike
>> -- 
>> 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/6082c936-bc96-4152-80b8-994c8fb31a04n%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/CANhJoDyUx%2BqqYS3NSwx816ce9Qyu8i9R58p3OH7qfaPTzfs%3DvQ%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/675AA0DE-254C-4CF5-9207-EA3D02A4B501%40gmail.com.


Re: [ansible-project] Ansible output customize

2020-09-18 Thread Mike Eggleston
I was only concerned with unix and would use this ad-hoc command:
$ ansible all -m command -a uptime -o

> On Sep 18, 2020, at 13:21, madan gopal  wrote:
> 
> Hi Praveen,
> 
> I am looking for a script to take user input and provide system uptime for 
> both Windows and Linux environments.
> 
> Any assistance with this playbook is greatly appreciated.
> 
> Regards,
> Madan
> 
> On Wednesday, March 4, 2020 at 2:12:10 AM UTC+5:30 prave...@gmail.com wrote:
> Hi Team
> I have written a playbook and using debug variable we are reading the output 
> in multiple play. Is there any way we can customize the output of each 
> registered variable and print it nicely formatted . Any suggestion would be 
> appreciated
> 
> Thx
> 
> 
> 
> -- 
> 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/9b3c09f7-0010-4fd3-a78c-7551c74c4b02n%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/7185F3AF-3D7B-429E-9693-CD340A3746FE%40gmail.com.


Re: [ansible-project] copy file to host not in inventory

2020-09-01 Thread Mike Eggleston
Could use ansible-playbook -i 

Mike

> On Sep 1, 2020, at 14:13, William Dossett  wrote:
> 
> 
> In the end I just used command: scp   seems to work adequately
>  
> Regards
> Bill
>  
> From: "ansible-project@googlegroups.com"  
> on behalf of "william...@gmail.com" 
> Reply-To: "ansible-project@googlegroups.com" 
> 
> Date: Tuesday, September 1, 2020 at 9:56 AM
> To: Ansible Project 
> Subject: [ansible-project] copy file to host not in inventory
>  
> Hi, sorry, I can't quite get my head around the last bit of my playbook.
>  
> I have a playbook that is doing ssh key rotations - it is pretty much all 
> working other than once it has generated the keys and used authorized_keys 
> module to put them on the hosts in the inventory, I want to copy the keys 
> back to my workstation.  Then it deletes the keys to cleanup.  I use 
> delegate_to and run_once when creating the keys, but how do I copy the keys 
> to my workstation which is not in my inventory - I am using dynamic 
> inventories in AWX... this isn't something I have run into before, I will 
> have to use a command worst case I guess, but welcome any alternative 
> suggestions.
>  
> thanks
> Bill
>  
> -- 
> 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/eb6c28eb-114b-445b-bd74-9359d1e78673n%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/DM6PR04MB50198329B9961486960564C1A32E0%40DM6PR04MB5019.namprd04.prod.outlook.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/8AE9CEB9-C213-41D0-80AD-662598D92FF3%40gmail.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.


Re: [ansible-project] Retrieving a document to a unique name?

2020-03-06 Thread Mike Eggleston
Thank you. That’s what I needed. 

Mike

> On Mar 2, 2020, at 19:07, Vladimir Botka  wrote:
> 
> On Mon, 2 Mar 2020 14:41:28 -0600
> Mike Eggleston  wrote:
> 
>> I will write a program that looks for network devices on its local network
>> and created a report of the findings. That’s easy. Using Ansible to push
>> out the program and execute the program is easy. But how do I pull the
>> report back to a unique name? For example the report is created
>> as /tmp/report. I want to pull that file back to a file
>> named /tmp/report-network.txt. What module do I use to pullback the file?
>> The fetch module?
> 
> "fetch" module is a good choice to pull the report back to a unique name. The
> unique name will be automatically created by the module. Quoting:
> 
>  "...default behavior of appending hostname/path/to/file to the
>  destination ... retrieving files that are uniquely named per host."
> 
> This behaviour can be switched off by "flat: true".
> https://docs.ansible.com/ansible/latest/modules/fetch_module.html#parameters
> 
> HTH,
> 
>-vlado

-- 
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/01FAE291-7473-4130-9ACD-0EA80294DDFE%40gmail.com.


[ansible-project] Retrieving a document to a unique name?

2020-03-02 Thread Mike Eggleston
I will write a program that looks for network devices on its local network and 
created a report of the findings. That’s easy. Using Ansible to push out the 
program and execute the program is easy. But how do I pull the report back to a 
unique name? For example the report is created as /tmp/report. I want to pull 
that file back to a file named /tmp/report-network.txt. What module do I use to 
pullback the file? The fetch module?

TIA

Mike

-- 
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/B9003416-50F8-4763-9354-5050F597FF65%40gmail.com.


[ansible-project] Re: error using "become"?

2019-09-18 Thread Mike Eggleston
Matt, thanks for your help.

Mike

-- 
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/af9f22ae-ac70-4cf9-a2fc-ce9a52862a7c%40googlegroups.com.


[ansible-project] Re: error using "become"?

2019-09-18 Thread Mike Eggleston
Sudo is too old.
This works:

---
- hosts: appsrv98

  tasks:
- name: test (1/2)
  command: uptime

- name: test (2/2)
  command: uptime
  become: true
  become_flags: -H -S

-- 
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/bcab8adb-cfa5-41d8-9146-76fd69e13150%40googlegroups.com.


Re: [ansible-project] Re: error using "become"?

2019-09-18 Thread Mike Eggleston
That's an interesting thought.
Ansible isn't required on the remote machine; python is though.
Here's on the remote machine:

DEV App Server 98
appsrv98:meggle1:/home/meggle1> rpm -qi ansible
package ansible is not installed
DEV App Server 98
appsrv98:meggle1:/home/meggle1> python -V
Python 2.7.16
DEV App Server 98
appsrv98:meggle1:/home/meggle1>


On Wednesday, September 18, 2019 at 9:57:03 AM UTC-5, Matt Martz wrote:
>
> What is the version of sudo installed on `appsrv98`?
>
> I have a feeling that `appsrv98` is a really old machine, maybe running 
> EL5 or something like that.  In which case, even if you can get past the 
> sudo issue, you'll run into python version issues as well.
>
> On Wed, Sep 18, 2019 at 9:52 AM Mike Eggleston  > wrote:
>
>> Removed Ansible 2.8.5 and installed Ansible 2.8.5.
>> Same error.
>> More simple playbook.
>> Changed "become: yes" to "become:true".
>> Same error:
>>
>> ---
>> - hosts: appsrv98
>>
>>   tasks:
>> - name: test (1/2)
>>   command: uptime
>>
>> - name: test (2/2)
>>   command: uptime
>>   become: true
>>
>>
>> On Wednesday, September 18, 2019 at 9:15:28 AM UTC-5, Mike Eggleston 
>> wrote:
>>>
>>> GNU/Linux: CentOS Linux release 7.6.1810 (Core)
>>>
>>> Playbook:
>>> ---
>>> - hosts: all
>>>   gather_facts: no
>>>   vars:
>>> md5script: /pawn/bin/md5verify.sh
>>>
>>>   tasks:
>>> - name: test (1/3)
>>>   command: uptime
>>>
>>> - name: test (2/3)
>>>   command: uptime
>>>   become: yes
>>>
>>> - name: test (2/3)
>>>   command: ls -l {{ md5script }}
>>>   become: yes
>>>
>>> Results:
>>> $ ansible-playbook --limit appsrv98 x.yml
>>>
>>> PLAY [all] 
>>> **
>>>
>>> TASK [test (1/3)] 
>>> ***
>>> changed: [appsrv98]
>>>
>>> TASK [test (2/3)] 
>>> ***
>>>  [WARNING]: Module invocation had junk after the JSON data: usage: sudo 
>>> -e [-S] [-p prompt] [-u username|#uid] file ...
>>>
>>> fatal: [appsrv98]: FAILED! => {"changed": false, "module_stderr": "sudo: 
>>> illegal option `-n'\n", "module_stdout": "usage: sudo -h | -K | -k | -L | 
>>> -l | -V | -v\nusage: sudo [-bEHPS] [-p prompt] [-u username|#uid] 
>>> [VAR=value]\n{-i | -s | }\nusage: sudo -e [-S] [-p 
>>> prompt] [-u username|#uid] file ...\n", "msg": "MODULE FAILURE\nSee 
>>> stdout/stderr for the exact error", "rc": 1}
>>>
>>> PLAY RECAP 
>>> **
>>> appsrv98   : ok=1changed=1unreachable=0
>>> failed=1skipped=0rescued=0ignored=0
>>>
>>>
>>> shell returned 2
>>>
>>> Remote sudo version:
>>> $ sudo -V
>>> Sudo version 1.8.23
>>> Sudoers policy plugin version 1.8.23
>>> Sudoers file grammar version 46
>>> Sudoers I/O plugin version 1.8.23
>>>
>>> Local command Ansible version:
>>> $ [meggle1@dvlnx108 ~]$ rpm -qi ansible
>>> Name: ansible
>>> Version : 2.8.5
>>> Release : 1.el7.ans
>>> Architecture: noarch
>>> Install Date: Fri 13 Sep 2019 07:49:12 AM CDT
>>> Group   : Development/Libraries
>>> Size: 87783909
>>> License : GPLv3+
>>> Signature   : RSA/SHA1, Thu 12 Sep 2019 06:02:36 PM CDT, Key ID 
>>> b84e339c442667a9
>>> Source RPM  : ansible-2.8.5-1.el7.ans.src.rpm
>>> Build Date  : Thu 12 Sep 2019 06:01:11 PM CDT
>>> Build Host  : jenkins-jnlp-agent-457gk
>>> Relocations : (not relocatable)
>>> URL : https://www.ansible.com
>>> Summary : SSH-based application deployment, configuration 
>>> management, and IT orchestration platform
>>> Description :

[ansible-project] Re: error using "become"?

2019-09-18 Thread Mike Eggleston
Removed Ansible 2.8.5 and installed Ansible 2.8.5.
Same error.
More simple playbook.
Changed "become: yes" to "become:true".
Same error:

---
- hosts: appsrv98

  tasks:
- name: test (1/2)
  command: uptime

- name: test (2/2)
  command: uptime
  become: true


On Wednesday, September 18, 2019 at 9:15:28 AM UTC-5, Mike Eggleston wrote:
>
> GNU/Linux: CentOS Linux release 7.6.1810 (Core)
>
> Playbook:
> ---
> - hosts: all
>   gather_facts: no
>   vars:
> md5script: /pawn/bin/md5verify.sh
>
>   tasks:
> - name: test (1/3)
>   command: uptime
>
> - name: test (2/3)
>   command: uptime
>   become: yes
>
> - name: test (2/3)
>   command: ls -l {{ md5script }}
>   become: yes
>
> Results:
> $ ansible-playbook --limit appsrv98 x.yml
>
> PLAY [all] 
> **
>
> TASK [test (1/3)] 
> ***
> changed: [appsrv98]
>
> TASK [test (2/3)] 
> ***
>  [WARNING]: Module invocation had junk after the JSON data: usage: sudo -e 
> [-S] [-p prompt] [-u username|#uid] file ...
>
> fatal: [appsrv98]: FAILED! => {"changed": false, "module_stderr": "sudo: 
> illegal option `-n'\n", "module_stdout": "usage: sudo -h | -K | -k | -L | 
> -l | -V | -v\nusage: sudo [-bEHPS] [-p prompt] [-u username|#uid] 
> [VAR=value]\n{-i | -s | }\nusage: sudo -e [-S] [-p 
> prompt] [-u username|#uid] file ...\n", "msg": "MODULE FAILURE\nSee 
> stdout/stderr for the exact error", "rc": 1}
>
> PLAY RECAP 
> **
> appsrv98   : ok=1changed=1unreachable=0
> failed=1skipped=0rescued=0ignored=0
>
>
> shell returned 2
>
> Remote sudo version:
> $ sudo -V
> Sudo version 1.8.23
> Sudoers policy plugin version 1.8.23
> Sudoers file grammar version 46
> Sudoers I/O plugin version 1.8.23
>
> Local command Ansible version:
> $ [meggle1@dvlnx108 ~]$ rpm -qi ansible
> Name: ansible
> Version : 2.8.5
> Release : 1.el7.ans
> Architecture: noarch
> Install Date: Fri 13 Sep 2019 07:49:12 AM CDT
> Group   : Development/Libraries
> Size: 87783909
> License : GPLv3+
> Signature   : RSA/SHA1, Thu 12 Sep 2019 06:02:36 PM CDT, Key ID 
> b84e339c442667a9
> Source RPM  : ansible-2.8.5-1.el7.ans.src.rpm
> Build Date  : Thu 12 Sep 2019 06:01:11 PM CDT
> Build Host  : jenkins-jnlp-agent-457gk
> Relocations : (not relocatable)
> URL : https://www.ansible.com
> Summary : SSH-based application deployment, configuration management, 
> and IT orchestration platform
> Description :
>
> Ansible is a radically simple model-driven configuration management,
> multi-node deployment, and orchestration engine. Ansible works
> over SSH and does not require any software or daemons to be installed
> on remote nodes. Extension modules can be written in any language and
> are transferred to managed machines automatically.
>
>
> Ideas why it's failing?
>

-- 
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/0df60808-3f2b-4119-9d5a-cfe5ed1b9ff2%40googlegroups.com.


[ansible-project] error using "become"?

2019-09-18 Thread Mike Eggleston
GNU/Linux: CentOS Linux release 7.6.1810 (Core)

Playbook:
---
- hosts: all
  gather_facts: no
  vars:
md5script: /pawn/bin/md5verify.sh

  tasks:
- name: test (1/3)
  command: uptime

- name: test (2/3)
  command: uptime
  become: yes

- name: test (2/3)
  command: ls -l {{ md5script }}
  become: yes

Results:
$ ansible-playbook --limit appsrv98 x.yml

PLAY [all] 
**

TASK [test (1/3)] 
***
changed: [appsrv98]

TASK [test (2/3)] 
***
 [WARNING]: Module invocation had junk after the JSON data: usage: sudo -e 
[-S] [-p prompt] [-u username|#uid] file ...

fatal: [appsrv98]: FAILED! => {"changed": false, "module_stderr": "sudo: 
illegal option `-n'\n", "module_stdout": "usage: sudo -h | -K | -k | -L | 
-l | -V | -v\nusage: sudo [-bEHPS] [-p prompt] [-u username|#uid] 
[VAR=value]\n{-i | -s | }\nusage: sudo -e [-S] [-p 
prompt] [-u username|#uid] file ...\n", "msg": "MODULE FAILURE\nSee 
stdout/stderr for the exact error", "rc": 1}

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


shell returned 2

Remote sudo version:
$ sudo -V
Sudo version 1.8.23
Sudoers policy plugin version 1.8.23
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.23

Local command Ansible version:
$ [meggle1@dvlnx108 ~]$ rpm -qi ansible
Name: ansible
Version : 2.8.5
Release : 1.el7.ans
Architecture: noarch
Install Date: Fri 13 Sep 2019 07:49:12 AM CDT
Group   : Development/Libraries
Size: 87783909
License : GPLv3+
Signature   : RSA/SHA1, Thu 12 Sep 2019 06:02:36 PM CDT, Key ID 
b84e339c442667a9
Source RPM  : ansible-2.8.5-1.el7.ans.src.rpm
Build Date  : Thu 12 Sep 2019 06:01:11 PM CDT
Build Host  : jenkins-jnlp-agent-457gk
Relocations : (not relocatable)
URL : https://www.ansible.com
Summary : SSH-based application deployment, configuration management, 
and IT orchestration platform
Description :

Ansible is a radically simple model-driven configuration management,
multi-node deployment, and orchestration engine. Ansible works
over SSH and does not require any software or daemons to be installed
on remote nodes. Extension modules can be written in any language and
are transferred to managed machines automatically.


Ideas why it's failing?

-- 
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/1e7df5bc-a76c-4e17-baed-d5fe1050bace%40googlegroups.com.


Re: [ansible-project] Re: Hardening SSH With Ansible

2019-09-05 Thread Mike Eggleston
And the presented regents is case specific. Try “(?i)...”.

Mike

> On Sep 5, 2019, at 08:55, Vladimir Botka  wrote:
> 
> Hi !
> 
>>> regexp: "^(#|#\s|\s|)PermitRootLogin\s*(no|yes)"
>> Actually \s* is not *one or many*, but *zero or many*. There should be at 
>> least one space so `\s+` 
> 
> 1) Searching for both commented and non-commented lines is risky. There
>   might be both present in the file and the result will be unpredictable.
>   It's better to ignore commented lines.
> 
> regexp: "^(\s*)PermitRootLogin\s+(no|yes)"
> 
> 2) Searching for (no|yes) does not make any sense. We're going to replace it
>   anyway. This may make things even worse by preventing a potential syntax
>   error to be corrected. Replace it with general pattern.
> 
> regexp: "^(\s*)PermitRootLogin\s+(.*)$"
> 
> 3) Always validate the configuration
> 
> validate: "{{ sshd_path }} -t -f %s"
> 
> my two cents, Cheers,
> 
>-vlado
> 
> -- 
> 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/20190905155509.186e2ce1%40gmail.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/C74F6EA3-B8A1-4D9A-AD4F-F8172410F000%40gmail.com.


Re: [ansible-project] win_file_version

2019-08-24 Thread Mike Eggleston
Name should be indented under tasks. 

Mike

> On Aug 24, 2019, at 05:25, Manish Kumar  wrote:
> 
> Hi All,
> 
> Is there any solution to know why  ansible is throwing below error even after 
> correct syntax ?  It has become very difficult to find as there is no clue 
> even after referring ansible document , everything seems to be fine .
> 
> 
> Parsed /home/manish/mk/ansible/win/inventory.yml inventory source with ini 
> plugin
> ERROR! 'win_file_version' is not a valid attribute for a Play
> 
> The error appears to be in 
> '/home/manish/mk/ansible/win/win_file_version.yml': line 7, column 3, but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
>   tasks:
> - name: testing
>   ^ here
> 
> Playbook:
> 
> ---
> 
> - hosts: all
>   gather_facts: no
> 
>   tasks:
> - name: testing
>   win_file_version:
> path: C:\Users\Administrator\Downloads\npp.7.7.1.Installer.exe
> register: exe_file_version
> 
> - debug:
> msg: '{{ exe_file_version }}'
> 
> Thanks,
> Manish
> -- 
> 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/49befd91-f222-4934-aaae-0ca8c46ef653%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/63F7309D-7008-4EA6-A75A-16BC619001E3%40gmail.com.


Re: [ansible-project] Unable to get value of variable from another Play in Ansible

2019-08-22 Thread Mike Eggleston
I’ve read variables don’t survive across “hosts” lines. 

Mike

> On Aug 22, 2019, at 14:26, Mohtashim S  wrote:
> 
> I wish to obtain the value of "f_APP" variable of Play 2 into Play 3.
> 
> 
> 
> Below is my playbook which case be used as a testcase:
> 
> 
> 
> - name: "Play 1"
>   hosts: localhost
>   tasks:
> 
>- add_host: name={{ item }}
> groups=dest_nodes
> ansible_user={{ USER }}
>  with_items: "{{ Dest_IP.split(',') }}"
> 
> 
> - name: "Play 2"
>   hosts: dest_nodes
>   user: "{{ USER }}"
>   tasks:
> 
>- set_fact:
>f_APP: "Yellow"
> 
> - name: "Play 3"
> 
>   hosts: localhost
>   user: "{{ USER }}"
> 
>   vars:
> dbfiledet: "{{ hostvars['dest_nodes']['f_APP'] }}"
> 
>   tasks:
>- debug: msg="{{ dbfiledet.stdout }}"
> 
> 
> 
> 
> 
> 
> 
> 
> I get the below error for my attempt:
> 
> 
> 
> playbook RUN command:
> 
> 
> 
> ansible-playbook variabletest.yml -e "USER=user1 
> Dest_IP=10.17.44.26,10.17.54.26"
> 
> [WARNING]: provided hosts list is empty, only localhost is available. Note 
> that the implicit localhost does not match 'all'
> 
> 
> 
> PLAY [Play 1]
> 
> 
> 
> TASK [Gathering Facts] 
> **
>  ok: [localhost]
> 
> 
> 
> TASK [add_host] 
> *
>  changed: [localhost] => (item=10.17.44.26) changed: [localhost] => 
> (item=10.17.54.26)
> 
> 
> 
> PLAY [Play 2]
> 
> 
> 
> TASK [Gathering Facts] 
> **
>  ok: [10.17.54.26] ok: [10.17.44.26]
> 
> 
> 
> TASK [set_fact] 
> *
>  ok: [10.17.44.26] ok: [10.17.54.26]
> 
> 
> 
> PLAY [Play 3]
> 
> 
> 
> TASK [Gathering Facts] 
> **
>  ok: [localhost]
> 
> 
> 
> TASK [debug] 
> 
>  fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
> undefined variable. The error was: \"hostvars['dest_nodes']\" is 
> undefined\n\nThe error appears to be in 'variabletest.yml': line 36, column 
> 6, but may\nbe elsewhere in the file depending on the exact syntax 
> problem.\n\nThe offending line appears to be:\n\n\n - debug: msg=\"{{ 
> dbfiledet.stdout }}\"\n ^ here\nWe could be wrong, but this one looks like it 
> might be an issue with\nmissing quotes. Always quote template expression 
> brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo 
> }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
> 
> 
> 
> PLAY RECAP
> 
> 
> 
> 10.17.44.26 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 
> ignored=0
> 
> 10.17.54.26 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 
> ignored=0 localhost
> 
> : ok=3 changed=1 unreachable=0 failed=1 skipped=0
> 
> rescued=0 ignored=0
> 
> 
> 
> I'm on the latest version of ansible and python 2.7.5
> 
> 
> 
> Can someone suggest what is wrong and how can i get the value for the 
> variable in Play 3 please ?
> 
> -- 
> 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/36a39c4b-1e5f-4b21-b9c4-89c1f9941452%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/42A6FE8E-1EE7-407C-991F-95DBDB2143B9%40gmail.com.


[ansible-project] execute one task of a playbook locally and the rest on the remote hosts?

2019-08-20 Thread Mike Eggleston
I'm working on a playbook to deploy an internal application to internal 
hosts. This application is delivered by development to QA in a *.tar.gz 
file. The file is staged and deployed to QA (by me) in that *.tar.gz file. 
What I would like/am thinking of is something like:

$ ansible-playbook remote-group -k -e 
'{"qahost":"qaserver","version":2.75.26.1","path":"/home/app/app_2.75.26.1.tar.gz"}'

and the playbook would be something like:

---
- hosts: v2app
  gather_facts: yes

  vars:
qahost: "{{ qahost }}"
version: "{{ version }}"
remotepath: "{{ path }}"
localpath: "/tmp/{{version}}.tar.gz"

  tasks:
- name: bring file locally
  command: scp "{{qahost}}":"{{remotepath}}" "{{localpath}}"
  local: true

# localpath referes to /tmp, so using it twice means once on the local 
server and once on the remote app server
- name: copy the deployment file from QA locally
  copy:src={{localpath}} dest={{localpath}}

- name: extract the deployment file on the app server
  command: tar -xzf {{localpath}}

# still testing, so using /tmp for all updates
- name: make a copy of the application
  shell: rm -rf /tmp/app ; cp -r -p /opt/app /tmp

- name: sync the new files to the application
  shell: cd /tmp/app; rsync -a {{localpath}} .

- name: clean up
  command: rm -f {{localpath}}

(I'm just typing from memory and haven't syntax checked the above.)

How can I execute a single task of a playbook on the local server and the 
rest of the tasks on the remote servers? (Is this even possible?)

TIA

Mike

-- 
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/527d31ec-10a7-4617-8b9c-a300483c1c71%40googlegroups.com.


[ansible-project] yum interpreter line missing

2019-08-19 Thread Mike Eggleston
Jonathan made me understand how my previous "can't connect to a server" was 
wrong in my head.
Now my next issue. I'm writing a little playbooks that will eventually go 
into a "provisioning" playbook to make all my boxes the same.
This next block says the interpreter line is missing from the yum module.
Here's my playbook:
# $Id$
# $Log$

# install and configure standard packages
# :!ansible-playbook -u root -k --limit dvlnx115 --syntax-check %
# :!ansible-playbook -u root -k --limit dvlnx115 %
# :!ansible-playbook -vvv -u root -k --limit dvlnx115 %
---
- hosts: all
  gather_facts: no

  tasks:
- name: install package ssh
  package:
name: ssh
state: present

- name: configure ssh - set the port
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)#Port 22'
replace: Port 22
  become: yes

- name: configure ssh - permit root login no
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)#PermitRootLogin .*$'
replace: PermitRootLogin no
  become: yes

- name: configure ssh - password authentication yes (1/2)
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)#PasswordAuthentication.*$'
replace: PasswordAuthentication yes
  become: yes

- name: configure ssh - password authentication yes (2/2)
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)PasswordAuthentication no'
replace: PasswordAuthentication yes
  become: yes

- name: configure ssh - use PAM yes (1/2)
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)#UsePAM .*$'
replace: UsePAM yes
  become: yes

- name: configure ssh - use PAM yes (2/2)
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)UsePAM no'
replace: UsePAM yes
  become: yes

- name: configure ssh - set the protocol
  replace:
path: /etc/ssh/sshd_config
regexp: '(?i)^Protocol 2,'
replace: Protocol 2
  become: yes

- name: enable and restart ssh daemon
  service:
name: sshd
enabled: yes
state: restarted
  become: yes
  when: changed.true

When I run this playbook I get:
[meggle1@dvlnx108 playbooks]$ ansible-playbook -u root -k --limit dvlnx115 
ssh.yml
SSH password:

PLAY [all] 
*

TASK [install package ssh] 
*
fatal: [dvlnx115]: FAILED! => {"msg": "module (yum) is missing interpreter 
line"}

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

[meggle1@dvlnx108 playbooks]$

Both ansible master and test box are CentOS and fully patched and recently 
booted.
Jonathan are you looking into this? Some way I can help?

Mike

-- 
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/122f0ae7-9790-4709-a9fc-b379641908be%40googlegroups.com.


Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
Mea cupla. You're right. Duh. Of course ansible can't reach the server 
because the server is booting.
I'll look at the other links.

Thanks.

Mike

On Monday, August 19, 2019 at 1:49:45 PM UTC-5, Jonathan Lozada De La Matta 
wrote:
>
> like I mentioned before, that task is failing because it does the reboot 
> then tries to continue working but, can't reach at all. I suggest you look 
> at the links provided more and replace your tasks with those suggestions.
>
> On Mon, Aug 19, 2019 at 2:15 PM Mike Eggleston  > wrote:
>
> The "*.retry" file is a list of hosts that the playbook didn't succeed for 
> so you can "retry" the ansible command using "--limit file.retry" to only 
> touch those hosts that previously failed.
>
> Here's the output after removin the "yum.retry" file:
>
> [meggle1@dvlnx108 playbooks]$ ansible-playbook -u root -k --limit dvlnx115 
> yum.yml
> SSH password:
>
> PLAY [all] 
> **
>
> TASK [Gathering Facts] 
> **
> ok: [dvlnx115]
>
> TASK [checking for yum...] 
> **
> ok: [dvlnx115]
>
> TASK [update all packages (yum)] 
> 
>  [WARNING]: Consider using the yum module rather than running 'yum'.  If 
> you need to use command because yum is insufficient you can add 'warn: 
> false' to
> this command task or set 'command_warnings=False' in ansible.cfg to get 
> rid of this message.
>
> changed: [dvlnx115]
>
> TASK [update all packages (apt-get)] 
> 
> skipping: [dvlnx115]
>
> RUNNING HANDLER [restart server] 
> 
> fatal: [dvlnx115]: UNREACHABLE! => {"changed": false, "msg": "Data could 
> not be sent to remote host \"dvlnx115\". Make sure this host can be reached 
> over ssh: Connection to dvlnx115 closed by remote host.\r\n", 
> "unreachable": true}
>
> PLAY RECAP 
> **
> dvlnx115   : ok=3changed=1unreachable=1
> failed=0skipped=1rescued=0ignored=0
>
> Puzzling to me is that if ansible is using separate ssh commands, the ssh 
> succeeds gathering facts and checking for yum, but fails on that last part.
>
>
> On Monday, August 19, 2019 at 1:10:43 PM UTC-5, S C Rigler wrote:
>
> Curious about this:
>
> Using module file /home/meggle1/src/ansible/playbooks/yum.retry 
>
> Can you remove/rename that file? 
>
> On Mon, Aug 19, 2019 at 10:15 AM Mike Eggleston  
> wrote:
>
> Here’s what I’m working with:
>
> [meggle1@dvlnx108 playbooks]$ cat /etc/os-release
>
> NAME="CentOS Linux"
>
> VERSION="7 (Core)"
>
> ID="centos"
>
> ID_LIKE="rhel fedora"
>
> VERSION_ID="7"
>
> PRETTY_NAME="CentOS Linux 7 (Core)"
>
> ANSI_COLOR="0;31"
>
> CPE_NAME="cpe:/o:centos:centos:7"
>
> HOME_URL="https://www.centos.org/;
>
> BUG_REPORT_URL="https://bugs.centos.org/;
>
>  
>
> CENTOS_MANTISBT_PROJECT="CentOS-7"
>
> CENTOS_MANTISBT_PROJECT_VERSION="7"
>
> REDHAT_SUPPORT_PRODUCT="centos"
>
> REDHAT_SUPPORT_PRODUCT_VERSION="7"
>
>  
>
> [meggle1@dvlnx108 playbooks]$ ssh root@dvlnx115 cat /etc/os-release
>
> root@dvlnx115's password:
>
> NAME="CentOS Linux"
>
> VERSION="7 (Core)"
>
> ID="centos"
>
> ID_LIKE="rhel fedora"
>
> VERSION_ID="7"
>
> PRETTY_NAME="CentOS Linux 7 (Core)"
>
> ANSI_COLOR="0;31"
>
> CPE_NAME="cpe:/o:centos:centos:7"
>
> HOME_URL="https://www.centos.org/;
>
> BUG_REPORT_URL="https://bugs.centos.org/;
>
>  
>
> CENTOS_MANTISBT_PROJECT="CentOS-7"
>
> CENTOS_MANTISBT_PROJECT_VERSION="7"
>
> REDHAT_SUPPORT_PRODUCT="centos"
>

Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
Found the ROM on the ansible site. Installing now. 

Mike

> On Aug 19, 2019, at 09:44, Mike Eggleston  wrote:
> 
>  
> [root@dvlnx108 ~]# rpm -qi ansible
> Name: ansible
> Version : 2.4.2.0
> Release : 2.el7
> Architecture: noarch
> Install Date: Mon 29 Jul 2019 02:24:00 PM CDT
> Group   : Development/Libraries
> Size: 40059005
> License : GPLv3+
> Signature   : RSA/SHA256, Mon 29 Jan 2018 03:51:53 PM CST, Key ID 
> 24c6a8a7f4a80eb5
> Source RPM  : ansible-2.4.2.0-2.el7.src.rpm
> Build Date  : Mon 29 Jan 2018 02:16:59 PM CST
> Build Host  : x86_64_01.bsys.centos.org
> Relocations : (not relocatable)
> Packager: CentOS BuildSystem <http://bugs.centos.org>
> Vendor  : CentOS
> URL : http://ansible.com
> Summary : SSH-based configuration management, deployment, and task 
> execution system
> Description :
>  
> Ansible is a radically simple model-driven configuration management,
> multi-node deployment, and remote task execution system. Ansible works
> over SSH and does not require any software or daemons to be installed
> on remote nodes. Extension modules can be written in any language and
> are transferred to managed machines automatically.
> 
> This is the latest RPM available in the CentOS repository. Is there a latest 
> RPM available?
> 
> Mike
> 
>> On Aug 19, 2019, at 09:23, Jonathan Lozada De La Matta  
>> wrote:
>> 
>> Before we go more into dept, I suggest you upgrade ansible versions to 
>> either 2.7 or 2.8. Ansible version 2.4 is EOL. It would be harder to 
>> troubleshoot this.
>> 
>>> On Mon, Aug 19, 2019 at 10:21 AM Mike Eggleston  
>>> wrote:
>>> I changed the yum to an uptime. The connection issue is in the handler. 
>>> 
>>> Here’s the interpreter message:
>>> 
>>> [meggle1@dvlnx108 playbooks]$ ansible-playbook -vvv -u root -k --limit 
>>> dvlnx115 y.yml
>>> ansible-playbook 2.4.2.0
>>>   config file = /home/meggle1/src/ansible/ansible.cfg
>>>   configured module search path = [u'/home/meggle1/src/ansible/playbooks']
>>>   ansible python module location = /usr/lib/python2.7/site-packages/ansible
>>>   executable location = /usr/bin/ansible-playbook
>>>   python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 
>>> 20150623 (Red Hat 4.8.5-36)]
>>> Using /home/meggle1/src/ansible/ansible.cfg as config file
>>> SSH password:
>>> Parsed /home/meggle1/src/ansible/newinventory inventory source with ini 
>>> plugin
>>>  
>>> PLAYBOOK: y.yml 
>>> *
>>> 1 plays in y.yml
>>>  
>>> PLAY [all] 
>>> **
>>>  
>>> TASK [Gathering Facts] 
>>> **
>>> Using module file 
>>> /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
>>>  ESTABLISH SSH CONNECTION FOR USER: root
>>>  SSH: EXEC sshpass -d13 ssh -o ConnectTimeout=5 -o 
>>> ServerAliveInterval=10 -o ServerAliveCountMax=720 -o 
>>> StrictHostKeyChecking=ask -o User=root -o ConnectTimeout=10 dvlnx115 
>>> '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
>>>  (0, '\n{"invocation": {"module_args": {"filter": "*", 
>>> "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", 
>>> "gather_timeout": 10}}, "ansible_facts": {"ansible_product_serial": 
>>> "VMware-42 12 36 76 5b 94 86 03-e1 82 dc f3 6e e3 b4 ab", 
>>> "ansible_form_factor": "Other", "ansible_distribution_file_parsed": true, 
>>> "ansible_fips": false, "ansible_service_mgr": "systemd", "ansible_user_id": 
>>> "root", "ansible_selinux_python_present": true, "ansible_userspace_bits": 
>>> "64", "ansible_ssh_host_key_rsa_public": 
>>> "B3NzaC1yc2EDAQABAAABAQC+4PWY9xn7bJxcYd/uWpEmx2RM4ikwPdYW5zXVWFpNKdkjDg8Fz6zEtXbaccVZIfuWM6aJpvgIILRfoI9rjCiCp60oxQh3luE9K3liCqZD4ue6uc8P2KPT7AHq3AQzyFHV01hBpBNWXYFAVG6YrK8cRWxPqc1V7oFpHXwmzQpy5Mq5PdHF6WFbCX2VgvQETkSYrnGJ5ffTZv1j9KmHaurfbPGtd39L

Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
 
[root@dvlnx108 ~]# rpm -qi ansible
Name: ansible
Version : 2.4.2.0
Release : 2.el7
Architecture: noarch
Install Date: Mon 29 Jul 2019 02:24:00 PM CDT
Group   : Development/Libraries
Size: 40059005
License : GPLv3+
Signature   : RSA/SHA256, Mon 29 Jan 2018 03:51:53 PM CST, Key ID 
24c6a8a7f4a80eb5
Source RPM  : ansible-2.4.2.0-2.el7.src.rpm
Build Date  : Mon 29 Jan 2018 02:16:59 PM CST
Build Host  : x86_64_01.bsys.centos.org
Relocations : (not relocatable)
Packager: CentOS BuildSystem <http://bugs.centos.org>
Vendor  : CentOS
URL : http://ansible.com
Summary : SSH-based configuration management, deployment, and task 
execution system
Description :
 
Ansible is a radically simple model-driven configuration management,
multi-node deployment, and remote task execution system. Ansible works
over SSH and does not require any software or daemons to be installed
on remote nodes. Extension modules can be written in any language and
are transferred to managed machines automatically.

This is the latest RPM available in the CentOS repository. Is there a latest 
RPM available?

Mike

> On Aug 19, 2019, at 09:23, Jonathan Lozada De La Matta  
> wrote:
> 
> Before we go more into dept, I suggest you upgrade ansible versions to either 
> 2.7 or 2.8. Ansible version 2.4 is EOL. It would be harder to troubleshoot 
> this.
> 
>> On Mon, Aug 19, 2019 at 10:21 AM Mike Eggleston  
>> wrote:
>> I changed the yum to an uptime. The connection issue is in the handler. 
>> 
>> Here’s the interpreter message:
>> 
>> [meggle1@dvlnx108 playbooks]$ ansible-playbook -vvv -u root -k --limit 
>> dvlnx115 y.yml
>> ansible-playbook 2.4.2.0
>>   config file = /home/meggle1/src/ansible/ansible.cfg
>>   configured module search path = [u'/home/meggle1/src/ansible/playbooks']
>>   ansible python module location = /usr/lib/python2.7/site-packages/ansible
>>   executable location = /usr/bin/ansible-playbook
>>   python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-36)]
>> Using /home/meggle1/src/ansible/ansible.cfg as config file
>> SSH password:
>> Parsed /home/meggle1/src/ansible/newinventory inventory source with ini 
>> plugin
>>  
>> PLAYBOOK: y.yml 
>> *
>> 1 plays in y.yml
>>  
>> PLAY [all] 
>> **
>>  
>> TASK [Gathering Facts] 
>> **
>> Using module file 
>> /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
>>  ESTABLISH SSH CONNECTION FOR USER: root
>>  SSH: EXEC sshpass -d13 ssh -o ConnectTimeout=5 -o 
>> ServerAliveInterval=10 -o ServerAliveCountMax=720 -o 
>> StrictHostKeyChecking=ask -o User=root -o ConnectTimeout=10 dvlnx115 
>> '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
>>  (0, '\n{"invocation": {"module_args": {"filter": "*", 
>> "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", 
>> "gather_timeout": 10}}, "ansible_facts": {"ansible_product_serial": 
>> "VMware-42 12 36 76 5b 94 86 03-e1 82 dc f3 6e e3 b4 ab", 
>> "ansible_form_factor": "Other", "ansible_distribution_file_parsed": true, 
>> "ansible_fips": false, "ansible_service_mgr": "systemd", "ansible_user_id": 
>> "root", "ansible_selinux_python_present": true, "ansible_userspace_bits": 
>> "64", "ansible_ssh_host_key_rsa_public": 
>> "B3NzaC1yc2EDAQABAAABAQC+4PWY9xn7bJxcYd/uWpEmx2RM4ikwPdYW5zXVWFpNKdkjDg8Fz6zEtXbaccVZIfuWM6aJpvgIILRfoI9rjCiCp60oxQh3luE9K3liCqZD4ue6uc8P2KPT7AHq3AQzyFHV01hBpBNWXYFAVG6YrK8cRWxPqc1V7oFpHXwmzQpy5Mq5PdHF6WFbCX2VgvQETkSYrnGJ5ffTZv1j9KmHaurfbPGtd39L78DU60vrRlJgybMc0bNuipJreFibCbiYGwEYZipXp9yWiWVDItlhfBnrADDNEQgaU1UNrHaITNpJ6cz0N1t/QdGcysOv2GBuVGL6bff7JIvNLZdDjFAGJnxz",
>>  "gather_subset": ["all"], "ansible_real_user_id": 0, 
>> "ansible_architecture": "x86_64", "ansible_local": {}, 
>> "ansible_distribution_version": "7.6.1810", "ansible_domain": 
>> "firstcash.com", "ansible_distribution_file_path": &q

Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
t;links": {"masters": [], 
"labels": [], "ids": [], "uuids": ["ac6a9318-a9b8-411c-9a1b-000804f1ad82"]}, 
"sectors": "2097152", "start": "2048", "holders": [], "size": "1.00 GB"}}, 
"holders": [], "size": "16.00 GB"}, "dm-0": {"scheduler_mode": "", 
"rotational": "1", "vendor": null, "sectors": "28090368", "links": {"masters": 
[], "labels": [], "ids": ["dm-name-centos-root", 
"dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyS28LXugumw14mfP87MkO28uru0rbGvzC"],
 "uuids": ["10f7278c-1721-4553-a9ee-d8a4ffdb96d7"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "13.39 GB"}, "dm-1": {"scheduler_mode": "", 
"rotational": "1", "vendor": null, "sectors": "3358720", "links": {"masters": 
[], "labels": [], "ids": ["dm-name-centos-swap", 
"dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyHwjjedjNjoG0fzlK58hdWGwz6V6BuN2z"],
 "uuids": ["17cf1614-d822-41af-bbd2-589464afc51c"]}, "sas_device_handle": null, 
"sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", 
"removable": "0", "support_discard": "0", "model": null, "partitions": {}, 
"holders": [], "size": "1.60 GB"}}, "ansible_user_uid": 0, "ansible_lvm": 
{"pvs": {"/dev/sda2": {"free_g": "0", "size_g": "15.00", "vg": "centos"}}, 
"lvs": {"root": {"size_g": "13.39", "vg": "centos"}, "swap": {"size_g": "1.60", 
"vg": "centos"}}, "vgs": {"centos": {"free_g": "0", "size_g": "15.00", 
"num_lvs": "2", "num_pvs": "1"}}}, "ansible_distribution": "CentOS", 
"ansible_user_dir": "/root", "ansible_dns": {"nameservers": ["10.50.117.39", 
"10.50.116.123"], "search": ["firstcash.com", "casham.com"]}, 
"ansible_distribution_major_version": "7", "module_setup": true, 
"ansible_processor_count": 2, "ansible_hostname": "dvnlx115", 
"ansible_processor_vcpus": 4, "ansible_swaptotal_mb": 1639, "ansible_lsb": {}, 
"ansible_real_group_id": 0, "ansible_bios_date": "09/21/2015", 
"ansible_ens160": {"macaddress": "00:50:56:92:fd:33", "features": 
{"tx_checksum_ipv4": "off [fixed]", "generic_receive_offload": "on", 
"tx_checksum_ipv6": "off [fixed]", "tx_scatter_gather_fraglist": "off [fixed]", 
"rx_all": "off [fixed]", "highdma": "on", "rx_fcs": "off [fixed]", 
"tx_lockless": "off [fixed]", "tx_tcp_ecn_segmentation": "off [fixed]", 
"rx_udp_tunnel_port_offload": "off [fixed]", "tx_tcp6_segmentation": "on", 
"tx_gso_robust": "off [fixed]", "tx_ipip_segmentation": "off [fixed]", 
"tx_tcp_mangleid_segmentation": "off", "tx_checksumming": "on", 
"vlan_challenged": "off [fixed]", "loopback": "off [fixed]", "fcoe_mtu": "off 
[fixed]", "scatter_gather": "on", "tx_checksum_sctp": "off [fixed]", 
"tx_vlan_stag_hw_insert": "off [fixed]", "rx_vlan_stag_hw_parse": "off 
[fixed]", "tx_gso_partial": "off [fixed]", "rx_gro_hw": "off [fixed]", 
"rx_vlan_stag_filter": "off [fixed]", "large_receive_offload": "on", 
"tx_scatter_gather": "on", "rx_checksumming": "on", "tx_tcp_segmentation": 
"on", "netns_local": "off [fixed]", "bu

Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
I first used “package” and ansible complained of a missing interpreter line. 
That’s why I switched to “command”.

I’m going between two CentIS boxes. 

All this doesn’t explain why I can get into the box over ssh, but ansible cant 
get into the box. 

Mike

> On Aug 19, 2019, at 09:02, Jonathan Lozada De La Matta  
> wrote:
> 
> Mike,
> 
> You should use the yum/apt modules instead of shell/command do what you are 
> trying to do. Also what version of ansible are you using? You should also use 
> the OS conditionals to run the tasks depending on the OS. 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#commonly-used-facts
>  https://docs.ansible.com/ansible/latest/modules/yum_module.html 
> https://docs.ansible.com/ansible/latest/modules/apt_module.html. you can also 
> use https://docs.ansible.com/ansible/latest/modules/package_module.html for 
> generic package management. If you are using at least ansible 2.7 use the 
> reboot https://docs.ansible.com/ansible/latest/modules/reboot_module.html 
> since it auto connects back.
> 
>> On Mon, Aug 19, 2019 at 9:54 AM Mike Eggleston  wrote:
>> (Doing this on my phone is cumbersome.) :)
>> 
>> Hers the playbook:
>> 
>> [meggle1@dvlnx108 playbooks]$ cat yum.yml
>> # $Id$
>> # $Log$
>>  
>> # use the package manager (yum/apt-get) to update all installed packages
>> # :!ansible-playbook -u root -k --limit dvlnx115 --syntax-check %
>> # :!ansible-playbook -u root -k --limit dvlnx115 %
>> # :!ansible-playbook -vvv -u root -k --limit dvlnx115 %
>> ---
>> - hosts: all
>>   gather_facts: yes
>>  
>>   tasks:
>> - name: checking for yum...
>>   stat:
>> path: /usr/bin/yum
>>   register: stat_results
>>   ignore_errors: true
>>  
>> - name: update all packages (yum)
>>   command: yum -y update
>>   become: yes
>>   notify:
>> - restart server
>>   when: stat_results.stat.exists
>>  
>> - name: update all packages (apt-get)
>>   shell: apt-get -y update; apt-get -y upgrade
>>   become: yes
>>   notify:
>> - restart server
>>   when: not stat_results.stat.exists
>>  
>>  handlers:
>> - name: restart server
>>   command: shutdown -r now
>>   become: yes
>> 
>> Mike
>> 
>>> On Aug 19, 2019, at 08:40, Jonathan Lozada De La Matta 
>>>  wrote:
>>> 
>>> Mike,
>>> 
>>> If you are provisioning a VM, usually you require another play to connect 
>>> to the host. Can you share the playbook/role?
>>> 
>>>> On Mon, Aug 19, 2019 at 9:38 AM Mike Eggleston  
>>>> wrote:
>>>> What’s happening here? I can reach the server over ssh, but ansible can’t? 
>>>> I’m testing a provisioning play. I can ssh into the box with “ssh 
>>>> root@box” but the command “ansible-playbook -vvv -u root -k —limit box 
>>>> yum.yml” says “msg”: “SSH Error:data could not be sent to remote host 
>>>> \”box\”. Make sure this host can be reached over ssh”.
>>>> 
>>>> Odd. :)
>>>> 
>>>> What’s happening and how to fix this?
>>>> 
>>>> Mike
>>>> 
>>>> -- 
>>>> 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/7A600E52-96DA-455C-9715-A1D62953C6CD%40gmail.com.
>>> 
>>> 
>>> -- 
>>> Jonathan Cha'gara Lozada De La Matta
>>> He / Him / His
>>> Red Hat
>>> Senior Automation Practice Consultant & Automation CoP Manager
>>> Join the Automation CoP! https://red.ht/autocop
>>> @redhatjobsredhatjobs  @redhatjobs   
>>>  
>>>  
>>> 
>>> -- 
>>> 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/CAFYJA%2BJBx9_0VWDDJBNn-Y%2BdAMt3eusmm_2g3aMR4o29M%3DovXw%40mail.gmail.com.
>> 

Re: [ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
(Doing this on my phone is cumbersome.) :)

Hers the playbook:

[meggle1@dvlnx108 playbooks]$ cat yum.yml
# $Id$
# $Log$
 
# use the package manager (yum/apt-get) to update all installed packages
# :!ansible-playbook -u root -k --limit dvlnx115 --syntax-check %
# :!ansible-playbook -u root -k --limit dvlnx115 %
# :!ansible-playbook -vvv -u root -k --limit dvlnx115 %
---
- hosts: all
  gather_facts: yes
 
  tasks:
- name: checking for yum...
  stat:
path: /usr/bin/yum
  register: stat_results
  ignore_errors: true
 
- name: update all packages (yum)
  command: yum -y update
  become: yes
  notify:
- restart server
  when: stat_results.stat.exists
 
- name: update all packages (apt-get)
  shell: apt-get -y update; apt-get -y upgrade
  become: yes
  notify:
- restart server
  when: not stat_results.stat.exists
 
 handlers:
- name: restart server
  command: shutdown -r now
  become: yes

Mike

> On Aug 19, 2019, at 08:40, Jonathan Lozada De La Matta  
> wrote:
> 
> Mike,
> 
> If you are provisioning a VM, usually you require another play to connect to 
> the host. Can you share the playbook/role?
> 
>> On Mon, Aug 19, 2019 at 9:38 AM Mike Eggleston  wrote:
>> What’s happening here? I can reach the server over ssh, but ansible can’t? 
>> I’m testing a provisioning play. I can ssh into the box with “ssh root@box” 
>> but the command “ansible-playbook -vvv -u root -k —limit box yum.yml” says 
>> “msg”: “SSH Error:data could not be sent to remote host \”box\”. Make sure 
>> this host can be reached over ssh”.
>> 
>> Odd. :)
>> 
>> What’s happening and how to fix this?
>> 
>> Mike
>> 
>> -- 
>> 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/7A600E52-96DA-455C-9715-A1D62953C6CD%40gmail.com.
> 
> 
> -- 
> Jonathan Cha'gara Lozada De La Matta
> He / Him / His
> Red Hat
> Senior Automation Practice Consultant & Automation CoP Manager
> Join the Automation CoP! https://red.ht/autocop
> @redhatjobsredhatjobs  @redhatjobs   
>  
>  
> 
> -- 
> 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/CAFYJA%2BJBx9_0VWDDJBNn-Y%2BdAMt3eusmm_2g3aMR4o29M%3DovXw%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/337D8801-899B-4B46-9D33-3DD22376E20A%40gmail.com.


[ansible-project] Can’t reach a server?

2019-08-19 Thread Mike Eggleston
What’s happening here? I can reach the server over ssh, but ansible can’t? I’m 
testing a provisioning play. I can ssh into the box with “ssh root@box” but the 
command “ansible-playbook -vvv -u root -k —limit box yum.yml” says “msg”: “SSH 
Error:data could not be sent to remote host \”box\”. Make sure this host can be 
reached over ssh”.

Odd. :)

What’s happening and how to fix this?

Mike

-- 
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/7A600E52-96DA-455C-9715-A1D62953C6CD%40gmail.com.


[ansible-project] When yum succeeds, boot?

2019-08-18 Thread Mike Eggleston
I am working on a playbook that uses yum. When yum does an update of all 
installed packages I want to do a conditional shutdown -r. What condition do I 
check from the yum task succeeding?

Mike

-- 
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/47122EE6-9169-4E29-9AF9-B6C10697DEAA%40gmail.com.


[ansible-project] Re: Module yum and package?

2019-08-16 Thread Mike Eggleston
I’m trying a test. I have:

tasks:
  - name: update packages 
package:
  name: ‘*’
  state: latest

And executed as: 
ansible-playbook -u root -k —limit host yum.yml

and get:
fatal: [host]: FAIKED! => {“msg”: “module (yum) is missing interpreter line”}

Mike

> On Aug 16, 2019, at 14:06, Mike Eggleston  wrote:
> 
> Yum says it will do a wild card on the update (equivalent to “yum update”). 
> Will the module “package” also do a wildcard?
> 
> Mike

-- 
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/E3A3ED1F-D726-427A-849D-84D912F0104C%40gmail.com.


[ansible-project] Module yum and package?

2019-08-16 Thread Mike Eggleston
Yum says it will do a wild card on the update (equivalent to “yum update”). 
Will the module “package” also do a wildcard?

Mike

-- 
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/0B2CA4F7-80E9-42C0-8CA9-6B2DD34B016B%40gmail.com.


Re: [ansible-project] What is the best way to manage machines that aren't defined as hosts?

2019-08-16 Thread Mike Eggleston
Create a local, temporary file of the new hosts and environment variable 
ANSIBLE_INVENTORY?

Mike

> On Aug 16, 2019, at 00:34, Zolvaring  wrote:
> 
> I'm not sure I understand fully, but none of the hosts you are configuring 
> need Ansible to be installed for you make changes remotely. Instead of 
> defining your hosts in a CSV, define your hosts as part of Ansible inventory 
> and your tasks will loop through them naturally. You can also group hosts as 
> you had mentioned, and run task or assign vars to specific groups, just as 
> you had in your example. To execute a play only on remote esxi servers one 
> way is:
> 
> - name: configure esxi hosts
>   hosts: esxi-hosts
>   roles:
>  - your roles here
> 
> If I run this play and have 5 esxi hosts in my inventory group, then this 
> will run all roles or tasks each time for each of those 5 servers in parallel
> 
> Making use of group_vars files and host_vars files can change the play vars 
> based on the group.
> 
> 
>> On Thu, Aug 15, 2019, 9:15 PM Kurt Robinson  wrote:
>> I intend to Ansible to run deployment configuration on a number of Dell ESXi 
>> hosts in VMware using VMware and OpenManage modules.
>> 
>> In my past ansible training, my playbooks have always run from hosts that I 
>> have defined in an inventory file. The machines I wish to configure don't 
>> have ansible installed so they will be managed from the localhost node.
>> 
>> My question is, what is the best practice in running configuration tasks on 
>> these machines that aren't actual hosts within ansible?
>> 
>> Currently, I am thinking of creating a csv file which will contain the host 
>> information, then loop through each host and run my tasks to run on each 
>> host using read_csv.
>> 
>> 
>> 
>> pseudo:
>> 
>> - name: Read csv and send to task
>>   csv_read: csvname.csv
>>   task:
>> - taskname 
>>   passvar:
>> - csv.hostname
>> 
>> 
>> 
>> - name : Run task
>>   loop: name in csv.hostnames
>> do: something
>> 
>> 
>> 
>> To me this seems like I am under-engineering the solution a bit. Is there a 
>> better way I can do this?
>> 
>> Would I be able to add the list of hosts that I want to configure to an 
>> inventory file, then reference a group for which I will run my 
>> configurations on?
>> 
>> E.g.
>> 
>> inventory
>> 
>> [management]
>> 10.0.0.1
>> 10.0.0.2
>> 
>> [database]
>> 10.1.0.1
>> 10.1.0.2
>> 
>> __
>> 
>> - name: Set DNS on hosts
>>   vmware_module:
>> hostname: '{{ management group }}'
>> dns: 1.2.3.4
>> 
>> 
>> 
>> Thanks for taking the time.
>> 
>> 
>> -- 
>> 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/2c702252-eae3-461e-842f-989e80d88537%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/CAKEXu85Ga7EadHRB%3DyP8hCQqy7S%2BTqCKmkCp%2BTj5CV10LpL5Ew%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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/93B6A099-DFB3-464D-858C-D64FA5C2ADC8%40gmail.com.


[ansible-project] Modules in languages other than Python?

2019-08-08 Thread Mike Eggleston
This page: 
https://docs.ansible.com/ansible/2.3/dev_guide/developing_modules_general.html
states that modules can be in other languages. Are there any examples of this? 
I’m much more proficient in Perl than Python and would prefer to write in that 
language. 

An additional thought... I’m not sure I need to write any modules, but I want 
to know how if I do.

TIA

Mike

-- 
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/629094F9-DFA0-4743-868E-5B0FDFFC8FD1%40gmail.com.


Re: [ansible-project] Re: /etc/ntp.conf settings...?

2019-07-30 Thread Mike Eggleston
y
> .
> .
> .
> .
> .
>  
> Regards
> Phil
>  
> From: ansible-project@googlegroups.com  On 
> Behalf Of mikeegg1...@gmail.com
> Sent: 29 July 2019 17:55
> To: Ansible Project 
> Subject: [ansible-project] Re: /etc/ntp.conf settings...?
>  
> Figured out how to search.
> Still, if someone has a playbook already (working with both CentOS and Ubuntu 
> distributions of GNU/Linux).
>  
> Mike
> 
> On Monday, July 29, 2019 at 11:47:52 AM UTC-5, Mike Eggleston wrote:
> I haven't figured (yet) how to search the forum if this has been answered 
> (must have been; this is a common file).
> Is there a common playbook or module for setting NTP settings?
>  
> Mike
> -- 
> 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/2986d080-66bf-4d91-be6d-61f415451197%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/00692a6f5d1a4a479f313a4d26b04ce8%40bham.ac.uk.

-- 
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/52886D84-BCF6-47D6-BC8B-FBA2D309C97C%40gmail.com.


[ansible-project] Re: Am new to Ansible and i need a coach

2019-07-29 Thread Mike Eggleston
Sounds like homework.

Mike

On Thursday, July 4, 2019 at 9:21:08 AM UTC-5, Chukwu Gabriel wrote:
>
> Good Afternoon Sir,  my name is a Gabriel Chukwu an undergraduate of 
> Electrical Electronics Engineering. am new to ansible and I have a task I 
> have been working on, I would like you to be my private mentor and tutor to 
> help me out...
>
> my contact details are below
>
> Email: chuk...@gmail.com 
> WhatsApp 2348067227056
>
>
> here is the task
>  
> "Update the network device configurations using Ansible using separate 
> playbooks for each task
> - NTP
> - AAA
> - syslog
> - netflow
> - SSH
> - TACACS
> - SNMP
> Playbook to backup network device configurations
> Playbook to restore network device configurations"
>
> I have successfully set up my lab
>
> I have a GNS3 VM running in a VMware 
> I also have GNS3 installed with Network automation appliance installed
> I also have Cisco IOs installed 
>
>
> I look forward to hearing from you
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b10337a0-d133-4244-86e4-84f91df2ff4b%40googlegroups.com.


[ansible-project] Re: /etc/ntp.conf settings...?

2019-07-29 Thread Mike Eggleston
Figured out how to search.
Still, if someone has a playbook already (working with both CentOS and 
Ubuntu distributions of GNU/Linux).

Mike

On Monday, July 29, 2019 at 11:47:52 AM UTC-5, Mike Eggleston wrote:
>
> I haven't figured (yet) how to search the forum if this has been answered 
> (must have been; this is a common file).
> Is there a common playbook or module for setting NTP settings?
>
> Mike
>

-- 
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/2986d080-66bf-4d91-be6d-61f415451197%40googlegroups.com.


[ansible-project] /etc/ntp.conf settings...?

2019-07-29 Thread Mike Eggleston
I haven't figured (yet) how to search the forum if this has been answered 
(must have been; this is a common file).
Is there a common playbook or module for setting NTP settings?

Mike

-- 
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/d09d8909-d6fd-43ad-a5cc-6414f4ae1eb1%40googlegroups.com.