Re: [ansible-project] Re: is there a progress bar in TASK?

2020-05-17 Thread 'Karolis Pocius' via Ansible Project
The spacing on "register: update_result" is off -- you need to move it back
a bit (align it with "win_updates").

On Mon, May 18, 2020 at 3:34 PM Tony Wong  wrote:

> Still dont understand why its failing
>
> PLAY [Install updates on whitelist]
> ****
>
> TASK [Gathering Facts]
> **
>***
> ok: [rw-ctxweb-01.wsgr.com]
>
> TASK [Install windows updates]
> **
>  ***
> ok: [rw-ctxweb-01.wsgr.com]
>
> TASK [reboot host if required]
> *
> fatal: [rx]: FAILED! => {"msg": "The conditional check
> 'update_result.reboot_required == true' failed. The error was: error while
> evaluating conditional (update_result.reboot_required == true):
> 'update_result' is undefined\n\nThe error appears to be in
> '/home/tony/windows/install_windows_KBx_updates.yml': line 16, column
> 7, but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\n\n- name: reboot host
> if required\n  ^ here\n"}
>
>
>
> ---
> - name: Install updates on whitelist
>   hosts: all
>   tasks:
> - name: Install windows updates
>   win_updates:
> category_names:
> - SecurityUpdates
> whitelist:
> - KB4541505
> server_selection: windows_update
> state: installed
> log_path: c:\ansible_wu.txt
> register: update_result
>
> - name: reboot host if required
>   win_reboot:
>   when: update_result.reboot_required == true
>
> On Sun, May 17, 2020 at 1:09 PM David Foley  wrote:
>
>> A Quick Google Search Returned this for me. I'll assume you did the same?
>>
>>
>> https://stackoverflow.com/questions/41194021/how-can-i-show-progress-for-a-long-running-ansible-task
>>
>>
>>
>> On Sunday, May 17, 2020 at 6:26:50 PM UTC+1, Tony Wong wrote:
>>>
>>> is there a progress bar available in TASK?
>>>
>>> [image: Screen Shot 2020-05-17 at 10.25.19 AM.png]
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/1561b216-726e-47f2-956e-f862b12d3cf6%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/CALmkhkrFoZkV3YhCYAkDY%2Bexm%2BzLGj9yQq-CmWMVNYoY5DRZRA%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/CABzwvP4cyDeJcXeTxu%2Br7gQX1qerwrW%2BbwsYZtLXcsJ%2Bw15zFA%40mail.gmail.com.


[ansible-project] Re: how to install a specific KB from windows update

2020-05-17 Thread Tony Wong
this is my error


FAILED! => {"msg": "The conditional check 'update_result.reboot_required == 
true' failed. The error was: error while evaluating conditional 
(update_result.reboot_required == true): 'update_result' is 
undefined\n\nThe error appears to be in 
'/home/tony/windows/install_windows_KBx_updates.yml': line 15, column 
7, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n- name: reboot host 
if required\n  ^ here\n"}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/14e35a8f-ec2c-483c-ad83-008e4cf0445b%40googlegroups.com.


Re: [ansible-project] Re: is there a progress bar in TASK?

2020-05-17 Thread Tony Wong
Still dont understand why its failing

PLAY [Install updates on whitelist]
****

TASK [Gathering Facts]
**
   ***
ok: [rw-ctxweb-01.wsgr.com]

TASK [Install windows updates]
**
 ***
ok: [rw-ctxweb-01.wsgr.com]

TASK [reboot host if required]
*
fatal: [rx]: FAILED! => {"msg": "The conditional check
'update_result.reboot_required == true' failed. The error was: error while
evaluating conditional (update_result.reboot_required == true):
'update_result' is undefined\n\nThe error appears to be in
'/home/tony/windows/install_windows_KBx_updates.yml': line 16, column
7, but may\nbe elsewhere in the file depending on the exact syntax
problem.\n\nThe offending line appears to be:\n\n\n- name: reboot host
if required\n  ^ here\n"}



---
- name: Install updates on whitelist
  hosts: all
  tasks:
- name: Install windows updates
  win_updates:
category_names:
- SecurityUpdates
whitelist:
- KB4541505
server_selection: windows_update
state: installed
log_path: c:\ansible_wu.txt
register: update_result

- name: reboot host if required
  win_reboot:
  when: update_result.reboot_required == true

On Sun, May 17, 2020 at 1:09 PM David Foley  wrote:

> A Quick Google Search Returned this for me. I'll assume you did the same?
>
>
> https://stackoverflow.com/questions/41194021/how-can-i-show-progress-for-a-long-running-ansible-task
>
>
>
> On Sunday, May 17, 2020 at 6:26:50 PM UTC+1, Tony Wong wrote:
>>
>> is there a progress bar available in TASK?
>>
>> [image: Screen Shot 2020-05-17 at 10.25.19 AM.png]
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "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/1561b216-726e-47f2-956e-f862b12d3cf6%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/CALmkhkrFoZkV3YhCYAkDY%2Bexm%2BzLGj9yQq-CmWMVNYoY5DRZRA%40mail.gmail.com.


Re: [ansible-project] Remove items from a variable with reject

2020-05-17 Thread Kernel Panic
That did the trick. 
Thank you so much!!!

El domingo, 17 de mayo de 2020, 19:04:48 (UTC-3), Vladimir Botka escribió:
>
> On Sun, 17 May 2020 13:57:57 -0700 (PDT) 
> Kernel Panic > wrote: 
>
> > List ... contains contains item1, item2, item3, item4, item5. I want to 
> > remove item1 and 2 (from myvar) 
> > 
> >   - set_fact: 
> > list_of_items: "{{ list.stdout_lines| 
> >reject('search', item )| 
> >list  }}" 
> >   with_items: "{{ myvar }}" 
>
> Use filter "difference". For example 
>
> - set_fact: 
> list_of_items: "{{ list.stdout_lines|difference(my_var) }}" 
>
> 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/e9e019d5-380c-4336-843d-cc7853937e41%40googlegroups.com.


Re: [ansible-project] Setting an intial cron job and leaving it alone on later plays

2020-05-17 Thread Ben Coleman


On 5/17/2020 7:49 AM, Vladimir Botka wrote:
> On Sun, 17 May 2020 05:37:10 -0400
> Ben Coleman  wrote:
>> "Don't replace this cron job if it is already in the crontab, even if it's
>> changed"
> 
> Get the list of jobs already present
> 
> - name: Get list of cron jobs
 

> Then run the task if the job isn't present
> 
> - name: Create cron job
 

Excellent!

And I note that this isn't even hinted at in the cron module
documentation.  I'll file this under "It may be worthwhile to experiment
and register the results of various modules to see when they produce
when their output is registered".  Also "Perhaps module documentation
should document what is produced when you register their output".

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/ef729725-26f3-b47a-0dc2-589aa062d8fa%40benshome.net.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Remove items from a variable with reject

2020-05-17 Thread Vladimir Botka
On Sun, 17 May 2020 13:57:57 -0700 (PDT)
Kernel Panic  wrote:

> List ... contains contains item1, item2, item3, item4, item5. I want to
> remove item1 and 2 (from myvar)
> 
>   - set_fact:
> list_of_items: "{{ list.stdout_lines|
>reject('search', item )| 
>list  }}"
>   with_items: "{{ myvar }}"

