[ansible-project] Query related to junipernetworks.junos.junos_interfaces

2020-10-26 Thread debasmita hazra
Hello All,

I am just starting out with working on Ansible. Hence, my query might be 
very elementary in nature but I cannot seem to get over it. I am trying to 
basically disable a port on a Juniper switch using the junos_interfaces 
module. However, I run into an error stating the following-*"msg": 
"Unsupported parameters for (junos_interfaces) module: provider Supported 
parameters include: config, running_config, state"*

*}*
This is a new module that got introduced in Ansible 2.9. The new module 
replaced the existing module- junos_interface (without the s at the end). I 
can run the playbook using the old module but not the new module. The old 
module doesn't need a config parameter, unlike the new one. I'd appreciate 
any help in understanding how to overcome this error.

Thanks,
Debasmita

Following are my environment details:

*bash-5.0# ansible --version*

ansible 2.10.2

  config file = /project/ansible.cfg

  configured module search path = ['/root/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']

  ansible python module location = /usr/lib/python3.8/site-packages/ansible

  executable location = /usr/bin/ansible

  python version = 3.8.5 (default, Jul 20 2020, 23:11:29) [GCC 9.3.0]



Following is the playbook using the new module:

*bash-5.0# cat port-down-new.yml *


---

- name: "Get Junos OS configuration."

  hosts: junos

  roles:

- Juniper.junos

  connection: local

  gather_facts: no


  tasks:

- name: Retrieve facts from devices running Junos OS  

 * junos_interfaces:*

*config:*

- name: ge-0/0/1

  enabled: no



Following is the error I receive: 

*bash-5.0# ansible-playbook port-down-new.yml -i junos.inv -vvv*

ansible-playbook 2.10.2

  config file = /project/ansible.cfg

  configured module search path = ['/root/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']

  ansible python module location = /usr/lib/python3.8/site-packages/ansible

  executable location = /usr/bin/ansible-playbook

  python version = 3.8.5 (default, Jul 20 2020, 23:11:29) [GCC 9.3.0]

Using /project/ansible.cfg as config file

host_list declined parsing /project/junos.inv as it did not pass its 
verify_file() method

auto declined parsing /project/junos.inv as it did not pass its 
verify_file() method

yaml declined parsing /project/junos.inv as it did not pass its 
verify_file() method

Parsed /project/junos.inv inventory source with ini plugin

redirecting (type: modules) ansible.builtin.junos_interfaces to 
junipernetworks.junos.junos_interfaces


PLAYBOOK: port-down-new.yml 
***

1 plays in port-down-new.yml


PLAY [Get Junos OS configuration.] 


META: ran handlers


TASK [Retrieve facts from devices running Junos OS] 
***

*task path: /project/port-down-new.yml:11*

redirecting (type: action) ansible.builtin.junos to 
junipernetworks.junos.junos

redirecting (type: action) ansible.builtin.junos to 
junipernetworks.junos.junos

<10.85.242.183> using connection plugin ansible.netcommon.netconf (was 
local)

<10.85.242.183> ESTABLISH LOCAL CONNECTION FOR USER: root

<10.85.242.183> EXEC /bin/sh -c 'echo ~root && sleep 0'

