[ansible-project] Integrating Microsoft LAPS and ansible
Hello All, I am using ansible for patching windows machines in my domain. The process is working fine with patches being installed till date over Winrm and kerberos as authentication. But now they have decided to use LAPS in the environment .So, the password keep on changing and i am not able to access with the same password and patch the servers. So, i tried researching on the internet about it and how to integrate it with the current setup.But I am not able to do it. Is it feasible and possible with ansible to use LAPS to retrieve password and patch windows machines as I am patching 5-10 machines at a stretch and all are having different passwords. And also is it secure to integrate it with ansible If anyone have used it in their environment and help me out in this ,it would be great. As, I am completely blank on this and how to integrate it. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "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/f806e457-705b-4b2d-a2cb-efbdf37c337co%40googlegroups.com.
[ansible-project] Re: Integrating Microsoft LAPS and ansible
Hello , Thanks for you reply. I will test it out the same. Thanks again. On Tuesday, July 14, 2020 at 1:12:56 AM UTC+5:30, jbor...@gmail.com wrote: > > Theres the laps_password > https://docs.ansible.com/ansible/latest/plugins/lookup/laps_password.html > lookup that you can use to retrieve a password set by LAPS from AD. > Unfortunately it requires a few extra bits to be installed on your host > like OpenLDAP but it's definitely possible. > On Thursday, July 9, 2020 at 8:52:05 PM UTC+10 harshc...@gmail.com wrote: > >> Hello All, >> >> I am using ansible for patching windows machines in my domain. The >> process is working fine with patches being installed till date over Winrm >> and kerberos as authentication. >> >> But now they have decided to use LAPS in the environment .So, the >> password keep on changing and i am not able to access with the same >> password and patch the servers. >> >> So, i tried researching on the internet about it and how to integrate it >> with the current setup.But I am not able to do it. >> >> Is it feasible and possible with ansible to use LAPS to retrieve password >> and patch windows machines as I am patching 5-10 machines at a stretch and >> all are having different passwords. And also is it secure to integrate it >> with ansible >> >> If anyone have used it in their environment and help me out in this ,it >> would be great. As, I am completely blank on this and how to integrate it. >> >> Thanks in advance. >> > -- You received this message because you are subscribed to the Google Groups "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/b7c6d18d-fc15-48ff-84b9-e58c2dbbeab9o%40googlegroups.com.
[ansible-project] Re: Integrating Microsoft LAPS and ansible
Hello, I have one doubt like not all systems in my environment are configured with LAPS as of now. So some of the systems are having LAPS others are having LDAP . So will both the things work out. ie. basically if i install OpenLDAP , is it standalone package/module or will it replace the current configuration settings. ie. LDAP Thanks for your reply. On Tuesday, July 14, 2020 at 1:12:56 AM UTC+5:30, jbor...@gmail.com wrote: > > Theres the laps_password > https://docs.ansible.com/ansible/latest/plugins/lookup/laps_password.html > lookup that you can use to retrieve a password set by LAPS from AD. > Unfortunately it requires a few extra bits to be installed on your host > like OpenLDAP but it's definitely possible. > On Thursday, July 9, 2020 at 8:52:05 PM UTC+10 harshc...@gmail.com wrote: > >> Hello All, >> >> I am using ansible for patching windows machines in my domain. The >> process is working fine with patches being installed till date over Winrm >> and kerberos as authentication. >> >> But now they have decided to use LAPS in the environment .So, the >> password keep on changing and i am not able to access with the same >> password and patch the servers. >> >> So, i tried researching on the internet about it and how to integrate it >> with the current setup.But I am not able to do it. >> >> Is it feasible and possible with ansible to use LAPS to retrieve password >> and patch windows machines as I am patching 5-10 machines at a stretch and >> all are having different passwords. And also is it secure to integrate it >> with ansible >> >> If anyone have used it in their environment and help me out in this ,it >> would be great. As, I am completely blank on this and how to integrate it. >> >> Thanks in advance. >> > -- You received this message because you are subscribed to the Google Groups "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/bb10e9fa-49ce-4679-9dba-34f6e7086431o%40googlegroups.com.
[ansible-project] Re: Integrating Microsoft LAPS and ansible
Hello Jordan, Thanks for your reply . I am trying to do the same what you explained. Will post my queries if got any issues. Thanks again. On Thursday, July 16, 2020 at 12:12:20 AM UTC+5:30, Jordan Borean wrote: > > I don’t understand what you mean sorry. OpenLDAP is required on the > controller because that’s a dependency of python-ldap that the lookup uses > https://www.python-ldap.org/en/python-ldap-3.3.0/installing.html#installing. > If you already have it installed then you don’t need to reinstall it. > > If some hosts use LAPS then you can use this for plugin to get the > password, for the others that don’t then you need some other mechanism to > get the password. -- You received this message because you are subscribed to the Google Groups "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/6349c1a6-bcb3-4afb-8bc0-269d50ef70cco%40googlegroups.com.
[ansible-project] playbook to compare and update hostvars in host file
Hello All, I am trying to update /etc/hosts file if there is any changes in the host extra variables by comparing it from a csv file [windows] Server01.test.com ansible_user="admin" ansible_password="password" Server02.test.com ansible_user="admin" ansible_password="Welcome" So suppose the password is changed for the systems . *password.csv* Server01.test.com passwordNew Server02.test.com WelcomeNew So, how to compare and change the values in the existing host file. Please if anyone having any idea or script for this will be a great help for me. Thanks in advance *Regards* *Harsh* -- You received this message because you are subscribed to the Google Groups "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/63fa30be-ce6c-4485-8af3-838a7cf44efao%40googlegroups.com.
Re: [ansible-project] playbook to compare and update hostvars in host file
Hello Visser, Thanks for your reply. Can you give an example on what you explained like *Removing the data from the inventory seems the easiest *.How to achieve this. Thanks in advance. *Regards* *Harsh* On Thursday, September 3, 2020 at 3:33:02 PM UTC+5:30, Dick Visser wrote: > > You now appear to have two sources of truth. I would try to have one. > Removing the data from the inventory seems the easiest. > > > On Thu, 3 Sep 2020 at 07:43, harsh chawda > wrote: > >> Hello All, >> >> I am trying to update /etc/hosts file if there is any changes in the host >> extra variables by comparing it from a csv file >> >> [windows] >> Server01.test.com ansible_user="admin" ansible_password="password" >> Server02.test.com ansible_user="admin" ansible_password="Welcome" >> >> So suppose the password is changed for the systems . >> >> *password.csv* >> Server01.test.com passwordNew >> Server02.test.com WelcomeNew >> >> So, how to compare and change the values in the existing host file. >> >> Please if anyone having any idea or script for this will be a great help >> for me. >> >> Thanks in advance >> >> *Regards* >> *Harsh* >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> >> >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible...@googlegroups.com . >> >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/63fa30be-ce6c-4485-8af3-838a7cf44efao%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/63fa30be-ce6c-4485-8af3-838a7cf44efao%40googlegroups.com?utm_medium=email&utm_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. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/505bf5b0-6bd0-46d9-b4f0-0e02d42ce478o%40googlegroups.com.
Re: [ansible-project] playbook to compare and update hostvars in host file
Hello Vladimir, Thanks for your reply. I will try to implement the same and hope it works out. Thanks a lot again. *Regards* *Harsh* On Thursday, September 3, 2020 at 5:20:26 PM UTC+5:30, Vladimir Botka wrote: > > On Wed, 2 Sep 2020 22:43:42 -0700 (PDT) > harsh chawda > wrote: > > > *hosts* > > [windows] > > Server01.test.com ansible_user="admin" ansible_password="password" > > Server02.test.com ansible_user="admin" ansible_password="Welcome" > > > > *password.csv* > > Server01.test.com passwordNew > > Server02.test.com WelcomeNew > > > > how to compare and change the values in the existing host file. > > Use "read_csv" to read the data. For example > > - read_csv: > path: password.csv > delimiter: ' ' > fieldnames: [host, passwd] > register: my_db > - debug: > var: my_db.list > > There are more options to replace the passwords. Edit the host file > (1,2), create new host file from a template 93), or create new group > dynamically (4). > > 1) Module "replace", which might the first choice, seems to have an > issue #47917. The parameter "after' doesn't work as expected. > https://github.com/ansible/ansible/issues/47917#issuecomment-686339762 > > For example, the parameter "after" doesn't match the section > "[windows]" in the task below. If you remove the "after" parameter > the task works fine. If there are more sections (groups) with the > same hosts all passwords will be replaced not only the passwords in > the section [windows] > > - replace: > path: hosts > after: '^\[windows\]$' > regexp: '^{{ item.host }}(.*)ansible_password=(.*)$' > replace: '{{ item.host }}\1ansible_password="{{ item.passwd > }}"' > loop: "{{ my_db.list }}" > > 2) Module "lineinfile" works as expected, but also here it's not > possible to select a section of the file > > - lineinfile: > path: hosts > regexp: '^{{ item.host }}(.*)ansible_password=(.*)$' > line: '{{ item.host }}\1ansible_password="{{ item.passwd }}"' > loop: "{{ my_db.list }}" > > 3) The only save option seems to be "template", but you'll have to > keep all data of the hosts in a data structure. Either a list or a > dictionary. > > 4) There is one more option. Create new group of hosts in the first > play dynamically and use it in the second play. For example, the > playbook below > > - hosts: localhost > tasks: > - read_csv: > path: password.csv > delimiter: ' ' > fieldnames: [host, passwd] > register: my_db > - add_host: > groups: > - my_windows > hostname: "{{ item.host }}" > ansible_user: admin > ansible_password: "{{ item.passwd }}" > loop: "{{ my_db.list }}" > - hosts: my_windows > gather_facts: false > tasks: > - debug: > var: ansible_password > > gives (abridged) > > TASK [debug] > ok: [Server01.test.com] => { > "ansible_password": "passwordNew" > } > ok: [Server02.test.com] => { > "ansible_password": "WelcomeNew" > } > > -- > Vladimir Botka > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4c049ff2-64c3-4af2-9b5e-25fd6064abfao%40googlegroups.com.
Re: [ansible-project] playbook to compare and update hostvars in host file
Hello Vladimir, I am following your 4th option ie *Create new group of hosts in the first play dynamically and use it in the second play *. It is executing successfully , but inside /etc/hosts no entry is found for the host name and password. Please help me on this. Thanks, *Regards* *Harsh* On Thursday, September 3, 2020 at 5:20:26 PM UTC+5:30, Vladimir Botka wrote: > > On Wed, 2 Sep 2020 22:43:42 -0700 (PDT) > harsh chawda > wrote: > > > *hosts* > > [windows] > > Server01.test.com ansible_user="admin" ansible_password="password" > > Server02.test.com ansible_user="admin" ansible_password="Welcome" > > > > *password.csv* > > Server01.test.com passwordNew > > Server02.test.com WelcomeNew > > > > how to compare and change the values in the existing host file. > > Use "read_csv" to read the data. For example > > - read_csv: > path: password.csv > delimiter: ' ' > fieldnames: [host, passwd] > register: my_db > - debug: > var: my_db.list > > There are more options to replace the passwords. Edit the host file > (1,2), create new host file from a template 93), or create new group > dynamically (4). > > 1) Module "replace", which might the first choice, seems to have an > issue #47917. The parameter "after' doesn't work as expected. > https://github.com/ansible/ansible/issues/47917#issuecomment-686339762 > > For example, the parameter "after" doesn't match the section > "[windows]" in the task below. If you remove the "after" parameter > the task works fine. If there are more sections (groups) with the > same hosts all passwords will be replaced not only the passwords in > the section [windows] > > - replace: > path: hosts > after: '^\[windows\]$' > regexp: '^{{ item.host }}(.*)ansible_password=(.*)$' > replace: '{{ item.host }}\1ansible_password="{{ item.passwd > }}"' > loop: "{{ my_db.list }}" > > 2) Module "lineinfile" works as expected, but also here it's not > possible to select a section of the file > > - lineinfile: > path: hosts > regexp: '^{{ item.host }}(.*)ansible_password=(.*)$' > line: '{{ item.host }}\1ansible_password="{{ item.passwd }}"' > loop: "{{ my_db.list }}" > > 3) The only save option seems to be "template", but you'll have to > keep all data of the hosts in a data structure. Either a list or a > dictionary. > > 4) There is one more option. Create new group of hosts in the first > play dynamically and use it in the second play. For example, the > playbook below > > - hosts: localhost > tasks: > - read_csv: > path: password.csv > delimiter: ' ' > fieldnames: [host, passwd] > register: my_db > - add_host: > groups: > - my_windows > hostname: "{{ item.host }}" > ansible_user: admin > ansible_password: "{{ item.passwd }}" > loop: "{{ my_db.list }}" > - hosts: my_windows > gather_facts: false > tasks: > - debug: > var: ansible_password > > gives (abridged) > > TASK [debug] > ok: [Server01.test.com] => { > "ansible_password": "passwordNew" > } > ok: [Server02.test.com] => { > "ansible_password": "WelcomeNew" > } > > -- > Vladimir Botka > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/26b83499-2ead-48c5-a8db-be1c7a2a7bfbo%40googlegroups.com.
[ansible-project] Executing remote PowerShell script not generating required output
Hello All, I am trying to execute a PowerShell script present on remote system. It is executing successfully from ansible playbook side. After execution it should generate a *password.csv* file on the remote system, but that file is not getting generated. *My plabook:* - name: test hosts: test tasks: - name: warning win_shell: powershell.exe -ExecutionPolicy ByPass -File C:\\GeneratePassword.ps1 Please help me on this if anyone having any idea. Thanks in advance *Regards* *Harsh* -- You received this message because you are subscribed to the Google Groups "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/6a1bfc60-b5c9-4d28-b97f-3ee1d8bf0ec2o%40googlegroups.com.
Re: [ansible-project] Reg: VMware Tools install using Ansible
Hello, Thanks for your reply.. Actually the vms are already created and are not having vmware tools pre installed. So I have to install tools on all those servers like 100 of them.. *Harsh chawda* On Wed, 19 May, 2021, 3:21 pm Wei-Yen Tan, wrote: > There are ways to instruct through the api and there maybe a task for it > but I am wondering why you couldn't bake it in to the template? > > Get Outlook for iOS <https://aka.ms/o0ukef> > -- > *From:* ansible-project@googlegroups.com > on behalf of harshc...@gmail.com > *Sent:* Wednesday, May 19, 2021 9:45:28 PM > *To:* Ansible Project > *Subject:* [ansible-project] Reg: VMware Tools install using Ansible > > Hello All, > > I have a requirement in which I have to install VMware tools on VMs i > created on VSphere, as by default its not present when i am creating a VM. > > Is it possible using ansible or using any other script to install it on > the freshly created VM. > > Thanks in advance > > *Harsh Chawda* > > -- > You received this message because you are subscribed to the Google Groups > "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/b064b1ce-0ed3-4b89-a11c-466e60292861n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/b064b1ce-0ed3-4b89-a11c-466e60292861n%40googlegroups.com?utm_medium=email&utm_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/SYBPR01MB56163C57684E872F76CD5057AD2B9%40SYBPR01MB5616.ausprd01.prod.outlook.com > <https://groups.google.com/d/msgid/ansible-project/SYBPR01MB56163C57684E872F76CD5057AD2B9%40SYBPR01MB5616.ausprd01.prod.outlook.com?utm_medium=email&utm_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/CAL8LLHCR%2BWyuRxdLT8_SZhWPJLdcPshp3k1Y6J-PNG3bRtT%3D4Q%40mail.gmail.com.
Re: [ansible-project] Install Packages after VM is created in VSphere
Hello Daeme, Thanks a lot for your help...😊💛 Regards Harsh Chawda On Sat, Jul 16, 2022, 1:22 AM Seth Daemen wrote: > Hello harsch, > > that step is automatic zie line 14 in my example. > > Create a vm and do action on it (github.com) > <https://gist.github.com/daemenseth/8fe5c46957846d8aa4790ac698423c71> > > Op wo 13 jul. 2022 om 07:03 schreef harshc...@gmail.com < > harshchawd...@gmail.com>: > >> Hello Daeme, >> >> Thats just great and what i needed. Just a small doubt, what if its a >> single click deployment process and i want everything to be done without >> manual intervention. Like create VM, Do patching and the install softwares. >> >> But here you told *"Then we add that machine to the inventory"* is that >> step manual ? If yes how to make it automated. >> >> Thanks a lot, >> >> *Regards* >> *Harsh Chawda* >> >> On Tuesday, July 12, 2022 at 11:49:29 PM UTC+5:30 daeme...@gmail.com >> wrote: >> >>> What I do is we create the vm. I use there a custom role for. >>> Then we add that machine to the inventory. This action in in memory in a >>> prestage group. >>> The prestage group in the inventory has the credential and info to >>> connect. >>> And then we connect to that machine in the same playbook. >>> >>> For a example see: create vm >>> <https://gist.github.com/daemenseth/8fe5c46957846d8aa4790ac698423c71> >>> >>> >>> Op maandag 11 juli 2022 om 10:35:56 UTC+2 schreef abhijeet@gmail.com >>> : >>> >>>> Hi Harsha, >>>> I have used an input yaml file to give all the required variable values >>>> for the role to work. >>>> used this module community.vmware.vmware_vm_shell: extensively to >>>> avoid opening fw ports. >>>> As I am not connecting the VM over nw i dont need to add it in the >>>> inventory. >>>> All required installers are part of the Template but even if they are >>>> not you can use this module community.vmware.vsphere_copy to copy >>>> files without nw. >>>> >>>> I am doing this in vCenter so that was the difference against your use >>>> case for Azure. >>>> >>>> On Mon, 11 Jul 2022 at 06:01, harshc...@gmail.com >>>> wrote: >>>> >>>>> Hello Abhijeet, >>>>> >>>>> Thanks a lot for your information. Is there any way i can have a look >>>>> on the roles you built or how you did it? It will be really helpful. >>>>> As i am clueless on how to achieve this. I am okay till VM creation, >>>>> but how to connect to the VM on the next task and do activities i am bit >>>>> confused on that. >>>>> >>>>> Thanks, >>>>> >>>>> Regards >>>>> Harsh >>>>> >>>>> On Sunday, July 10, 2022 at 7:09:28 PM UTC+5:30 abhijeet@gmail.com >>>>> wrote: >>>>> >>>>>> Hi Harsh, >>>>>> >>>>>> I just finished something like this. >>>>>> a Role with multiple tasks to install more 6 agents, make registry >>>>>> changes, add HDDs and format them, add more than one NIC and assign >>>>>> correct >>>>>> IP and a lot more.. >>>>>> >>>>>> I have another role to Patch the Template working on scheduling that >>>>>> Role/Playbook. >>>>>> >>>>>> Warm Regards, >>>>>> Abhi >>>>>> >>>>>> On Fri, 8 Jul 2022 at 13:31, harshc...@gmail.com >>>>>> wrote: >>>>>> >>>>>>> >>>>>>> Hello All, >>>>>>> >>>>>>> I am Creating VM in vCenter using *community.vmware.vmware_guest, *after >>>>>>> the VM is Created I have certain prerequisites to be fulfilled: >>>>>>> >>>>>>>- Do Patching >>>>>>>- Do some package installation. >>>>>>>- And some more >>>>>>> >>>>>>> How to accomplish this. I am able to create the VM then in the next >>>>>>> task how to connect to VM and perform the above mentioned tasks. >>>>>>> >>>>>>> Just In case in Terraform there is remote-exec and local-exec >>>>>>> modules, after