Use filter "difference". For example

- set_fact:
list_of_items: "{{ list.stdout_lines|difference(my_var) }}"

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/20200518000428.06acd8bb%40gmail.com.


pgpeo0pHrU1Y3.pgp
Description: OpenPGP digital signature


[ansible-project] Remove items from a variable with reject

2020-05-17 Thread Kernel Panic
Hello
I want to remove items from a variable using reject filter, I have 
something like this:

vars:
myvar:
  - item1
  - item2

List is the output of a command which contains  contains item1, item2 , 
item3, item4, item5, I want to remove item1 and 2 ( from myvar ) from the 
list with the code below
but is not working, any idea what am I doing wrong of different way to 
accomplish this?

  - set_fact:
list_of_items: "{{ list.stdout_lines | reject('search', item ) | 
list  }}"
  with_items: "{{ myvar }}"


Thanks
Regards

-- 
You received this message because you are subscribed to the Google Groups 
"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/ff97239a-38fb-4bf8-9c96-1ef6d17e7fb0%40googlegroups.com.


[ansible-project] Re: is there a progress bar in TASK?

2020-05-17 Thread David Foley
A Quick Google Search Returned this for me. I'll assume you did the same? 

https://stackoverflow.com/questions/41194021/how-can-i-show-progress-for-a-long-running-ansible-task