<10.85.242.183> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/root/.ansible/tmp `"&& mkdir "` echo 
/root/.ansible/tmp/ansible-tmp-1603774438.2565486-1028-27196404287972 `" && 
echo ansible-tmp-1603774438.2565486-1028-27196404287972="` echo 
/root/.ansible/tmp/ansible-tmp-1603774438.2565486-1028-27196404287972 `" ) 
&& sleep 0'

redirecting (type: modules) ansible.builtin.junos_interfaces to 
junipernetworks.junos.junos_interfaces

 Attempting python interpreter discovery

<10.85.242.183> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command 
-v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v 
'"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v 
'"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v 
'"'"'/usr/libexec/platform-python'"'"'; command -v 
'"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && 
sleep 0'

<10.85.242.183> EXEC /bin/sh -c '/usr/bin/python && sleep 0'

 Python interpreter discovery fallback (unsupported Linux 
distribution: alpine)

Using module file 
/root/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py

<10.85.242.183> PUT 
/root/.ansible/tmp/ansible-local-1022po7l15vg/tmptsvz95ns TO 
/root/.ansible/tmp/ansible-tmp-1603774438.2565486-1028-27196404287972/AnsiballZ_junos_interfaces.py

<10.85.242.183> EXEC /bin/sh -c 'chmod u+x 
/root/.ansible/tmp/ansible-tmp-1603774438.2565486-1028-27196404287972/ 
/root/.ansible/tmp/ansible-tmp-1603774438.2565486-1028-27196404287972/AnsiballZ_junos_interfaces.py
 
&& sleep 0'


[ansible-project] vars plugin

2020-10-26 Thread Guy Matz
peeps,
I wrote a vars plugin:
https://guy.matz.org/2020/10/26/a-vars-plugin-for-ansible/

any comments would be appreciated.

Thanks,
Guy

-- 
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/CABnTgtXOoV8Xu%2B%3DgKCbZh7d7WZFoABRVkjgtJRFKj37hknHUGg%40mail.gmail.com.


Re: [ansible-project] Advice on build Immutable VM's ( VMware )

2020-10-26 Thread SP
Thanks @abhijeet and @Dan,
 In my environment i use Ansible for Configuration Management , Virtual 
Machines builds and lot more automation.

How can we make Virtual Machine ( Centos/Redhat linux OS ) immutable once 
vm deployed?


On Monday, October 26, 2020 at 10:17:52 AM UTC-5 Dan Linder wrote:

> I'll second @abhijeet and the use of the "vmware_guest" and 
> "vmware_guest_sendkey" modules.  It permits you to completely build your 
> templates from a known ISO from your vendor (validated with a SHA256 
> checksum), using a kickstart file of your own, and no human interaction.  
> And if the checksum, kickstart, and "sendkeys" strings are all part of your 
> code commit, then you're getting well into "infrastructure as code".
>
> The "immutable" usually refers to container images brought in from an 
> image repository, but the VMware template is a close analog to that.  And 
> if you can re-produce the same image (as you could with a base docker 
> image), then it's both immutable (at that level) and reproducable.
>
> On Sunday, October 25, 2020 at 11:14:21 PM UTC-5 Abhijeet Kasurde wrote:
>
>> Hi all,
>>
>> I wrote two articles about creating base images 
>>
>> 1. Automated installation of Windows Server 2012 r2 using Ansible - 
>> https://medium.com/@AbhijeetKasurde/ansible-automating-windows-server-2012-r2-installation-in-vcenter-227577f5917c
>> 2. Automated installation of CentOS 7 using Ansible - 
>> https://medium.com/@AbhijeetKasurde/automating-centos-7-installation-using-ansible-and-kickstart-483807a3774c
>>
>> once installation is complete, you can mark the VMs as "Template". These 
>> templates or golden images can be used to create new VMs.
>>
>>
>> On Sun, Oct 25, 2020 at 3:06 PM Robert Brockway  
>> wrote:
>>
>>> On Fri, 23 Oct 2020, SP wrote:
>>>
>>> > Hi,
>>> >
>>> > Advice on build Immutable VM's ( VMware ) and is that possible using
>>> > Ansible ?
>>> > What is the best way to do?
>>>
>>> Sounds like you're referring to a 'golden image'. A golden image is a 
>>> static bootable image that is deployed when running up any VMs.  I 
>>> prefer 
>>> this approach over the alternatives.
>>>
>>> The golden image boots up but doesn't do anything useful.  If you're 
>>> using 
>>> SSH for Ansible the golden image would have accounts and keys setup so 
>>> that the Ansible server can login, became superuser and install what is 
>>> needed to make the system useful.
>>>
>>> Thus each class of host needed is built from a single image.  The golden 
>>> image can be periodically updated but some people deploy them in 
>>> isolated 
>>> networks and run security updates before moving them in to live networks.
>>>
>>> A lot has been written about this online.
>>>
>>> Rob
>>>
>>> -- 
>>> 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/alpine.DEB.2.21.2010251841050.18666%40mira.opentrend.net
>>> .
>>>
>>>
>>
>> -- 
>> 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/4a2e0d4d-5cf2-43c2-8489-92c1f7151f50n%40googlegroups.com.


[ansible-project] Limit Log Output

2020-10-26 Thread Troy Fine
Hello, I was wondering is there a way I can drastically reduce the amount 
of logging that is output while a set of tasks is running?  At the very 
least we’d like to try to limit/eliminate the ‘info’ logging, would be even 
cooler if it also showed the short-hand status ‘changed, passed, etc’ 

`no_log: true` did not accomplish what we wanted 

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/9102ad5e-ef48-4df1-b659-8b1297e1d6f2n%40googlegroups.com.


[ansible-project] Re: change root password - ned help

2020-10-26 Thread Tony Wong
but when i put static value into the main.yml file it works

---
- name: "change the root password"
  hosts: localhost
  tasks:
- name: "change root pass"
  community.vmware.vmware_local_user_manager:
   hostname: ""esx1"
   username: "root"
   password: "xxx!"
   local_user_name: "root"
   local_user_password: "yyy"
   state: present
   validate_certs: no

On Monday, October 26, 2020 at 10:34:51 AM UTC-7 Tony Wong wrote:

>
> inventory file
>
> [esx]
> esx1
> esx2
> esx3
> [esx:vars]
> ansible_python_interpreter=/usr/bin/python3
>
> -
>
> answer file
>
> esxi_hostname: '{{ inventory_hostname }}'
> esxi_root_user: 'root'
> esxi_root_pass: 'xxx'
> new_esx_local_root_user: 'root'
> new_esx_local_root_pass: 'yyy'
>
> -
>
> playbook file
>
> ---
> - name: "change the root password"
>   hosts: localhost
>   tasks:
> - name: "change root pass"
>   community.vmware.vmware_local_user_manager:
>hostname: " {{ esxi_hostname }}"
>username: " {{ esxi_root_user }}"
>password: " {{ esxi_root_pass }}"
>local_user_name: "{{ new_esx_local_root_user }}"
>local_user_password: "{{ new_esx_local_root_pass }}"
>state: present
>validate_certs: no
>
> - name: print results
>   debug: msg=" {{ result }}"
>   vars_files:
> - answerfile.yml
>
>
> when i run it with
> ansible-playbook -i hosts main.yml -u root --ask-pass -
>
> i keep getting error
>
>
>
> The full traceback is:
> WARNING: The below traceback may *not* be related to the actual failure.
>   File 
> "/tmp/ansible_community.vmware.vmware_local_user_manager_payload_GG4F7i/ansible_community.vmware.vmware_local_user_manager_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py",
>  
> line 577, in connect_to_api
> service_instance = connect.SmartConnect(**connect_args)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 836, in 
> SmartConnect
> sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 718, in 
> __FindSupportedVersion
> sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 638, in 
> __GetServiceVersionDescription
> path + "/vimServiceVersions.xml", sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 604, in 
> __GetElementTree
> conn.request("GET", path)
>   File "/usr/lib/python2.7/httplib.py", line 1069, in request
> self._send_request(method, url, body, headers)
>   File "/usr/lib/python2.7/httplib.py", line 1109, in _send_request
> self.endheaders(body)
>   File "/usr/lib/python2.7/httplib.py", line 1065, in endheaders
> self._send_output(message_body)
>   File "/usr/lib/python2.7/httplib.py", line 892, in _send_output
> self.send(msg)
>   File "/usr/lib/python2.7/httplib.py", line 854, in send
> self.connect()
>   File "/usr/lib/python2.7/httplib.py", line 1282, in connect
> HTTPConnection.connect(self)
>   File "/usr/lib/python2.7/httplib.py", line 831, in connect
> self.timeout, self.source_address)
>   File "/usr/lib/python2.7/socket.py", line 557, in create_connection
> for res in getaddrinfo(host, port, 0, SOCK_STREAM):
> fatal: [localhost]: FAILED! => {
> "changed": false,
> "invocation": {
> "module_args": {
> "hostname": " localhost",
> "local_user_description": null,
> "local_user_name": "root",
> "local_user_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
> "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
> "port": 443,
> "proxy_host": null,
> "proxy_port": null,
> "state": "present",
> "username": " root",
> "validate_certs": false
> }
> },
> "msg": "Unknown error while connecting to vCenter or ESXi API at  
> localhost:443 : [Errno -2] Name or service not known"
> }
>
>

-- 
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/ee9f3c8f-b572-4028-8be7-85a0120bf2a2n%40googlegroups.com.


[ansible-project] change root password - ned help

2020-10-26 Thread Tony Wong

inventory file

[esx]
esx1
esx2
esx3
[esx:vars]
ansible_python_interpreter=/usr/bin/python3

-

answer file

esxi_hostname: '{{ inventory_hostname }}'
esxi_root_user: 'root'
esxi_root_pass: 'xxx'
new_esx_local_root_user: 'root'
new_esx_local_root_pass: 'yyy'

-

playbook file

---
- name: "change the root password"
  hosts: localhost
  tasks:
- name: "change root pass"
  community.vmware.vmware_local_user_manager:
   hostname: " {{ esxi_hostname }}"
   username: " {{ esxi_root_user }}"
   password: " {{ esxi_root_pass }}"
   local_user_name: "{{ new_esx_local_root_user }}"
   local_user_password: "{{ new_esx_local_root_pass }}"
   state: present
   validate_certs: no

- name: print results
  debug: msg=" {{ result }}"
  vars_files:
- answerfile.yml


when i run it with
ansible-playbook -i hosts main.yml -u root --ask-pass -

i keep getting error



The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File 
"/tmp/ansible_community.vmware.vmware_local_user_manager_payload_GG4F7i/ansible_community.vmware.vmware_local_user_manager_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py",
 
line 577, in connect_to_api
service_instance = connect.SmartConnect(**connect_args)
  File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 836, in 
SmartConnect
sslContext)
  File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 718, in 
__FindSupportedVersion
sslContext)
  File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 638, in 
__GetServiceVersionDescription
path + "/vimServiceVersions.xml", sslContext)
  File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 604, in 
__GetElementTree
conn.request("GET", path)
  File "/usr/lib/python2.7/httplib.py", line 1069, in request
self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1109, in _send_request
self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1065, in endheaders
self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 892, in _send_output
self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 854, in send
self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1282, in connect
HTTPConnection.connect(self)
  File "/usr/lib/python2.7/httplib.py", line 831, in connect
self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 557, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"hostname": " localhost",
"local_user_description": null,
"local_user_name": "root",
"local_user_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"proxy_host": null,
"proxy_port": null,
"state": "present",
"username": " root",
"validate_certs": false
}
},
"msg": "Unknown error while connecting to vCenter or ESXi API at  
localhost:443 : [Errno -2] Name or service not known"
}

-- 
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/a59d9978-7dd9-4697-80c8-02010120a218n%40googlegroups.com.


Re: [ansible-project] Any possible way to setup Ansible on windows 10 without WSL

2020-10-26 Thread Lasse Knudsen
No that is not possible on Windows. But you can use a Linux VM on your 
local machine to run your playbooks against Windows machines via openSSH or 
WinRM.

We have created a vagrantfile in our project. That file will start a CentOS 
8 machine in VirtualBox with ansible installed. We mount the project 
directory into that machine. Then we only need to log into the machine 
(vagrant ssh) and run the ansible playbooks against linux and windows 
machines. That works pretty good and we also can test our playbooks in our 
own local VM environment.

Regards
Lasse
dick@geant.org schrieb am Montag, 26. Oktober 2020 um 00:49:28 UTC+1:

> Assuming you mean using Windows 10 as the ansible controller node then no 
> this is explicitly not possible:
>
>
> https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-ansible-run-on-windows
>
>
>
> On Sun, 25 Oct 2020 at 20:01, smart aquarius  wrote:
>
>> Team,
>>
>> I have few windows 10 production machines and python/pip is already 
>> installed in them. Is there any way to setup ansible in the machines 
>> without enabling windows subsytem for linux. 
>>
>> Please suggest!
>>
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/3810be81-bc6b-4a8b-b734-6093e76cb11bn%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/d468e7e0-290d-4d76-b730-df0abf73e3a4n%40googlegroups.com.


[ansible-project] Ansible roles to configure different multiple wordpress server

2020-10-26 Thread unai abrisketa sanchez
Hi Team!

I am having a big doubt while using Ansible to deploy my wordpress servers.

I am using the wp-cli utility to install wordpress, so I want to use 
ansible roles in order to execute each role to each server with the 
modifications needed.

For example I have three different server names: dev.akme.eus, 
test.akme.eus and www.akme.eus, Ok, that´s quite easy to do using vars 
folder in ansible roles structure. But at the time to define the hosts to 
execute, I don't understand how can I define each host to use different 
vars, Could I define variables in hosts field in a role? As I have seen, 
role playbooks don't use hosts field.

I am a little bit lost with this topic.

Thanks for support!

-- 
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/c734a5bb-e275-4df2-b891-681920f08bc7n%40googlegroups.com.


Re: [ansible-project] Advice on build Immutable VM's ( VMware )

2020-10-26 Thread Dan Linder
I'll second @abhijeet and the use of the "vmware_guest" and 
"vmware_guest_sendkey" modules.  It permits you to completely build your 
templates from a known ISO from your vendor (validated with a SHA256 
checksum), using a kickstart file of your own, and no human interaction.  
And if the checksum, kickstart, and "sendkeys" strings are all part of your 
code commit, then you're getting well into "infrastructure as code".

The "immutable" usually refers to container images brought in from an image 
repository, but the VMware template is a close analog to that.  And if you 
can re-produce the same image (as you could with a base docker image), then 
it's both immutable (at that level) and reproducable.

On Sunday, October 25, 2020 at 11:14:21 PM UTC-5 Abhijeet Kasurde wrote:

> Hi all,
>
> I wrote two articles about creating base images 
>
> 1. Automated installation of Windows Server 2012 r2 using Ansible - 
> https://medium.com/@AbhijeetKasurde/ansible-automating-windows-server-2012-r2-installation-in-vcenter-227577f5917c
> 2. Automated installation of CentOS 7 using Ansible - 
> https://medium.com/@AbhijeetKasurde/automating-centos-7-installation-using-ansible-and-kickstart-483807a3774c
>
> once installation is complete, you can mark the VMs as "Template". These 
> templates or golden images can be used to create new VMs.
>
>
> On Sun, Oct 25, 2020 at 3:06 PM Robert Brockway  
> wrote:
>
>> On Fri, 23 Oct 2020, SP wrote:
>>
>> > Hi,
>> >
>> > Advice on build Immutable VM's ( VMware ) and is that possible using
>> > Ansible ?
>> > What is the best way to do?
>>
>> Sounds like you're referring to a 'golden image'. A golden image is a 
>> static bootable image that is deployed when running up any VMs.  I prefer 
>> this approach over the alternatives.
>>
>> The golden image boots up but doesn't do anything useful.  If you're 
>> using 
>> SSH for Ansible the golden image would have accounts and keys setup so 
>> that the Ansible server can login, became superuser and install what is 
>> needed to make the system useful.
>>
>> Thus each class of host needed is built from a single image.  The golden 
>> image can be periodically updated but some people deploy them in isolated 
>> networks and run security updates before moving them in to live networks.
>>
>> A lot has been written about this online.
>>
>> Rob
>>
>> -- 
>> 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/alpine.DEB.2.21.2010251841050.18666%40mira.opentrend.net
>> .
>>
>>
>
> -- 
> 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/3d561775-0612-4570-8840-4867255064adn%40googlegroups.com.


Re: [ansible-project] Re: need a playbook to change esxi root pass

2020-10-26 Thread Tony Wong
yes! That did it. Thank you

---
- name: "change the root password"
  hosts: localhost
  tasks:
- name: "change root pass"
  community.vmware.vmware_local_user_manager:
   hostname: "myesxhost"
   username: "root"
   password: "xx"
   local_user_name: "root"
   local_user_password: "yy"
   state: present
   validate_certs: no

but when I change it to read from answer file it not working. 

any idea?

---
- name: "change the root password"
  hosts: localhost
  tasks:
- name: "change root pass"
  community.vmware.vmware_local_user_manager:
   hostname: "{{ inventory_hostname }}"
   username: " {{ esxi_root_user }}"
   password: " {{ esxi_root_pass }}"
   local_user_name: "{{ new_esx_local_root_user }}"
   local_user_password: "{{ new_esx_local_root_pass }}"
   state: present
   validate_certs: no

- name: print results
  debug: msg=" {{ result }}"
  vars_files:
- answerfile.yml

On Sunday, October 25, 2020 at 10:46:28 AM UTC-7 dick@geant.org wrote:

> I think you need to run this against localhost (i.e. the controlnode)
> as this is where you have pyvmomi installed.
> The ESXi host name should go as the argument in the task itself.
>
>
> On Sun, 25 Oct 2020 at 17:51, Tony Wong  wrote:
> >
> > but I have all the pip /pip3 python packages installed already
> >
> > there isnt anything I can install on a remote esxi host
> >
> > On Sunday, October 25, 2020 at 7:55:09 AM UTC-7 vinod...@gmail.com 
> wrote:
> >>
> >> You need to have pip module to run in target hosts. You might have 
> installed pip package on local host . You can simply run this on localhost 
> . It will work . Make exsi hosts on loop
> >>
> >> //Vinoth
> >>
> >> On Sun 25. Oct 2020 at 02:08, Tony Wong  wrote:
> >>>
> >>>
> >>>
> >>> my playbook
> >>>
> >>> ---
> >>> - name: "change the root password"
> >>> hosts: all
> >>> tasks:
> >>> - name: "change root pass"
> >>> community.vmware.vmware_local_user_manager:
> >>> hostname: "{{ inventory_hostname }}"
> >>> local_user_name: "{{ esx_local_root_user }}"
> >>> local_user_password: "{{ esx_local_root_pass }}"
> >>> password: "{{ esxi_root_pass }}"
> >>> username: "{{ esxi_root_user }}"
> >>> validate_certs: "n"
> >>> vars_files:
> >>> - answerfile.yml
> >>>
> >>> On Saturday, October 24, 2020 at 5:07:11 PM UTC-7 Tony Wong wrote:
> 
> 
>  this is error I get now
> 
>  The full traceback is:
>  Traceback (most recent call last):
>  File 
> "/tmp/ansible_community.vmware.vmware_local_user_manager_payload_4mdm01xz/ansible_community.vmware.vmware_local_user_manager_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py",
>  
> line 25, in 
>  import requests
>  ImportError: No module named 'requests'
>  fatal: [esxhost]: FAILED! => {
>  "changed": false,
>  "invocation": {
>  "module_args": {
>  "hostname": "esxhost",
>  "local_user_description": null,
>  "local_user_name": "root",
>  "local_user_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>  "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>  "port": 443,
>  "proxy_host": null,
>  "proxy_port": null,
>  "state": "present",
>  "username": "root",
>  "validate_certs": false
>  }
>  },
>  "msg": "Failed to import the required Python library (requests) on 
> esxhost s Python /usr/bin/python3. Please read module documentation and 
> install in the appropriate location. If the required library is installed, 
> but Ansible is using the wrong Python interpreter, please consult the 
> documentation on ansible_python_interpreter"
>  }
> 
>  PLAY RECAP 
> ***
>  esxhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 
> ignored=0
> 
>  On Saturday, October 24, 2020 at 6:53:41 AM UTC-7 Tony Wong wrote:
> >
> > Need help on this please.
> >
> > my inventory file
> >
> >
> > [esx]
> > esx1
> > esx2
> > esx3
> >
> > --
> >
> > playbook
> >
> > ---
> > - name: change root esxi password
> > community.vmware.vmware_local_user_manager:
> > hostname: '{{ esx_host }}'
> > username: root
> > password: '{{ esx_root_pass }}'
> >
> >
> > what else do i need?
> >
> >
> > On Friday, October 23, 2020 at 8:28:52 PM UTC-7 Tony Wong wrote:
> >>
> >>
> >> How do I change the root password on all esxi hosts with a pb?
> >>>
> >>> --
> >>> 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 

[ansible-project] Ansible automation for SAP - Issue and Best practices

2020-10-26 Thread Pratheek P
Dear Ansible community,

I want to try out Ansible automation for SAP where we automate SAP 
start/stop, Oracle DB start/stop processes. I'm able to achieve this by 
creating playbooks, using become method to change user and establishing 
open SSH connection from root of Ansible control node to root of SAP 
managed host. Now I have a new requirement to use a non-root user in 
control node and managed host. However, I noticed that when I use the 
non-root user, I'm not able to get the correct environment variables 
required to start/stop SAP as adm user. I want to know what is the 
best way to achieve this and also about the best practices when it comes to 
automating SAP tasks using Ansible. Looking forward to your replies.

Best Regards,
Pratheek. P

-- 
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/307a70e3-0891-4458-8e62-44843371bc95n%40googlegroups.com.