On Sunday, May 17, 2020 at 6:26:50 PM UTC+1, Tony Wong wrote:
>
> is there a progress bar available in TASK?
>
> [image: Screen Shot 2020-05-17 at 10.25.19 AM.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/1561b216-726e-47f2-956e-f862b12d3cf6%40googlegroups.com.


[ansible-project] Re: how to install a specific KB from windows update

2020-05-17 Thread David Foley
When you Run Windows Update it returns all available Updates as you can see 
from your Output it's skipping as they aren't in the Whitelist

Your WHEN statement is wrong.  you need to Set it to something like when: 
update_result.reboot_required == True 


On Sunday, May 17, 2020 at 6:43:28 PM UTC+1, Tony Wong wrote:
>
> I am trying to install a specific update KB4541509
>
> but it is not getting installed. I got the playbook running but not 
> getting installed
>
> here is from the ansible win log
>
> 2020-05-17 10:22:51Z Creating Windows Update session...
> 2020-05-17 10:22:51Z Create Windows Update searcher...
> 2020-05-17 10:22:51Z Setting the Windows Update Agent source catalog...
> 2020-05-17 10:22:51Z Requested search source is 'windows_update'
> 2020-05-17 10:22:51Z Search source set to 'windows_update' 
> (ServerSelection = 2)
> 2020-05-17 10:22:51Z Searching for updates to install
> 2020-05-17 10:28:12Z Found 6 updates
> 2020-05-17 10:28:12Z Creating update collection...
> 2020-05-17 10:28:12Z Skipping update d1fe2427-174b-4b7b-ba04-69aa90060d12 
> - Microsoft .NET Framework 4.8 for Windows Server 2012 R2 for x64 
> (KB4486105) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update ce061df5-b9f2-475f-9850-50ad5b7b9693 
> - 2020-02 Security Update for Adobe Flash Player for Windows Server 2012 R2 
> for x64-based Systems (KB4537759) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update ebfa39a3-52fe-4ff1-b7d4-375ad1654c04 
> - 2020-03 Servicing Stack Update for Windows Server 2012 R2 for x64-based 
> Systems (KB4540725) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 533cf583-0396-4862-a1d5-6200a46f82ba 
> - 2020-05 Security and Quality Rollup for .NET Framework 3.5, 4.5.2, 4.6, 
> 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows 8.1 and Server 2012 R2 for 
> x64 (KB4556401) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 2221dd34-39bb-4f16-b320-be49fe4a6b95 
> - Windows Malicious Software Removal Tool x64 - v5.82 (KB890830) as it was 
> not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 4aeb4fc1-39c2-4514-be30-33e57845a002 
> - 2020-05 Security Monthly Quality Rollup for Windows Server 2012 R2 for 
> x64-based Systems (KB4556846) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Calculating pre-install reboot requirement...
> 2020-05-17 10:28:12Z Native job completed with output: 
> Name   Value  
> 
> 
>   
>    -  
> 
> 
>   
> updates{}  
> 
> 
>  
> found_update_count 0  
> 
> 
>   
> changedFalse  
> 
> 
>   
> reboot_requiredFalse  
> 
> 
>   
> installed_update_count 0  
> 
> 
>   
> filtered_updates   {2221dd34-39bb-4f16-b320-be49fe4a6b95, 
> 4aeb4fc1-39c2-4514-be30-33e57845a002, d1fe2427-174b-4b7b-ba04-69aa90060d12, 
> ce061df5-b9f2-475f-9850-50ad5b7b9693...}
> 
>   
>
>
>
>
> not sure why it was looking for 

Re: [ansible-project] What are the possible setups for ansible in the cloud to configure on premise devices?

2020-05-17 Thread Vladimir Botka
On Sun, 17 May 2020 08:13:16 -0700 (PDT)
Nicolas Charalambous  wrote:

> "How do I use Ansible in a production environment to configure a large
> number of on-premise devices via a cloud environment?"

An elegant and flexible solution would be to build the architecture on
"ansible-pull" (similar to the PXE concept)
https://docs.ansible.com/ansible/latest/cli/ansible-pull.html#ansible-pull

Pre-configured ansible-pull on the on-premise device downloads 1st stage
playbook let's say firstboot.yml. This playbook reads the HW of the device
and decides how to proceed, e.g. configure network, security, cron, which
playbook to download next etc.

The centralised repository in the Cloud serves the purpose of providing the
content (collections, playbooks, roles, modules, plugins) and the
configuration data. Create local proxy to make the solution more secure and
robust.

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/20200517195339.3326a953%40gmail.com.


pgpZSpP28Sc2f.pgp
Description: OpenPGP digital signature


[ansible-project] how to install a specific KB from windows update

2020-05-17 Thread Tony Wong
I am trying to install a specific update KB4541509

but it is not getting installed. I got the playbook running but not getting 
installed

here is from the ansible win log

2020-05-17 10:22:51Z Creating Windows Update session...
2020-05-17 10:22:51Z Create Windows Update searcher...
2020-05-17 10:22:51Z Setting the Windows Update Agent source catalog...
2020-05-17 10:22:51Z Requested search source is 'windows_update'
2020-05-17 10:22:51Z Search source set to 'windows_update' (ServerSelection 
= 2)
2020-05-17 10:22:51Z Searching for updates to install
2020-05-17 10:28:12Z Found 6 updates
2020-05-17 10:28:12Z Creating update collection...
2020-05-17 10:28:12Z Skipping update d1fe2427-174b-4b7b-ba04-69aa90060d12 - 
Microsoft .NET Framework 4.8 for Windows Server 2012 R2 for x64 (KB4486105) 
as it was not found in the whitelist
2020-05-17 10:28:12Z Skipping update ce061df5-b9f2-475f-9850-50ad5b7b9693 - 
2020-02 Security Update for Adobe Flash Player for Windows Server 2012 R2 
for x64-based Systems (KB4537759) as it was not found in the whitelist
2020-05-17 10:28:12Z Skipping update ebfa39a3-52fe-4ff1-b7d4-375ad1654c04 - 
2020-03 Servicing Stack Update for Windows Server 2012 R2 for x64-based 
Systems (KB4540725) as it was not found in the whitelist
2020-05-17 10:28:12Z Skipping update 533cf583-0396-4862-a1d5-6200a46f82ba - 
2020-05 Security and Quality Rollup for .NET Framework 3.5, 4.5.2, 4.6, 
4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows 8.1 and Server 2012 R2 for 
x64 (KB4556401) as it was not found in the whitelist
2020-05-17 10:28:12Z Skipping update 2221dd34-39bb-4f16-b320-be49fe4a6b95 - 
Windows Malicious Software Removal Tool x64 - v5.82 (KB890830) as it was 
not found in the whitelist
2020-05-17 10:28:12Z Skipping update 4aeb4fc1-39c2-4514-be30-33e57845a002 - 
2020-05 Security Monthly Quality Rollup for Windows Server 2012 R2 for 
x64-based Systems (KB4556846) as it was not found in the whitelist
2020-05-17 10:28:12Z Calculating pre-install reboot requirement...
2020-05-17 10:28:12Z Native job completed with output: 
Name   Value



   -



updates{}  


 
found_update_count 0



changedFalse



reboot_requiredFalse



installed_update_count 0



filtered_updates   {2221dd34-39bb-4f16-b320-be49fe4a6b95, 
4aeb4fc1-39c2-4514-be30-33e57845a002, d1fe2427-174b-4b7b-ba04-69aa90060d12, 
ce061df5-b9f2-475f-9850-50ad5b7b9693...}

  




not sure why it was looking for those KB as I whitelisted only 1 KB to 
install


[image: Screen Shot 2020-05-17 at 10.40.06 AM.png]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

[ansible-project] is there a connection plugin to use the libvirt serial console?

2020-05-17 Thread IaV
I'm in a weird chicken and the egg problem. I can't/prefer not to use dhcp 
on my created libvirt networks for provisioning. I need to configure the 
dhcp VM to provide address to all the other VMs without itself having an 
ip. I have a workaround that I kinda dislike but will use if no other 
option presents itself.

-- 
You received this message because you are subscribed to the Google Groups 
"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/b4d25a63-5ad1-4a72-b3ca-56c3c1a78bfa%40googlegroups.com.


[ansible-project] is there a progress bar in TASK?

2020-05-17 Thread Tony Wong
is there a progress bar available in TASK?

[image: Screen Shot 2020-05-17 at 10.25.19 AM.png]

-- 
You received this message because you are subscribed to the Google Groups 
"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/adc420cf-7b3a-42e4-aa91-62be6c59cae0%40googlegroups.com.


Re: [ansible-project] What are the possible setups for ansible in the cloud to configure on premise devices?

2020-05-17 Thread Dick Visser
Hi

This sounds a bit atypical tbh. It's more common (and useful imho) to do it
the other way around. You have an "on-prem" ansible control node, which is
used to configure cloud based VMs.

I wonder what the usecase for your setup is?
As you already found out, you will have to set up and manage Vpn solutions
to reach your on-prem stuff. The nice thing of ansible is it's simplicity.

I guess I don't see why you'd want your control node to be "in the cloud".
If that sat next/close to the on-prem devices then you can skip the vpn
complexity.

Dick

On Sun, 17 May 2020 at 17:13, Nicolas Charalambous 
wrote:

> Hello guys, I'm in the last year of my studies and the question in the
> title is to help me write my bachelor thesis.
>
> My bachelor thesis is part a technical research(make a proof of concept.)
> and literature study.
>
> The research that I did was based around 1 question: "How do I use
> Ansible in a production environment to configure a large number of
> on-premise devices via a cloud environment?"
>
> So the following was what I did for the proof of concept:
>
> I installed ansible in a cloud environment (google cloud) and created 3
> VM's in VMware workstation.
>
> To be able to configure those 3 VM's, I set up an OpenVPN connection.The
> ansible server in the cloud also became an OpenVPN server. I also created a
> new local VM that acted as an OpenVPN client that then routed all the
> traffic to the other local VM's using iptables rules.
>
> I now realize that the setup of the VPN needed to be the other way around
> (the ansible server should have been the VPN client).
>
> I was wondering what other setups are possible in this scenario and what
> other hardware or software would be necessary (for example: is pfsense an
> option? or a proxy?).
>
> Say for example I have ansible installed in the cloud on a VM and I want
> to configure devices at the office, how would you do it?
>
> Would really appreciate your feedback!
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/02f78734-b06c-46f4-a638-44c7e1c7e148%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/CAL8fbwN9Pm3m%2BuF19dYRm0m3qMSFhO_wPu_y%3DuJ0tTdG7TN-hg%40mail.gmail.com.


[ansible-project] What are the possible setups for ansible in the cloud to configure on premise devices?

2020-05-17 Thread Nicolas Charalambous


Hello guys, I'm in the last year of my studies and the question in the 
title is to help me write my bachelor thesis.

My bachelor thesis is part a technical research(make a proof of concept.) 
and literature study. 

The research that I did was based around 1 question: "How do I use Ansible 
in a production environment to configure a large number of on-premise 
devices via a cloud environment?"

So the following was what I did for the proof of concept:

I installed ansible in a cloud environment (google cloud) and created 3 
VM's in VMware workstation.

To be able to configure those 3 VM's, I set up an OpenVPN connection.The 
ansible server in the cloud also became an OpenVPN server. I also created a 
new local VM that acted as an OpenVPN client that then routed all the 
traffic to the other local VM's using iptables rules.

I now realize that the setup of the VPN needed to be the other way around 
(the ansible server should have been the VPN client).

I was wondering what other setups are possible in this scenario and what 
other hardware or software would be necessary (for example: is pfsense an 
option? or a proxy?).

Say for example I have ansible installed in the cloud on a VM and I want to 
configure devices at the office, how would you do it?

Would really appreciate your feedback!

-- 
You received this message because you are subscribed to the Google Groups 
"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/02f78734-b06c-46f4-a638-44c7e1c7e148%40googlegroups.com.


Re: [ansible-project] Ansible import excel format price list from supplier and export to remote inventory unit how to

2020-05-17 Thread Stefan Hornburg (Racke)
On 5/17/20 2:08 PM, Michael Chan wrote:
> Hi racke
> If the web site requires login user/pw for access right, what module I should 
> use?
> Thanks
> MC

Hello Michael,

please checkout the examples in the documentation of the URL module:
https://docs.ansible.com/ansible/latest/modules/uri_module.html.

They show how to login and keep the cookie for for subsequent requests.

Regards
 Racke

> 
> On Thu., May 14, 2020, 1:32 a.m. Stefan Hornburg (Racke),  > wrote:
> 
> On 5/14/20 8:28 AM, Michael Chan wrote:
> > Hi I am not sure if this idea even possible, I want to use Ansible to 
> pull price list from suppliers and remotely send
> > and (copy) into designated inventory (remote servers) these update 
> price lists are in excel and once the price
> list are
> > updated, the cost and budget are also updated based on the latest 
> changes, can someone please help me if there is a
> > module can do such task.
> >
> 
> It is likely that this is possible, you probably can utilize standard 
> Ansible modules for your project.
> 
> "uri" for pulling price lists
> "copy" for sending the price lists to the remote servers
> "command" to run the updates
> 
> Regards
>          Racke
> 
> > --
> > You received this message because you are subscribed to the Google 
> Groups "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/18638e9b-857c-48a8-8810-36a9c01e%40googlegroups.com
> >
> 
> .
> 
> 
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/8849a184-27e5-833d-33ce-c76656cbcfe5%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/CAEjfaEfgF_nO3tEyVGakKR%3DtFTri4YBVGgmaNTm%2BDrB7kraLLw%40mail.gmail.com
> .


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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7acfe493-cd02-0c44-aea0-d649b1cd65af%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Ansible import excel format price list from supplier and export to remote inventory unit how to

2020-05-17 Thread Michael Chan
Hi racke
If the web site requires login user/pw for access right, what module I
should use?
Thanks
MC

On Thu., May 14, 2020, 1:32 a.m. Stefan Hornburg (Racke), 
wrote:

> On 5/14/20 8:28 AM, Michael Chan wrote:
> > Hi I am not sure if this idea even possible, I want to use Ansible to
> pull price list from suppliers and remotely send
> > and (copy) into designated inventory (remote servers) these update price
> lists are in excel and once the price list are
> > updated, the cost and budget are also updated based on the latest
> changes, can someone please help me if there is a
> > module can do such task.
> >
>
> It is likely that this is possible, you probably can utilize standard
> Ansible modules for your project.
>
> "uri" for pulling price lists
> "copy" for sending the price lists to the remote servers
> "command" to run the updates
>
> Regards
>  Racke
>
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to
> > ansible-project+unsubscr...@googlegroups.com  ansible-project+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/18638e9b-857c-48a8-8810-36a9c01e%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/18638e9b-857c-48a8-8810-36a9c01e%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8849a184-27e5-833d-33ce-c76656cbcfe5%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/CAEjfaEfgF_nO3tEyVGakKR%3DtFTri4YBVGgmaNTm%2BDrB7kraLLw%40mail.gmail.com.


Re: [ansible-project] Setting an intial cron job and leaving it alone on later plays

2020-05-17 Thread Vladimir Botka
On Sun, 17 May 2020 05:37:10 -0400
Ben Coleman  wrote:

> ... prepping a cron job that can be completed and enabled
> 
> - name: Create cron job
>   cron:
> name: Drupal cron job
> disabled: true
> minute: "*/15"
> job: curl --silent --compressed url
> user: "{{ username }}"
> 
> "Don't replace this cron job if it is already in the crontab, even if it's
> changed"

Get the list of jobs already present

- name: Get list of cron jobs
  cron:
user: "{{ username }}"
name: NOT_EXISTENT
state: absent
  register: result

- name: Display list of cron jobs
  debug:
var: result.jobs

Then run the task if the job isn't present

- name: Create cron job
  cron:
name: Drupal cron job
disabled: true
minute: "*/15"
job: curl --silent --compressed url
user: "{{ username }}"
  when: "'Drupal cron job' not in result.jobs"

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/20200517134946.2708031c%40gmail.com.


pgpQZLuSDwKmw.pgp
Description: OpenPGP digital signature


[ansible-project] Setting an intial cron job and leaving it alone on later plays

2020-05-17 Thread Ben Coleman
I've got a playbook for preparing new Drupal websites.  It doesn't
itself go through the full installation (which is interactive), but
preps what is needed to complete the installation - installing drupal
code, setting up Apache2, creating database user and the database
itself, etc.

One of the things I'm doing is prepping a cron job that can be completed
 and enabled after the manual part of the configuration is done.  I'm
doing this:

- name: Create cron job
  cron:
name: Drupal cron job
disabled: true
minute: "*/15"
job: curl --silent --compressed url
user: "{{ username }}"

The idea is that the 'url' in the job will be manually replaced by the
required url (obtainable from the Drupal Status Report screen, and
containing many, many random characters), and enabled.

Of course, if I run this playbook again, the job is going to be changed
back to 'curl --silent --compressed url', and of course, I don't want
that, but I do want to be able to re-run this playbook against a site,
to apply appropriate changes.

The cron module, unlike some other Ansible modules, doesn't seem to have
a way to say "Don't replace this cron job if it is already in the
crontab, even if it's changed" (as opposed to, say, template, which has
a 'force: no' which will keep you from overwriting an already existing
file).  Having the name parameter will keep it from adding multiple
copies of a cron job, but it doesn't prevent a modified version from
being overwritten.

Am I missing something?  Is there a not-too-hacky way to do what I want
to do here?

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/8dc3dc4d-78b2-9e64-2e31-cbda4d132efb%40benshome.net.


signature.asc
Description: OpenPGP digital signature