[ansible-project] Getting jsondiff is not installed error even though jsondiff is installed

2022-02-02 Thread Nick Plichta


Getting fatal: [192.168.0.51]: FAILED! => {"changed": false, "msg": 
"jsondiff is not installed, try 'pip install jsondiff'"} error on fresh 
ansible install on ubuntu 20.04 via apt. Additionally I installed 
python3-jsondiff and community.docker from ansible-galaxy. All I’m trying 
to do is destroy a docker stack using ansible-playbook. My yml looks like 
this


---

- hosts: 192.168.0.51

   tasks:

 - name: Remove healthchecks stack

docker_stack:

  name: healthchecks

  state: absent


What am I missing?

-- 
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/de19e1eb-c049-4195-9154-7d3adfdf5f27n%40googlegroups.com.


[ansible-project] ansible win_ping fails with 'transport_message': 'Bad HTTP

2021-07-28 Thread Nick Bhanji
I am trying to execute: ansible testing -m win_ping -
Output:
-fog:~/ansible-playbooks/testing$ ansible testing -m win_ping -v
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the 
controller starting with Ansible 2.12. Current version: 3.6.9 (default, Jan 
26 2021, 15:33:00) [GCC
 8.4.0]. This feature will be removed from ansible-core in version 2.12. 
Deprecation warnings can be disabled by setting deprecation_warnings=False 
in ansible.cfg.
ansible [core 2.11.3]
  config file = /home/nbhanji/ansible-playbooks/testing/ansible.cfg
  configured module search path = 
['/home/nbhanji/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/lib/python3.6/dist-packages/ansible
  ansible collection location = 
/home/nbhanji/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
  jinja version = 3.0.1
  libyaml = True
Using /home/nbhanji/ansible-playbooks/testing/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/nbhanji/ansible-playbooks/testing/hosts as 
it did not pass its verify_file() method
script declined parsing /home/nbhanji/ansible-playbooks/testing/hosts as it 
did not pass its verify_file() method
auto declined parsing /home/nbhanji/ansible-playbooks/testing/hosts as it 
did not pass its verify_file() method
Parsed /home/nbhanji/ansible-playbooks/testing/hosts inventory source with 
ini plugin
Loading callback plugin minimal of type stdout, v2.0 from 
/usr/local/lib/python3.6/dist-packages/ansible/plugins/callback/minimal.py
Attempting to use 'default' callback.
Skipping callback 'default', as we already have a stdout callback.
Attempting to use 'junit' callback.
Attempting to use 'minimal' callback.
Skipping callback 'minimal', as we already have a stdout callback.
Attempting to use 'oneline' callback.
Skipping callback 'oneline', as we already have a stdout callback.
Attempting to use 'tree' callback.
META: ran handlers
redirecting (type: modules) ansible.builtin.win_ping to 
ansible.windows.win_ping
Loading collection ansible.windows from 
/home/nbhanji/.ansible/collections/ansible_collections/ansible/windows
Using module file 
/home/nbhanji/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/win_ping.ps1
Pipelining is enabled.
<10.50.51.192> ESTABLISH WINRM CONNECTION FOR USER: administrator on PORT 
5986 TO 10.50.51.192
<10.50.51.192> WINRM CONNECT: transport=ntlm 
endpoint=https://10.50.51.192:5986/wsman
<10.50.51.192> WINRM OPEN SHELL: D321F42B-3829-444A-99CE-C2CB97AA73AC
EXEC (via pipeline wrapper)
<10.50.51.192> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', 
'-ExecutionPolicy', 'Unrestricted', '-EncodedCommand', 
'UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARQBuAGMAbwBkAGUAZABDAG8AbQBtAGEAbgBkACAASgBnAEIAagBBAEcAZwBBAFkAdwBCAHcAQQBDADQAQQBZAHcAQgB2AEEARwAwAEEASQBBAEEAMgBBAEQAVQBBAE0AQQBBAHcAQQBEAEUAQQBJAEEAQQArAEEAQwBBAEEASgBBAEIAdQBBAEgAVQBBAGIAQQBCAHMAQQBBAG8AQQBhAFEAQgBtAEEAQwBBAEEASwBBAEEAawBBAEYAQQBBAFUAdwBCAFcAQQBHAFUAQQBjAGcAQgB6AEEARwBrAEEAYgB3AEIAdQBBAEYAUQBBAFkAUQBCAGkAQQBHAHcAQQBaAFEAQQB1AEEARgBBAEEAVQB3AEIAVwBBAEcAVQBBAGMAZwBCAHoAQQBHAGsAQQBiAHcAQgB1AEEAQwBBAEEATABRAEIAcwBBAEgAUQBBAEkAQQBCAGIAQQBGAFkAQQBaAFEAQgB5AEEASABNAEEAYQBRAEIAdgBBAEcANABBAFgAUQBBAGkAQQBEAE0AQQBMAGcAQQB3AEEAQwBJAEEASwBRAEEAZwBBAEgAcwBBAEMAZwBBAG4AQQBIAHMAQQBJAGcAQgBtAEEARwBFAEEAYQBRAEIAcwBBAEcAVQBBAFoAQQBBAGkAQQBEAG8AQQBkAEEAQgB5AEEASABVAEEAWgBRAEEAcwBBAEMASQBBAGIAUQBCAHoAQQBHAGMAQQBJAGcAQQA2AEEAQwBJAEEAUQBRAEIAdQBBAEgATQBBAGEAUQBCAGkAQQBHAHcAQQBaAFEAQQBnAEEASABJAEEAWgBRAEIAeABBAEgAVQBBAGEAUQBCAHkAQQBHAFUAQQBjAHcAQQBnAEEARgBBAEEAYgB3AEIAMwBBAEcAVQBBAGMAZwBCAFQAQQBHAGcAQQBaAFEAQgBzAEEARwB3AEEASQBBAEIAMgBBAEQATQBBAEwAZwBBAHcAQQBDAEEAQQBiAHcAQgB5AEEAQwBBAEEAYgBnAEIAbABBAEgAYwBBAFoAUQBCAHkAQQBDAEkAQQBmAFEAQQBuAEEAQQBvAEEAWgBRAEIANABBAEcAawBBAGQAQQBBAGcAQQBEAEUAQQBDAGcAQgA5AEEAQQBvAEEASgBBAEIAbABBAEgAZwBBAFoAUQBCAGoAQQBGADgAQQBkAHcAQgB5AEEARwBFAEEAYwBBAEIAdwBBAEcAVQBBAGMAZwBCAGYAQQBIAE0AQQBkAEEAQgB5AEEAQwBBAEEAUABRAEEAZwBBAEMAUQBBAGEAUQBCAHUAQQBIAEEAQQBkAFEAQgAwAEEAQwBBAEEAZgBBAEEAZwBBAEUAOABBAGQAUQBCADAAQQBDADAAQQBVAHcAQgAwAEEASABJAEEAYQBRAEIAdQBBAEcAYwBBAEMAZwBBAGsAQQBIAE0AQQBjAEEAQgBzAEEARwBrAEEAZABBAEIAZgBBAEgAQQBBAFkAUQBCAHkAQQBIAFEAQQBjAHcAQQBnAEEARAAwAEEASQBBAEEAawBBAEcAVQBBAGUAQQBCAGwAQQBHAE0AQQBYAHcAQgAzAEEASABJAEEAWQBRAEIAdwBBAEgAQQBBAFoAUQBCAHkAQQBGADgAQQBjAHcAQgAwAEEASABJAEEATABnAEIAVABBAEgAQQBBAGIAQQBCAHAAQQBIAFEAQQBLAEEAQgBBAEEAQwBnAEEASQBnAEIAZwBBAEQAQQBBAFkAQQBBAHcAQQBHAEEAQQBNAEEAQgBnAEEARABBAEEASQBnAEEAcABBAEMAdwBBAEkAQQBBAHkAQQBDAHcAQQBJAEEAQgBiAEEARgBNAEEAZABBAEIAeQBBAEcAawBBAGIAZwBCAG4AQQBGAE0AQQBjAEEAQgBzAEEARwBrAEEAZABBAEIAUABBAEgAQQBBAGQAQQBCAHAAQQBHADgAQQBiAGcAQgB6AEEARgAwAEEATwBnAEEANgBB

[ansible-project] Re: k8s_facts just does not work

2021-04-14 Thread Nick-H
well it seems to be limited by k8s api itself , not sure field_selectors is 
very useful then .
json_query is needed to filter out results from the whole output from facts 
.
Maybe for now , it s better to use kubectl in the shell module 

Le mercredi 14 avril 2021 à 13:09:59 UTC-7, Nick-H a écrit :

> well another thing I try and just does not work as per the doc 
> the example from the official doc does not even work :
>
> ansibe 2.8 / python3.6 , openshift / kubernetes pip modules 0.11 (0.12 is 
> broken too).
>
> *- name: Search for all running pods*
> *  k8s_facts:*
> *kind: Pod*
> *field_selectors:*
> *  - status.phase = running*
>
>
> returns: 
> *Failure\",\"message\":\"field label not supported: status.phase 
> \",\"reason\":\"BadRequest\",\"code\":400}*
>
> Why is that trying to get labels when we are talking fields ? 
>
> I am ultimately trying to get infos on Deployments , but same thing 
> field_selectors does not work at all .
>
> anyone been using this module and the *field_selectors *parameters 
> successfully ? 
> 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/cf20b835-d7af-4c3f-88c1-1f708bdf1888n%40googlegroups.com.


[ansible-project] k8s_facts just does not work

2021-04-14 Thread Nick-H
well another thing I try and just does not work as per the doc 
the example from the official doc does not even work :

ansibe 2.8 / python3.6 , openshift / kubernetes pip modules 0.11 (0.12 is 
broken too).

*- name: Search for all running pods*
*  k8s_facts:*
*kind: Pod*
*field_selectors:*
*  - status.phase = running*


returns: 
*Failure\",\"message\":\"field label not supported: status.phase 
\",\"reason\":\"BadRequest\",\"code\":400}*

Why is that trying to get labels when we are talking fields ? 

I am ultimately trying to get infos on Deployments , but same thing 
field_selectors does not work at all .

anyone been using this module and the *field_selectors *parameters 
successfully ? 
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/58ad6ea9-4954-44ba-bca3-7fa17451091an%40googlegroups.com.


Re: [ansible-project] mysql_db and pymysql error

2021-04-13 Thread Nick-H
ok thanks, sorry but my tower/awx is not remote per say as it is the box 
that executes all playbooks , so it like my localhost  sure .
the link describe how to set the interpreter on remote hosts, which in my 
case are fine using their python2 ( legacy boxes) .
But if I define the interpreter on tower ansible.cfg (localhost)  in 
default section then   even remote hosts inherits that config . 
I d like to only run python3 on the controller (localhost)  itself  if that 
s doable . 




Le mardi 13 avril 2021 à 13:23:23 UTC-7, Matt Martz a écrit :

> The Python interpreter that you use to install ansible, is not necessarily 
> the python used to execute modules, even when targeting localhost.
>
> The controller code, and module code execute completely different, with 
> different rules.
>
> If you don't have `localhost` in your inventory, you can use something 
> called implicit localhost, as described at 
> https://docs.ansible.com/ansible/latest/inventory/implicit_localhost.html
>
> But you must target that localhost explicitly in your play, or use 
> `delegate_to: localhost` for that to work.
>
> If you have `localhost` in your inventory, then you have to explicitly set 
> the python interpreter to be used for that host, via 
> `ansible_python_interpreter`
>
> See also: 
> https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-handle-not-having-a-python-interpreter-at-usr-bin-python-on-a-remote-machine
>
> On Tue, Apr 13, 2021 at 3:18 PM Nick-H  wrote:
>
>> still doesn't make sense to me, or doc is not clear
>>
>> My controller Tower/AWX :
>>  python3 installed on system
>>  virtual environment to run ansible installed as per the doc : python3 -m 
>> pip install ansible 
>> Yet, I see playbooks using python3 , but what is that usr/bin/python  ? 
>>
>> Why is ansible still using python2 please ?
>>
>>
>>
>> Le jeudi 8 avril 2021 à 16:11:30 UTC-7, Nick-H a écrit :
>>
>>> Now, I tried that in my ansible.cfg  and indeed it passed my errors , 
>>> thank you Matt !
>>> I am still a bit confused though , Why do we bother creating virtual 
>>> environments if eventually ansible keeps trying to use a system-wide 
>>> installed python ? 
>>> really , why  is that ? 
>>>
>>> thanks for enlightenment  
>>>
>>> Le jeudi 8 avril 2021 à 12:07:43 UTC-7, Nick-H a écrit :
>>>
>>>>
>>>> hmm ok but this runs on the controller ( awx ) , so I followed this doc 
>>>> :
>>>>
>>>> https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#on-the-controller-side
>>>>
>>>> Do I need to use the interpreter var in that case ? 
>>>>
>>>>
>>>>
>>>>
>>>> Le jeudi 8 avril 2021 à 11:59:30 UTC-7, Matt Martz a écrit :
>>>>
>>>>> If you want a module to run with python3, you will generally need to 
>>>>> set `ansible_python_interpreter` for that host to get it to use the 
>>>>> interpreter you want.  We default and fallback to py2.
>>>>>
>>>>> On Thu, Apr 8, 2021 at 1:23 PM Nick-H  wrote:
>>>>>
>>>>>> Oh No I want to get rid of python2 for my ansible playbooks  :( 
>>>>>> been fighting this for weeks ... 
>>>>>>
>>>>>> from ansible itself it seems to be running on python3 : 
>>>>>> ansible-playbook 2.8.12
>>>>>> config file = /var/lib/awx/tmp/.../project/ansible.cfg
>>>>>> configured module search path = 
>>>>>> ['/var/lib/awx/tmp/.../project/library']
>>>>>> ansible python module location = 
>>>>>> /opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
>>>>>> executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
>>>>>> python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 
>>>>>> 20150623 (Red Hat 4.8.5-44)]
>>>>>>
>>>>>>
>>>>>> Is that the KW marker '*' that make you find I run on python2 ? Is 
>>>>>> that not being used on python3 ?  
>>>>>> Now I don't really see how to make good use of python3 for ansible if 
>>>>>> the underlying system keeps using python2 , is there any good guideline 
>>>>>> I 
>>>>>> could use ?
>>>>>> thanks
>>>>>>
>>>>>>
>>>>>> Le jeudi 8 avril 2021 à 11:11:12 UTC-7,

Re: [ansible-project] mysql_db and pymysql error

2021-04-13 Thread Nick-H
still doesn't make sense to me, or doc is not clear

My controller Tower/AWX :
 python3 installed on system
 virtual environment to run ansible installed as per the doc : python3 -m 
pip install ansible 
Yet, I see playbooks using python3 , but what is that usr/bin/python  ? 

Why is ansible still using python2 please ?



Le jeudi 8 avril 2021 à 16:11:30 UTC-7, Nick-H a écrit :

> Now, I tried that in my ansible.cfg  and indeed it passed my errors , 
> thank you Matt !
> I am still a bit confused though , Why do we bother creating virtual 
> environments if eventually ansible keeps trying to use a system-wide 
> installed python ? 
> really , why  is that ? 
>
> thanks for enlightenment  
>
> Le jeudi 8 avril 2021 à 12:07:43 UTC-7, Nick-H a écrit :
>
>>
>> hmm ok but this runs on the controller ( awx ) , so I followed this doc :
>>
>> https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#on-the-controller-side
>>
>> Do I need to use the interpreter var in that case ? 
>>
>>
>>
>>
>> Le jeudi 8 avril 2021 à 11:59:30 UTC-7, Matt Martz a écrit :
>>
>>> If you want a module to run with python3, you will generally need to set 
>>> `ansible_python_interpreter` for that host to get it to use the interpreter 
>>> you want.  We default and fallback to py2.
>>>
>>> On Thu, Apr 8, 2021 at 1:23 PM Nick-H  wrote:
>>>
>>>> Oh No I want to get rid of python2 for my ansible playbooks  :( 
>>>> been fighting this for weeks ... 
>>>>
>>>> from ansible itself it seems to be running on python3 : 
>>>> ansible-playbook 2.8.12
>>>> config file = /var/lib/awx/tmp/.../project/ansible.cfg
>>>> configured module search path = ['/var/lib/awx/tmp/.../project/library']
>>>> ansible python module location = 
>>>> /opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
>>>> executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
>>>> python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 
>>>> 20150623 (Red Hat 4.8.5-44)]
>>>>
>>>>
>>>> Is that the KW marker '*' that make you find I run on python2 ? Is that 
>>>> not being used on python3 ?  
>>>> Now I don't really see how to make good use of python3 for ansible if 
>>>> the underlying system keeps using python2 , is there any good guideline I 
>>>> could use ?
>>>> thanks
>>>>
>>>>
>>>> Le jeudi 8 avril 2021 à 11:11:12 UTC-7, Matt Martz a écrit :
>>>>
>>>>> If I had to guess, you are executing the module and subsequently 
>>>>> pymysql with python2.  The paths seem to indicate a python3 virtualenv, 
>>>>> but 
>>>>> the error indicates that you are executing Python2, with potentially a 
>>>>> PYTHONPATH pointing to the Python3 venv.
>>>>>
>>>>> The error is in regards to the "keyword only marker" defined at:
>>>>>
>>>>>
>>>>> https://github.com/PyMySQL/PyMySQL/blob/6ccbecc1a0dfd04065b081950d2d35b1dac0aaa8/pymysql/connections.py#L164-L166
>>>>>
>>>>> On Thu, Apr 8, 2021 at 1:03 PM Nick-H  wrote:
>>>>>
>>>>>> I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
>>>>>> Mysql_db module fails importing connections from PyMySQL pip module.
>>>>>> At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 
>>>>>>
>>>>>> the error seems to be related to a PEP recommendation E402 . 
>>>>>>
>>>>>> As per PyMySQL doc , python3 is supported . 
>>>>>>
>>>>>> here is my error: 
>>>>>>
>>>>>> {
>>>>>> "module_stdout": "",
>>>>>> "module_stderr": "Traceback (most recent call last):\n  File 
>>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>>  
>>>>>> line 114, in \n_ansiballz_main()\n  File 
>>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>>  
>>>>>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>>>>>> ANSIBALLZ_PARAMS)\n  File 
>>>>>> \&quo

Re: [ansible-project] mysql_db and pymysql error

2021-04-08 Thread Nick-H
Now, I tried that in my ansible.cfg  and indeed it passed my errors , 
thank you Matt !
I am still a bit confused though , Why do we bother creating virtual 
environments if eventually ansible keeps trying to use a system-wide 
installed python ? 
really , why  is that ? 

thanks for enlightenment  

Le jeudi 8 avril 2021 à 12:07:43 UTC-7, Nick-H a écrit :

>
> hmm ok but this runs on the controller ( awx ) , so I followed this doc :
>
> https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#on-the-controller-side
>
> Do I need to use the interpreter var in that case ? 
>
>
>
>
> Le jeudi 8 avril 2021 à 11:59:30 UTC-7, Matt Martz a écrit :
>
>> If you want a module to run with python3, you will generally need to set 
>> `ansible_python_interpreter` for that host to get it to use the interpreter 
>> you want.  We default and fallback to py2.
>>
>> On Thu, Apr 8, 2021 at 1:23 PM Nick-H  wrote:
>>
>>> Oh No I want to get rid of python2 for my ansible playbooks  :( been 
>>> fighting this for weeks ... 
>>>
>>> from ansible itself it seems to be running on python3 : 
>>> ansible-playbook 2.8.12
>>> config file = /var/lib/awx/tmp/.../project/ansible.cfg
>>> configured module search path = ['/var/lib/awx/tmp/.../project/library']
>>> ansible python module location = 
>>> /opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
>>> executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
>>> python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 
>>> 20150623 (Red Hat 4.8.5-44)]
>>>
>>>
>>> Is that the KW marker '*' that make you find I run on python2 ? Is that 
>>> not being used on python3 ?  
>>> Now I don't really see how to make good use of python3 for ansible if 
>>> the underlying system keeps using python2 , is there any good guideline I 
>>> could use ?
>>> thanks
>>>
>>>
>>> Le jeudi 8 avril 2021 à 11:11:12 UTC-7, Matt Martz a écrit :
>>>
>>>> If I had to guess, you are executing the module and subsequently 
>>>> pymysql with python2.  The paths seem to indicate a python3 virtualenv, 
>>>> but 
>>>> the error indicates that you are executing Python2, with potentially a 
>>>> PYTHONPATH pointing to the Python3 venv.
>>>>
>>>> The error is in regards to the "keyword only marker" defined at:
>>>>
>>>>
>>>> https://github.com/PyMySQL/PyMySQL/blob/6ccbecc1a0dfd04065b081950d2d35b1dac0aaa8/pymysql/connections.py#L164-L166
>>>>
>>>> On Thu, Apr 8, 2021 at 1:03 PM Nick-H  wrote:
>>>>
>>>>> I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
>>>>> Mysql_db module fails importing connections from PyMySQL pip module.
>>>>> At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 
>>>>>
>>>>> the error seems to be related to a PEP recommendation E402 . 
>>>>>
>>>>> As per PyMySQL doc , python3 is supported . 
>>>>>
>>>>> here is my error: 
>>>>>
>>>>> {
>>>>> "module_stdout": "",
>>>>> "module_stderr": "Traceback (most recent call last):\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 114, in \n_ansiballz_main()\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>>>>> ANSIBALLZ_PARAMS)\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
>>>>> MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
>>>>> line 110, in \n  File 
>>>>> \"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
>>>>>  
>>>>> line 33, in \n  File 
>>>>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\",
>>>>>  
>>>>>

Re: [ansible-project] mysql_db and pymysql error

2021-04-08 Thread Nick-H
Now, I tried that in my ansible.cfg  and indeed it passed my errors , 
thank you Matt !
I am still a bit confused though  ;) 



Le jeudi 8 avril 2021 à 12:07:43 UTC-7, Nick-H a écrit :

>
> hmm ok but this runs on the controller ( awx ) , so I followed this doc :
>
> https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#on-the-controller-side
>
> Do I need to use the interpreter var in that case ? 
>
>
>
>
> Le jeudi 8 avril 2021 à 11:59:30 UTC-7, Matt Martz a écrit :
>
>> If you want a module to run with python3, you will generally need to set 
>> `ansible_python_interpreter` for that host to get it to use the interpreter 
>> you want.  We default and fallback to py2.
>>
>> On Thu, Apr 8, 2021 at 1:23 PM Nick-H  wrote:
>>
>>> Oh No I want to get rid of python2 for my ansible playbooks  :( been 
>>> fighting this for weeks ... 
>>>
>>> from ansible itself it seems to be running on python3 : 
>>> ansible-playbook 2.8.12
>>> config file = /var/lib/awx/tmp/.../project/ansible.cfg
>>> configured module search path = ['/var/lib/awx/tmp/.../project/library']
>>> ansible python module location = 
>>> /opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
>>> executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
>>> python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 
>>> 20150623 (Red Hat 4.8.5-44)]
>>>
>>>
>>> Is that the KW marker '*' that make you find I run on python2 ? Is that 
>>> not being used on python3 ?  
>>> Now I don't really see how to make good use of python3 for ansible if 
>>> the underlying system keeps using python2 , is there any good guideline I 
>>> could use ?
>>> thanks
>>>
>>>
>>> Le jeudi 8 avril 2021 à 11:11:12 UTC-7, Matt Martz a écrit :
>>>
>>>> If I had to guess, you are executing the module and subsequently 
>>>> pymysql with python2.  The paths seem to indicate a python3 virtualenv, 
>>>> but 
>>>> the error indicates that you are executing Python2, with potentially a 
>>>> PYTHONPATH pointing to the Python3 venv.
>>>>
>>>> The error is in regards to the "keyword only marker" defined at:
>>>>
>>>>
>>>> https://github.com/PyMySQL/PyMySQL/blob/6ccbecc1a0dfd04065b081950d2d35b1dac0aaa8/pymysql/connections.py#L164-L166
>>>>
>>>> On Thu, Apr 8, 2021 at 1:03 PM Nick-H  wrote:
>>>>
>>>>> I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
>>>>> Mysql_db module fails importing connections from PyMySQL pip module.
>>>>> At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 
>>>>>
>>>>> the error seems to be related to a PEP recommendation E402 . 
>>>>>
>>>>> As per PyMySQL doc , python3 is supported . 
>>>>>
>>>>> here is my error: 
>>>>>
>>>>> {
>>>>> "module_stdout": "",
>>>>> "module_stderr": "Traceback (most recent call last):\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 114, in \n_ansiballz_main()\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>>>>> ANSIBALLZ_PARAMS)\n  File 
>>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>>  
>>>>> line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
>>>>> MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
>>>>> line 110, in \n  File 
>>>>> \"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
>>>>>  
>>>>> line 33, in \n  File 
>>>>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\",
>>>>>  
>>>>> line 59, in \nfrom . import connections  # noqa: E402\n  File 
>>>>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",

Re: [ansible-project] mysql_db and pymysql error

2021-04-08 Thread Nick-H

hmm ok but this runs on the controller ( awx ) , so I followed this doc :
https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#on-the-controller-side

Do I need to use the interpreter var in that case ? 




Le jeudi 8 avril 2021 à 11:59:30 UTC-7, Matt Martz a écrit :

> If you want a module to run with python3, you will generally need to set 
> `ansible_python_interpreter` for that host to get it to use the interpreter 
> you want.  We default and fallback to py2.
>
> On Thu, Apr 8, 2021 at 1:23 PM Nick-H  wrote:
>
>> Oh No I want to get rid of python2 for my ansible playbooks  :( been 
>> fighting this for weeks ... 
>>
>> from ansible itself it seems to be running on python3 : 
>> ansible-playbook 2.8.12
>> config file = /var/lib/awx/tmp/.../project/ansible.cfg
>> configured module search path = ['/var/lib/awx/tmp/.../project/library']
>> ansible python module location = 
>> /opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
>> executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
>> python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-44)]
>>
>>
>> Is that the KW marker '*' that make you find I run on python2 ? Is that 
>> not being used on python3 ?  
>> Now I don't really see how to make good use of python3 for ansible if the 
>> underlying system keeps using python2 , is there any good guideline I could 
>> use ?
>> thanks
>>
>>
>> Le jeudi 8 avril 2021 à 11:11:12 UTC-7, Matt Martz a écrit :
>>
>>> If I had to guess, you are executing the module and subsequently pymysql 
>>> with python2.  The paths seem to indicate a python3 virtualenv, but the 
>>> error indicates that you are executing Python2, with potentially a 
>>> PYTHONPATH pointing to the Python3 venv.
>>>
>>> The error is in regards to the "keyword only marker" defined at:
>>>
>>>
>>> https://github.com/PyMySQL/PyMySQL/blob/6ccbecc1a0dfd04065b081950d2d35b1dac0aaa8/pymysql/connections.py#L164-L166
>>>
>>> On Thu, Apr 8, 2021 at 1:03 PM Nick-H  wrote:
>>>
>>>> I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
>>>> Mysql_db module fails importing connections from PyMySQL pip module.
>>>> At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 
>>>>
>>>> the error seems to be related to a PEP recommendation E402 . 
>>>>
>>>> As per PyMySQL doc , python3 is supported . 
>>>>
>>>> here is my error: 
>>>>
>>>> {
>>>> "module_stdout": "",
>>>> "module_stderr": "Traceback (most recent call last):\n  File 
>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>  
>>>> line 114, in \n_ansiballz_main()\n  File 
>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>  
>>>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>>>> ANSIBALLZ_PARAMS)\n  File 
>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>  
>>>> line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
>>>> MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
>>>> line 110, in \n  File 
>>>> \"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
>>>>  
>>>> line 33, in \n  File 
>>>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\",
>>>>  
>>>> line 59, in \nfrom . import connections  # noqa: E402\n  File 
>>>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",
>>>>  
>>>> line 167\n*,\n ^\nSyntaxError: invalid syntax\n",
>>>> "exception": "Traceback (most recent call last):\n  File 
>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>  
>>>> line 114, in \n_ansiballz_main()\n  File 
>>>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>>>  

Re: [ansible-project] mysql_db and pymysql error

2021-04-08 Thread Nick-H
Oh No I want to get rid of python2 for my ansible playbooks  :( been 
fighting this for weeks ... 

from ansible itself it seems to be running on python3 : 
ansible-playbook 2.8.12
config file = /var/lib/awx/tmp/.../project/ansible.cfg
configured module search path = ['/var/lib/awx/tmp/.../project/library']
ansible python module location = 
/opt/venvs/py3_ansible28/lib/python3.6/site-packages/ansible
executable location = /opt/venvs/py3_ansible28/bin/ansible-playbook
python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 
(Red Hat 4.8.5-44)]


Is that the KW marker '*' that make you find I run on python2 ? Is that not 
being used on python3 ?  
Now I don't really see how to make good use of python3 for ansible if the 
underlying system keeps using python2 , is there any good guideline I could 
use ?
thanks


Le jeudi 8 avril 2021 à 11:11:12 UTC-7, Matt Martz a écrit :

> If I had to guess, you are executing the module and subsequently pymysql 
> with python2.  The paths seem to indicate a python3 virtualenv, but the 
> error indicates that you are executing Python2, with potentially a 
> PYTHONPATH pointing to the Python3 venv.
>
> The error is in regards to the "keyword only marker" defined at:
>
>
> https://github.com/PyMySQL/PyMySQL/blob/6ccbecc1a0dfd04065b081950d2d35b1dac0aaa8/pymysql/connections.py#L164-L166
>
> On Thu, Apr 8, 2021 at 1:03 PM Nick-H  wrote:
>
>> I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
>> Mysql_db module fails importing connections from PyMySQL pip module.
>> At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 
>>
>> the error seems to be related to a PEP recommendation E402 . 
>>
>> As per PyMySQL doc , python3 is supported . 
>>
>> here is my error: 
>>
>> {
>> "module_stdout": "",
>> "module_stderr": "Traceback (most recent call last):\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 114, in \n_ansiballz_main()\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>> ANSIBALLZ_PARAMS)\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
>> MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
>> line 110, in \n  File 
>> \"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
>>  
>> line 33, in \n  File 
>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\",
>>  
>> line 59, in \nfrom . import connections  # noqa: E402\n  File 
>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",
>>  
>> line 167\n*,\n ^\nSyntaxError: invalid syntax\n",
>> "exception": "Traceback (most recent call last):\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 114, in \n_ansiballz_main()\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
>> ANSIBALLZ_PARAMS)\n  File 
>> \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
>>  
>> line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
>> MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
>> line 110, in \n  File 
>> \"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
>>  
>> line 33, in \n  File 
>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\",
>>  
>> line 59, in \nfrom . import connections  # noqa: E402\n  File 
>> \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",
>>  
>> line 167\n*,\n ^\nSyntaxError: invalid syntax\n",
>> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
>> "rc": 1,
>> "_ansible_no_log": false,
>> "changed&quo

[ansible-project] mysql_db and pymysql error

2021-04-08 Thread Nick-H
I am trying to move to python 3.6 on centos 7.8 and ansible 2.8.12 
Mysql_db module fails importing connections from PyMySQL pip module.
At least with recent versions ( 0.9 ,1.0.2 ) using 0.7 pass. 

the error seems to be related to a PEP recommendation E402 . 

As per PyMySQL doc , python3 is supported . 

here is my error: 

{
"module_stdout": "",
"module_stderr": "Traceback (most recent call last):\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 114, in \n_ansiballz_main()\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
ANSIBALLZ_PARAMS)\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
line 110, in \n  File 
\"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
 
line 33, in \n  File 
\"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\", 
line 59, in \nfrom . import connections  # noqa: E402\n  File 
\"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",
 
line 167\n*,\n ^\nSyntaxError: invalid syntax\n",
"exception": "Traceback (most recent call last):\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 114, in \n_ansiballz_main()\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 106, in _ansiballz_main\ninvoke_module(zipped_mod, temp_path, 
ANSIBALLZ_PARAMS)\n  File 
\"/var/lib/awx/.ansible/tmp/ansible-tmp-1617903869.1782537-29212-149280496397207/AnsiballZ_mysql_db.py\",
 
line 49, in invoke_module\nimp.load_module('__main__', mod, module, 
MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_3i8jCj/__main__.py\", 
line 110, in \n  File 
\"/tmp/ansible_mysql_db_payload_3i8jCj/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\",
 
line 33, in \n  File 
\"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\", 
line 59, in \nfrom . import connections  # noqa: E402\n  File 
\"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\",
 
line 167\n*,\n ^\nSyntaxError: invalid syntax\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"_ansible_no_log": false,
"changed": false
}



-- 
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/c9a3c9a6-f31f-43fc-901f-e328d6d6b1een%40googlegroups.com.


[ansible-project] "Unable to find pip..."

2021-04-05 Thread Nick-H
I am trying to use pip module to create a virtual_env for python3 on 
Centos7 .
I have tried a few variety of parameters but each returned various errors .

If I set : 
  virtualenv_command: /usr/bin/python3 -m venv
Then it fails with "--ensurepip" error 
So I tried to skip the use of venv module and rely on virtual_env , howvere 
now it fails saying pip is not present .

pip 21 is present though .

any thoughts ? 


{
"ansible_loop_var": "item",
"_ansible_no_log": false,
"invocation": {
"module_args": {
"virtualenv": "/opt/venvs/py3_ansible28",
"virtualenv_site_packages": false,
"virtualenv_command": "virtualenv",
"chdir": null,
"requirements": null,
"name": [
"awscli",
"boto",
"boto3",
"botocore",
"setuptools",
"pip",
"python-memcached",
"psutil",
"requests",
"PyMySQL",
"requests_oauthlib",
"oauthlib",
"python-jenkins",
"lxml",
"openshift"
],
"virtualenv_python": "python3",
"umask": "0022",
"editable": false,
"executable": null,
"use_mirrors": true,
"extra_args": "--force-reinstall",
"state": "latest",
"version": null
}
},
"item": [
{
"ansible_version": "2.8.12",
"venv_name": "py3_ansible28"
},
{
"package": [
"awscli",
"boto",
"boto3",
"botocore",
"setuptools",
"pip",
"python-memcached",
"psutil",
"requests",
"PyMySQL",
"requests_oauthlib",
"oauthlib",
"python-jenkins",
"lxml",
"openshift"
]
}
],
"changed": false,
"msg": "Unable to find pip in the virtualenv, /opt/venvs/py3_ansible28, 
under any of these names: pip2, pip. Make sure pip is present in the 
virtualenv.",
"_ansible_item_label": [
{
"venv_name": "py3_ansible28",
"ansible_version": "2.8.12"
},
{
"package": [
"awscli",
"boto",
"boto3",
"botocore",
"setuptools",
"pip",
"python-memcached",
"psutil",
"requests",
"PyMySQL",
"requests_oauthlib",
"oauthlib",
"python-jenkins",
"lxml",
"openshift"
]
}
]
}

-- 
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/a604bb0b-6c7f-4fdd-833f-f2b4c37a247fn%40googlegroups.com.


[ansible-project] Re: exclude_path not working on archive module

2020-12-28 Thread Nick-H
seems like the issue was closed because the module moved to community , 
although nothing is fixed .
https://github.com/ansible/ansible/issues/34316

Here what I do , without success :

- name: archiving
  archive:
mode : 0755
path: /foo/bar/*  # here I added an extra '/*'  to make 
exclude_path working as suggested in the github issue 
dest: /foo/baz
exclude_path: 
  - /foo/bar/abc/ # this seems to be excluded ok
  - /foo/bar/123/*xyz/  # this never worked 
  async: 1000
  poll: 10
  tags: zip 




Le dimanche 27 décembre 2020 à 18:38:12 UTC-8, Nick-H a écrit :

> I have the same problem, I want to use 'exclude_path' ,but I can't get it  
> working. 
> The issue on github is now closed even though the problem remain I think.
> Was there any way to make exclusion working as it should, I mean as it is 
> described in the doc ? 
> tks
>
>
> Le lundi 21 janvier 2019 à 10:46:57 UTC-8, James LeBlanc a écrit :
>
>> No worries!
>> I barely check these boards because of the overwhelming amount of ansible 
>> posts that fly around here.  I can't even come close to keeping up with all 
>> of the different applications and usages that show up and get asked about 
>> on these boards.  
>> I'm glad you settled on a work-around while also sorry that we have to do 
>> work-arounds for something as common as tar.  I had to settle for a 
>> work-around for my ansible tar usage as well.  Maybe when I get free time 
>> I'll look into the most updated version on git hub and see if it should be 
>> fixed or not...
>>
>>
>> On Monday, January 21, 2019 at 11:37:19 AM UTC-5, JS wrote:
>>>
>>> Hi James
>>>
>>> Apologies, I thought I'd already replied to your message!
>>>
>>> I've tried the latest version of ansible - still haven't had much luck 
>>> with the archive module and exclude_path.
>>>
>>> I've just restored to using the shell module for now to tar it up 
>>> manually, but it's not great!
>>>
>>> Regards
>>> JS
>>>
>>

-- 
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/5b29f3bb-2995-4ce3-8e4b-3e5f15d2a428n%40googlegroups.com.


[ansible-project] Re: exclude_path not working on archive module

2020-12-27 Thread Nick-H
I have the same problem, I want to use 'exclude_path' ,but I can't get it  
working. 
The issue on github is now closed even though the problem remain I think.
Was there any way to make exclusion working as it should, I mean as it is 
described in the doc ? 
tks


Le lundi 21 janvier 2019 à 10:46:57 UTC-8, James LeBlanc a écrit :

> No worries!
> I barely check these boards because of the overwhelming amount of ansible 
> posts that fly around here.  I can't even come close to keeping up with all 
> of the different applications and usages that show up and get asked about 
> on these boards.  
> I'm glad you settled on a work-around while also sorry that we have to do 
> work-arounds for something as common as tar.  I had to settle for a 
> work-around for my ansible tar usage as well.  Maybe when I get free time 
> I'll look into the most updated version on git hub and see if it should be 
> fixed or not...
>
>
> On Monday, January 21, 2019 at 11:37:19 AM UTC-5, JS wrote:
>>
>> Hi James
>>
>> Apologies, I thought I'd already replied to your message!
>>
>> I've tried the latest version of ansible - still haven't had much luck 
>> with the archive module and exclude_path.
>>
>> I've just restored to using the shell module for now to tar it up 
>> manually, but it's not great!
>>
>> Regards
>> JS
>>
>

-- 
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/05d1cf8a-6a23-4521-a26f-a5ca0abd7b17n%40googlegroups.com.


[ansible-project] Is there a better way to do this: Wait for windows services like winrm using a timer

2020-12-12 Thread Nick Maize
Right now I'm working on a project to join a Windows server to the domain, 
the process works but currently I'm waiting for the winrm service using 
win_wait_for. Is there a more dynamic way to do this? Generic example below 
of the wait.

- name: Wait for winrm to come back online after reboot
win_wait_for:
port: "{{ ansible_winrm_port }}"
delay: 60
when: dc1.reboot_required

Any help is greatly appreciated as I have wait timers in a lot of places 
and it feels like an area to make the code more efficient. 

-- 
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/c7fb4740-c0e0-45a2-a8f6-15d6af0fd339n%40googlegroups.com.


Re: [ansible-project] Ansible tower issue

2020-10-10 Thread Nick Schendel
Looks like your issue is a permissions problem:

change_dir \\"/opt/tibco/image\\" failed: Permission denied


I'd check permissions on that directory.  Seems like it's probably the
destination directory at first glance.  Make sure the user that ansible is
connecting as has permissions to write there.

On Fri, Oct 9, 2020, 10:31 PM Abdulrazzaq shaik <
shaikabdulrazza...@gmail.com> wrote:

> Hi all,
>
> Kindly help on the below issue,
>
> I was trying to 2gb file from ansible controller to ansible node where am
> using copy / synchronize module and my all playbooks are working fine in
> the ansible cli, when it come to ansible tower am getting below error.
>
> Kindly help what could be the issue.
>
> *Error:*
> fatal: [ p01lap095.corp.tet.tst   ]: FAILED! => {
> "changed": false,
> "cmd": "sshpass -d8 /usr/bin/rsync --delay-updates -F --compress
> --archive --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o
> UserKnownHostsFile=/dev/null --out-format=<>%i %n%L
> /opt/tibco/image/binaries.tar tibco@ p01lap095.corp.tet.tst :/opt/tibco",
> "invocation": {
> "module_args": {
> "_local_rsync_password":
> "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
> "_local_rsync_path": "rsync",
> "_substitute_controller": false,
> "archive": true,
> "checksum": false,
> "compress": true,
> "copy_links": false,
> "delete": false,
> "dest": "tibco@ p01lap095.corp.tet.tst  :/opt/tibco",
> "dest_port": null,
> "dirs": false,
> "existing_only": false,
> "group": null,
> "link_dest": null,
> "links": null,
> "mode": "push",
> "owner": null,
> "partial": false,
> "perms": null,
> "private_key": null,
> "recursive": null,
> "rsync_opts": [],
> "rsync_path": null,
> "rsync_timeout": 0,
> "set_remote_user": true,
> "src": "/opt/tibco/image/binaries.tar",
> "ssh_args": null,
> "times": null,
> "verify_host": false
> }
> },
> "msg": "Warning: Permanently added
> 'p01lap095.corp.tet.tst,xxx.xxx.xx.xxx' (ECDSA) to the list of known
> hosts.\\r\\n\\n*
>  THIS SYSTEM AND ALL RELATED INFORMATION ACCESSED THEREBY IS THE PROPERTY
>
> *\\n\\n\\nrsync:
> change_dir \\"/opt/tibco/image\\" failed: Permission denied (13)\\nrsync
> error: some files/attrs were not transferred (see previous errors) (code
> 23) at main.c(1179) [sender=3.1.2]\\n",
> "rc": 23
> }
>
> --
> 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/5f6db198-4094-4a68-a965-3ed8a5ec6fa9n%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/CA%2BBXYZFM%3DEYODvzD%3DM%2ByiAXU0MfmyxKEZ%2BZyOvBbRc2Kij0xuA%40mail.gmail.com.


Re: [ansible-project] can we pass a wildcard in a module's parameter's value ?

2020-10-08 Thread Nick-H
a string, that is a string like in my first example .


Le mercredi 7 octobre 2020 à 23:42:32 UTC-7, brae...@gmail.com a écrit :

> On 10/8/20 8:37 AM, Dick Visser wrote:
> > Parameters can be many things: strings, lists, dicts, boolenas etc.
> > A generic "wild card" or regex therefore doesn't mean much.
>
> The module needs to support the type, so in general a wildcard would only 
> work if the module explicitly supports it.
>
> Regards
> Racke
>
> > 
> > On Thu, 8 Oct 2020 at 07:22, Nick-H  wrote:
> >>
> >> been reading most of ansible docbut can't find anything related to this,
> >> Can't we just use regular expression for passing a string as a 
> parameter ?
> >>
> >> It looks pretty simple case :
> >>
> >> a_module:
> >> param1: something_well_defined
> >> param2: regex(something_not_so_well_defined.*)
> >>
> >>
> >>
> >>
> >> Le mercredi 7 octobre 2020 à 15:53:24 UTC-7, Nick-H a écrit :
> >>>
> >>> I am not quite sure what {{something}} was supposed to be here ?
> >>>
> >>>
> >>> Le mercredi 7 octobre 2020 à 14:50:31 UTC-7, Nick-H a écrit :
> >>>>
> >>>> thanks Matt,
> >>>> here is the real example , trying to remove multiple IAM policies 
> from a bunch of users
> >>>>
> >>>> - name: assign policies to a given user
> >>>> iam_policy:
> >>>> iam_type: user
> >>>> iam_name: "{{ item }}"
> >>>> state: absent
> >>>> policy_name: "{{ starts_with('database_access-(ro|rw)') }}" ## here I 
> need to wildcard to any policy starting with that string .
> >>>> # policy_name: "database_access-(ro | rw)" # the other possibility is 
> to find a switch like here so it can either do database_access-ro OR 
> database_access_rw , regex maybe ?
> >>>>
> >>>> loop: "{{ my_users }}"
> >>>>
> >>>> As I already have one loop for users , I was trying to find a filter 
> that I could directly pass in the 'policy_name' parameter .
> >>>>
> >>>>
> >>>>
> >>>> Le mercredi 7 octobre 2020 à 14:20:49 UTC-7, Matt Martz a écrit :
> >>>>>
> >>>>> I have no idea what your goal is, and without giving a concrete 
> example with an actual module I cannot say.
> >>>>>
> >>>>> You want to loop some list variable, but limit to only values that 
> start with prefixed- from that list?
> >>>>>
> >>>>> loop: "{{ something|select('match', 'prefixed-.*')|list }}"
> >>>>>
> >>>>> Or you could do:
> >>>>>
> >>>>> loop: "{{ something }}'
> >>>>> when: item.startswith('prefixed-')
> >>>>>
> >>>>> On Wed, Oct 7, 2020 at 4:15 PM Nick-H  wrote:
> >>>>>>
> >>>>>> hi, again a very simple use case in appearance but that is driving 
> me nuts to realize with ansible, anyone ever done :
> >>>>>> tasks:
> >>>>>> - name: run a module
> >>>>>> any_module:
> >>>>>> users: {{item}} # I want to loop first here
> >>>>>> state: absent
> >>>>>> name: "prefixed-*" # basically anything that starts with 'prefixed'
> >>>>>>
> >>>>>> I tried :
> >>>>>> - as above just using the wildcard symbol , doesn't work
> >>>>>> Things that comes to mind :
> >>>>>> - use startswith , but can't find the syntax that would fit here
> >>>>>> - use another loop, but that tales me to the slope of nested_loops 
> , something I was NEVER able to make it working.
> >>>>>>
> >>>>>> any simple possibility to just use wildcard in a string ?
> >>>>>>
> >>>>>> 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-proje...@googlegroups.com.
> >>>>>> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com
> .
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Matt Martz
> >>>>> @sivel
> >>>>> sivel.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-proje...@googlegroups.com.
> >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/74d709a8-dc83-414e-9352-1a156eae9959n%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/bb916b5a-4ed3-453d-9ed5-8825d4241533n%40googlegroups.com.


Re: [ansible-project] can we pass a wildcard in a module's parameter's value ?

2020-10-07 Thread Nick-H
been reading most of ansible docbut can't find anything related to this,
 Can't we just use regular expression for passing a string as a parameter ? 

It looks pretty simple case :

a_module:
 param1:  something_well_defined
 param2:  regex(something_not_so_well_defined.*) 

 


Le mercredi 7 octobre 2020 à 15:53:24 UTC-7, Nick-H a écrit :

> I am not quite sure what {{something}} was supposed to be  here ? 
>
>
> Le mercredi 7 octobre 2020 à 14:50:31 UTC-7, Nick-H a écrit :
>
>> thanks Matt,
>> here is the real example , trying to remove multiple IAM policies from a 
>> bunch of users
>>
>> - name: assign policies to a given user
>> iam_policy:
>>   iam_type: user
>>   iam_name: "{{ item }}"
>>   state: absent
>>   policy_name: "{{ starts_with('database_access-(ro|rw)') }}" ## here 
>> I need to wildcard to any policy starting with that string . 
>>  # policy_name:   "database_access-(ro | rw)"   # the other 
>> possibility is to find a switch like here so it can either do 
>> database_access-ro OR database_access_rw , regex maybe ? 
>>   
>>  loop: "{{ my_users }}" 
>>
>> As I already have one loop for users , I was trying to find a filter that 
>> I could directly pass in the 'policy_name' parameter . 
>>
>>
>>
>> Le mercredi 7 octobre 2020 à 14:20:49 UTC-7, Matt Martz a écrit :
>>
>>> I have no idea what your goal is, and without giving a concrete example 
>>> with an actual module I cannot say.
>>>
>>> You want to loop some list variable, but limit to only values that start 
>>> with prefixed- from that list?
>>>
>>> loop: "{{ something|select('match', 'prefixed-.*')|list }}"
>>>
>>> Or you could do:
>>>
>>> loop: "{{ something }}'
>>> when: item.startswith('prefixed-')
>>>
>>> On Wed, Oct 7, 2020 at 4:15 PM Nick-H  wrote:
>>>
>>>> hi,  again a very simple use case in appearance but that is driving me 
>>>> nuts to realize with ansible, anyone ever done : 
>>>> tasks:
>>>> - name: run a module
>>>>   any_module:
>>>> users: {{item}} # I want to loop first here 
>>>> state: absent
>>>> name: "prefixed-*" # basically anything that starts with 'prefixed'
>>>>
>>>> I tried : 
>>>> - as above just using the wildcard symbol , doesn't work 
>>>> Things that comes to mind :
>>>> - use startswith , but can't find the syntax that would fit here
>>>> - use another loop, but that tales me to the slope of nested_loops , 
>>>> something I was NEVER able to make it working. 
>>>>
>>>> any simple possibility to just use wildcard in a string ? 
>>>>
>>>> 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-proje...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> -- 
>>> Matt Martz
>>> @sivel
>>> sivel.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/74d709a8-dc83-414e-9352-1a156eae9959n%40googlegroups.com.


Re: [ansible-project] can we pass a wildcard in a module's parameter's value ?

2020-10-07 Thread Nick-H
I am not quite sure what {{something}} was supposed to be  here ? 


Le mercredi 7 octobre 2020 à 14:50:31 UTC-7, Nick-H a écrit :

> thanks Matt,
> here is the real example , trying to remove multiple IAM policies from a 
> bunch of users
>
> - name: assign policies to a given user
> iam_policy:
>   iam_type: user
>   iam_name: "{{ item }}"
>   state: absent
>   policy_name: "{{ starts_with('database_access-(ro|rw)') }}" ## here 
> I need to wildcard to any policy starting with that string . 
>  # policy_name:   "database_access-(ro | rw)"   # the other 
> possibility is to find a switch like here so it can either do 
> database_access-ro OR database_access_rw , regex maybe ? 
>   
>  loop: "{{ my_users }}" 
>
> As I already have one loop for users , I was trying to find a filter that 
> I could directly pass in the 'policy_name' parameter . 
>
>
>
> Le mercredi 7 octobre 2020 à 14:20:49 UTC-7, Matt Martz a écrit :
>
>> I have no idea what your goal is, and without giving a concrete example 
>> with an actual module I cannot say.
>>
>> You want to loop some list variable, but limit to only values that start 
>> with prefixed- from that list?
>>
>> loop: "{{ something|select('match', 'prefixed-.*')|list }}"
>>
>> Or you could do:
>>
>> loop: "{{ something }}'
>> when: item.startswith('prefixed-')
>>
>> On Wed, Oct 7, 2020 at 4:15 PM Nick-H  wrote:
>>
>>> hi,  again a very simple use case in appearance but that is driving me 
>>> nuts to realize with ansible, anyone ever done : 
>>> tasks:
>>> - name: run a module
>>>   any_module:
>>> users: {{item}} # I want to loop first here 
>>> state: absent
>>> name: "prefixed-*" # basically anything that starts with 'prefixed'
>>>
>>> I tried : 
>>> - as above just using the wildcard symbol , doesn't work 
>>> Things that comes to mind :
>>> - use startswith , but can't find the syntax that would fit here
>>> - use another loop, but that tales me to the slope of nested_loops , 
>>> something I was NEVER able to make it working. 
>>>
>>> any simple possibility to just use wildcard in a string ? 
>>>
>>> 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-proje...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>> Matt Martz
>> @sivel
>> sivel.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/5f6d763b-cdaa-475a-8ead-6e5ab1f0d3ddn%40googlegroups.com.


Re: [ansible-project] can we pass a wildcard in a module's parameter's value ?

2020-10-07 Thread Nick-H
thanks Matt,
here is the real example , trying to remove multiple IAM policies from a 
bunch of users

- name: assign policies to a given user
iam_policy:
  iam_type: user
  iam_name: "{{ item }}"
  state: absent
  policy_name: "{{ starts_with('database_access-(ro|rw)') }}" ## here I 
need to wildcard to any policy starting with that string . 
 # policy_name:   "database_access-(ro | rw)"   # the other possibility 
is to find a switch like here so it can either do database_access-ro OR 
database_access_rw , regex maybe ? 
  
 loop: "{{ my_users }}" 

As I already have one loop for users , I was trying to find a filter that I 
could directly pass in the 'policy_name' parameter . 



Le mercredi 7 octobre 2020 à 14:20:49 UTC-7, Matt Martz a écrit :

> I have no idea what your goal is, and without giving a concrete example 
> with an actual module I cannot say.
>
> You want to loop some list variable, but limit to only values that start 
> with prefixed- from that list?
>
> loop: "{{ something|select('match', 'prefixed-.*')|list }}"
>
> Or you could do:
>
> loop: "{{ something }}'
> when: item.startswith('prefixed-')
>
> On Wed, Oct 7, 2020 at 4:15 PM Nick-H  wrote:
>
>> hi,  again a very simple use case in appearance but that is driving me 
>> nuts to realize with ansible, anyone ever done : 
>> tasks:
>> - name: run a module
>>   any_module:
>> users: {{item}} # I want to loop first here 
>> state: absent
>> name: "prefixed-*" # basically anything that starts with 'prefixed'
>>
>> I tried : 
>> - as above just using the wildcard symbol , doesn't work 
>> Things that comes to mind :
>> - use startswith , but can't find the syntax that would fit here
>> - use another loop, but that tales me to the slope of nested_loops , 
>> something I was NEVER able to make it working. 
>>
>> any simple possibility to just use wildcard in a string ? 
>>
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.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/1a7d472d-a48a-4307-982c-7c9fec7caa12n%40googlegroups.com.


[ansible-project] can we pass a wildcard in a module's parameter's value ?

2020-10-07 Thread Nick-H
hi,  again a very simple use case in appearance but that is driving me nuts 
to realize with ansible, anyone ever done : 
tasks:
- name: run a module
  any_module:
users: {{item}} # I want to loop first here 
state: absent
name: "prefixed-*" # basically anything that starts with 'prefixed'

I tried : 
- as above just using the wildcard symbol , doesn't work 
Things that comes to mind :
- use startswith , but can't find the syntax that would fit here
- use another loop, but that tales me to the slope of nested_loops , 
something I was NEVER able to make it working. 

any simple possibility to just use wildcard in a string ? 

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/2b7ce081-b637-43f0-875b-3fb1202501c2n%40googlegroups.com.


[ansible-project] pass module args as extra variable

2020-09-01 Thread Nick-H
Hi, 
in order to debug a playbook , I need to pass some value to a module_arg at 
run time .
I thought using extra-variables but it doesn't work, args still show 'null' 
The module is elasticache and I need to try a run with hard_modify  = true 
. 
But this is not part as one of the existing variable in my playbook, 
I just need to override at runtime the default value from the module (I am 
using Tower)
I tried the following: 
elasticache: 
  hard_modify: true 

as well as : 
elasticache.hard_modify: true 

but none worked and the default value is still returned.  

-- 
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/7b6ff536-d358-4e01-b118-0942fec9b96dn%40googlegroups.com.


Re: [ansible-project] Re: 2 levels nested loop with variables

2020-08-17 Thread Nick-H
so basically I *just *need to  loop over extra variables in an inline way 
to construct the unique name and the unique policy template, then,  the 
usual loop for the module will create the resources in aws.
- should using *Lookup *a good start  for inline loop ?
- as *nested *and *subelements *can't seem to achieve this, what other 
solution I can explore ? 
cheers
Le lundi 17 août 2020 à 11:52:15 UTC-7, Nick-H a écrit :

> Thanks Racke, I should have had some context. policy_name can vary, 
> actually in the real task I have other policies with other names, hence the 
> use of a loop for item.name and item.policy .
> Just this specific one named rds_foo_bar  needs the nested arguments from 
> my vars list(or dict I am not sure) .
> Although I can create a dedicate task just for that policy if that is too 
> complicated, I just thought I could do some nested loop over variables.
> Interesting facts, with nested it actually loop over each character in the 
> key:value 
> *Couldn't create policy rds-dev-[[u'r', u'e', u'g', u'i', u'o', u'n', 
> u's'], [u'r', u'o', u'l', u'e']]* 
>
> the actual play  looks like: 
>
> iam_managed_policy:
> policy_name: "{{ item.name }}"
> policy: "{{ item.policy }}"
> state: present
>   loop:
> - { name: 
> "rds-prod-{{ lookup('dict', mysql_privilege[0].value ) }} ",  
> policy: "{{ lookup('template', rds-prod.json.j2) }}" }
> # - { name: "rds-dev-{{  lookup('nested',mysql_privilege )",  
> policy: "{{ lookup('template', rds_dev.json.j2) }}" }
>
> # - { name: cloudwatch, policy: "{{ 
> lookup('template','cloudwatch.json.j2') }}" }
> # other policies with name and policy
>   vars:
> mysql_privilege:
>   role:
> - rw
> - ro
>  rds_region:
> - us-west-1
> - us-west-2
>
> And rds-prod.json.j2 also reuses the variables from  mysql_privilege dict 
> as: 
> ...
> "Action": [
> "rds-db:connect"
> ],
> "Resource": "arn:aws:rds-db:{{ rds_region }}{{ aws_id 
> }}:dbuser:*/username-{{ role }}"
> ...
>
>
> Le jeudi 13 août 2020 à 11:39:26 UTC-7, brae...@gmail.com a écrit :
>
>> On 8/13/20 8:00 PM, Nick-H wrote: 
>> > so, I have been trying with lookup('dict')  but still not quite close 
>> to the expected result  
>> > I get: " An unhandled exception occurred while running the lookup 
>> plugin 'dict'. Error was a > > 'ansible.errors.AnsibleError'>, original message: with_dict expects a 
>> dict" 
>> > her is the last code : 
>> > 
>> >   iam_managed_policy: 
>> > policy_name: "{{ item.name }}" 
>> > policy: "{{ item.policy }}" 
>> > state: present 
>> >   loop: 
>> > 
>> - { name: "rds-{{ lookup('dict', mysql_privilege[0].value ) }} ", 
>> policy: "{{ lookup('template', 'template.json.j2') }}" } 
>>
>> > 
>> # - { name: "rds-{{ lookup('nested', mysql_privilege[role] ) }} ", 
>> policy: "{{ lookup('template', 'template.json.j2') }}" } 
>>
>> >   vars: 
>> > mysql_privilege: 
>> > role: 
>> >   - rw 
>> >   - ro 
>> > regions: 
>> >   - us-west-1 
>> >   - us-west-2 
>> > 
>>
>> What are the possible values for policy_name? The value for the "policy" 
>> seems to the same lookup so you don't need in 
>> the loop. 
>>
>> I'm pretty sure that you are running into brick walls for a possibly 
>> simple problem. 
>>
>> So please explain / give examples how the policy_name is constructed. 
>>
>> Regards 
>> Racke 
>>
>> > 
>> > 
>> > 
>> > Le mercredi 12 août 2020 à 17:27:22 UTC-7, Nick-H a écrit : 
>> > 
>> > Hi, I have been looking into /nested /, /subelements /and other 
>> /lookups /with no luck to make this working , using 
>> > ansible 2.8.  
>> > Basically , I'd like to construct a loop than can itself iterate over 
>> other variables (list or dict).  
>> > *  iam_managed_policy:* 
>> > *policy_name: "{{ item.name <http://item.name> }}"* 
>> >

Re: [ansible-project] Re: 2 levels nested loop with variables

2020-08-17 Thread Nick-H
Thanks Racke, I should have had some context. policy_name can vary, 
actually in the real task I have other policies with other names, hence the 
use of a loop for item.name and item.policy .
Just this specific one named rds_foo_bar  needs the nested arguments from 
my vars list(or dict I am not sure) .
Although I can create a dedicate task just for that policy if that is too 
complicated, I just thought I could do some nested loop over variables.
Interesting facts, with nested it actually loop over each character in the 
key:value 
*Couldn't create policy rds-dev-[[u'r', u'e', u'g', u'i', u'o', u'n', 
u's'], [u'r', u'o', u'l', u'e']]* 

the actual play  looks like: 

iam_managed_policy:
policy_name: "{{ item.name }}"
policy: "{{ item.policy }}"
state: present
  loop:
- { name: "rds-prod-{{ lookup('dict', mysql_privilege[0].value ) }} ",  
policy: "{{ lookup('template', rds-prod.json.j2) }}" }
# - { name: "rds-dev-{{  lookup('nested',mysql_privilege )",  
policy: "{{ lookup('template', rds_dev.json.j2) }}" }
# - { name: cloudwatch, policy: "{{ lookup('template','cloudwatch.json.j2') 
}}" }
# other policies with name and policy
  vars:
mysql_privilege:
  role:
- rw
- ro
 rds_region:
- us-west-1
- us-west-2

And rds-prod.json.j2 also reuses the variables from  mysql_privilege dict 
as: 
...
"Action": [
"rds-db:connect"
],
"Resource": "arn:aws:rds-db:{{ rds_region }}{{ aws_id 
}}:dbuser:*/username-{{ role }}"
...


Le jeudi 13 août 2020 à 11:39:26 UTC-7, brae...@gmail.com a écrit :

> On 8/13/20 8:00 PM, Nick-H wrote:
> > so, I have been trying with lookup('dict')  but still not quite close to 
> the expected result 
> > I get: " An unhandled exception occurred while running the lookup plugin 
> 'dict'. Error was a  > 'ansible.errors.AnsibleError'>, original message: with_dict expects a 
> dict"
> > her is the last code :
> > 
> >   iam_managed_policy:
> > policy_name: "{{ item.name }}"
> > policy: "{{ item.policy }}"
> > state: present
> >   loop:
> > 
> - { name: "rds-{{ lookup('dict', mysql_privilege[0].value ) }} ", policy: 
> "{{ lookup('template', 'template.json.j2') }}" }
> > 
> # - { name: "rds-{{ lookup('nested', mysql_privilege[role] ) }} ", 
> policy: "{{ lookup('template', 'template.json.j2') }}" }
> >   vars:
> > mysql_privilege:
> > role:
> >   - rw
> >   - ro
> > regions:
> >   - us-west-1
> >   - us-west-2
> > 
>
> What are the possible values for policy_name? The value for the "policy" 
> seems to the same lookup so you don't need in
> the loop.
>
> I'm pretty sure that you are running into brick walls for a possibly 
> simple problem.
>
> So please explain / give examples how the policy_name is constructed.
>
> Regards
> Racke
>
> > 
> > 
> > 
> > Le mercredi 12 août 2020 à 17:27:22 UTC-7, Nick-H a écrit :
> > 
> > Hi, I have been looking into /nested /, /subelements /and other /lookups 
> /with no luck to make this working , using
> > ansible 2.8. 
> > Basically , I'd like to construct a loop than can itself iterate over 
> other variables (list or dict). 
> > *  iam_managed_policy:*
> > *policy_name: "{{ item.name <http://item.name> }}"*
> > *policy: "{{ item.policy }}"*
> > *state: present*
> > *  loop:*
> > *- { name: "rds-{{mysql_privilege}}-{{regions}}", policy: 
> "{{ lookup('template', template.json.j2') }}" }*
> > *  vars:*
> > *mysql_privilege:**  *
> > *- rw*
> > *- ro*
> > *regions:*
> > *- us-west-1*
> > *- us-west-2*
> > 
> > but it end up with such result:
> > "Couldn't create policy rds-prod-[u'rw', u'ro'] - [u'ca-central-1', 
> u'us-west-1']"
> > 
> > What i d like is each loop would build a 2 dimensions array with the 
> vars elements ( rw-us-west-1 , rw-us-west-2, 
> > ro-us-west-1, ro-us-west-2)
> > 
> > Is that even possible to achieve with ansible ? 
> > thanks
> > 

Re: [ansible-project] Re: 2 levels nested loop with variables

2020-08-13 Thread Nick-H
Thanks Racke, I should have had some context. policy_name can vary, 
actually in the real task I have other policies with other names, hence the 
use of a loop for item.name and item.policy .
Just this specific one named rds_foo_bar  needs the nested arguments from 
my vars list(or dict I am not sure) .
Although I can create a dedicate task just for that policy if that is too 
complicated, I just thought I could do some nested loop over variables.
Interesting facts, with nested it actually loop over each character in the 
key:value 
*Couldn't create policy rds-dev-[[u'r', u'e', u'g', u'i', u'o', u'n', 
u's'], [u'r', u'o', u'l', u'e']]* 
the actual play  looks like: 

iam_managed_policy:
policy_name: "{{ item.name }}"
policy: "{{ item.policy }}"
state: present
  loop:
- { name: rds-prod-{{ mysql_privilege }}-{{rds_region}}, policy: "{{ 
lookup('template', rds-prod.json.j2) }}" }
# - { name: rds-dev, 
policy: "{{ lookup('template', rds_dev.json.j2) }}" }
# - { name: cloudwatch, policy: "{{ lookup('template','cloudwatch.json.j2') 
}}" }
# other policies with name and policy
  vars:
mysql_privilege:
  role:
- rw
- ro
 rds_region:
- us-west-1
- us-west-2

And rds-prod.json.j2 also reuses the variables from  mysql_privilege dict 
as: 
...
"Action": [
"rds-db:connect"
],
"Resource": "arn:aws:rds-db:{{ rds_region }}{{ aws_id 
}}:dbuser:*/username-{{ role }}"
...


Le jeudi 13 août 2020 à 11:39:26 UTC-7, brae...@gmail.com a écrit :

> On 8/13/20 8:00 PM, Nick-H wrote:
> > so, I have been trying with lookup('dict')  but still not quite close to 
> the expected result 
> > I get: " An unhandled exception occurred while running the lookup plugin 
> 'dict'. Error was a  > 'ansible.errors.AnsibleError'>, original message: with_dict expects a 
> dict"
> > her is the last code :
> > 
> >   iam_managed_policy:
> > policy_name: "{{ item.name }}"
> > policy: "{{ item.policy }}"
> > state: present
> >   loop:
> > 
> - { name: "rds-{{ lookup('dict', mysql_privilege[0].value ) }} ", policy: 
> "{{ lookup('template', 'template.json.j2') }}" }
> > 
> # - { name: "rds-{{ lookup('nested', mysql_privilege[role] ) }} ", 
> policy: "{{ lookup('template', 'template.json.j2') }}" }
> >   vars:
> > mysql_privilege:
> > role:
> >   - rw
> >   - ro
> > regions:
> >   - us-west-1
> >   - us-west-2
> > 
>
> What are the possible values for policy_name? The value for the "policy" 
> seems to the same lookup so you don't need in
> the loop.
>
> I'm pretty sure that you are running into brick walls for a possibly 
> simple problem.
>
> So please explain / give examples how the policy_name is constructed.
>
> Regards
> Racke
>
> > 
> > 
> > 
> > Le mercredi 12 août 2020 à 17:27:22 UTC-7, Nick-H a écrit :
> > 
> > Hi, I have been looking into /nested /, /subelements /and other /lookups 
> /with no luck to make this working , using
> > ansible 2.8. 
> > Basically , I'd like to construct a loop than can itself iterate over 
> other variables (list or dict). 
> > *  iam_managed_policy:*
> > *policy_name: "{{ item.name <http://item.name> }}"*
> > *policy: "{{ item.policy }}"*
> > *state: present*
> > *  loop:*
> > *- { name: "rds-{{mysql_privilege}}-{{regions}}", policy: 
> "{{ lookup('template', template.json.j2') }}" }*
> > *  vars:*
> > *mysql_privilege:**  *
> > *- rw*
> > *- ro*
> > *regions:*
> > *- us-west-1*
> > *- us-west-2*
> > 
> > but it end up with such result:
> > "Couldn't create policy rds-prod-[u'rw', u'ro'] - [u'ca-central-1', 
> u'us-west-1']"
> > 
> > What i d like is each loop would build a 2 dimensions array with the 
> vars elements ( rw-us-west-1 , rw-us-west-2, 
> > ro-us-west-1, ro-us-west-2)
> > 
> > Is that even possible to achieve with ansible ? 
> > thanks
> > 
> > -- 
> > You received this message because you are subscribed to the Goog

[ansible-project] Re: 2 levels nested loop with variables

2020-08-13 Thread Nick-H
so, I have been trying with lookup('dict')  but still not quite close to 
the expected result 
I get: " An unhandled exception occurred while running the lookup plugin 
'dict'. Error was a , original 
message: with_dict expects a dict"
her is the last code :

  iam_managed_policy:
policy_name: "{{ item.name }}"
policy: "{{ item.policy }}"
state: present
  loop:
- { name: "rds-{{ lookup('dict', mysql_privilege[0].value ) }} ", policy: 
"{{ lookup('template', 'template.json.j2') }}" }
# - { name: "rds-{{ lookup('nested', mysql_privilege[role] ) }} ", policy: 
"{{ lookup('template', 'template.json.j2') }}" }
  vars:
mysql_privilege:
    role:
  - rw
  - ro
regions:
  - us-west-1
  - us-west-2




Le mercredi 12 août 2020 à 17:27:22 UTC-7, Nick-H a écrit :

> Hi, I have been looking into *nested *, *subelements *and other *lookups 
> *with 
> no luck to make this working , using ansible 2.8. 
> Basically , I'd like to construct a loop than can itself iterate over 
> other variables (list or dict). 
> *  iam_managed_policy:*
> *policy_name: "{{ item.name <http://item.name> }}"*
> *policy: "{{ item.policy }}"*
> *state: present*
> *  loop:*
> *- { name: "rds-{{mysql_privilege}}-{{regions}}", policy: 
> "{{ lookup('template', template.json.j2') }}" }*
> *  vars:*
> *mysql_privilege:*  
> *- rw*
> *- ro*
> *regions:*
> *- us-west-1*
> *- us-west-2*
>
> but it end up with such result:
> "Couldn't create policy rds-prod-[u'rw', u'ro'] - [u'ca-central-1', 
> u'us-west-1']"
>
> What i d like is each loop would build a 2 dimensions array with the vars 
> elements ( rw-us-west-1 , rw-us-west-2,  ro-us-west-1, ro-us-west-2)
>
> Is that even possible to achieve with ansible ? 
> 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/bacb4345-c3a7-4663-9931-91b3f0225175n%40googlegroups.com.


Re: [ansible-project] Question re: Can Ansible boot an ISO file on a bare metal server?

2020-07-08 Thread Nick Schendel
Directly I don't believe so but depending on what kind of out of band
management capabilities your server has it might be possible in combination
with a few other things. If it has a management interface that can be acted
on via API you might be able to do it via that somehow.  Or you might be
able to find a way to get it to pxe boot and load the iso.  But that would
require a pxe boot server and the setup for that.

Do you have more details on what you are trying to accomplish?  What kind
of physical server?  Do you have any sort of pxe or bare metal provisioning
system in your environment?  Redhat satellite/foreman can be setup to do
that and ansible can be used to automate operations in satellite so by
chaining it all together you could accomplish it but it's not as simple as
a single module.

On Wed, Jul 8, 2020, 6:31 PM DevOps Automation  wrote:

> Hi,
>
> I want to automate the physical server provisioning and build process. Can
> anyone please let me know that, does Ansible can boot an ISO file on a bare
> metal server?
>
> 1. If yes, can you please explain how the connection is established
> between remote and host server. Also the booting procedure.
>
> 2. After booting the server how can we automate the process/pass the
> variables to assign the hostname, IP address for the physical server.
>
> Thanks 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/b3b5aede-6579-4d9c-a21c-0c75ff3a7559o%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/CA%2BBXYZEPYUb3B9c0SuYnOZ2ZXU%2B6gP2wW-Ut9-FHnU0T5PF7Ng%40mail.gmail.com.


[ansible-project] Are jinja2 extensions available?

2020-06-21 Thread Nick Kakouros
Jinja2 documentation mentions some extensions that can be enabled. Are 
these available somehow? Can I enable them in Ansible?

https://jinja.palletsprojects.com/en/2.11.x/templates/#extensions

-- 
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/28c5d0ed-ba8b-4ae2-b51a-1f05f9389cd7o%40googlegroups.com.


[ansible-project] Re: Which module can I use to run command on command prompt on all my hosts ?

2020-06-01 Thread Nick Schendel
Since you mentioned gpupdate, then I assumed windows.  Ultimately the best 
place to look to figure out what you can use is to search the all module 
index:

https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html

most, if not all of the windows stuff has win_

-- 
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/09f615a9-b0f9-461c-b626-7be9fde7e0f7%40googlegroups.com.


[ansible-project] Re: Which module can I use to run command on command prompt on all my hosts ?

2020-06-01 Thread Nick Schendel
https://docs.ansible.com/ansible/latest/modules/win_command_module.html#win-command-module

On Monday, June 1, 2020 at 1:45:21 PM UTC-5, Work-Hard wrote:
>
> Hi,
> Which module can I use as a task to run a command on the command prompt on 
> all my hosts?
>
> example - 
>
> cmd: gpupdate/force
>
> 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/a16a2218-e428-45df-9bfa-c1802cba1235%40googlegroups.com.


[ansible-project] Can I override a collection's module using `library`?

2020-05-12 Thread Nick Kakouros
Many modules in the google.cloud collection are in a sorry state. I would 
like to override some of them with local fixes. Before collections, I could 
specify `library` in my ansible.cfg and place a copy of the module in that 
library folder and ansible would use my fixed version of the module. 

I tried renaming the module to add a `google.cloud` prefix. I also tried to 
place it in a `google/cloud` folder. But nothing seemed to work. 

Is there a way to achieve the above? Should I open a feature request if it 
is not supported?

-- 
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/a3aabcc3-3f4e-48cc-87bb-d6d910c5c53f%40googlegroups.com.


[ansible-project] Questions about collections and issue tracking

2020-05-08 Thread Nick Kakouros
My questions:

- Should I close issues and PRs on ansible's main project and open new ones on 
collections' issue trackers?

- Will there be a massive issue/PR migration from ansible's main project to the 
new collections?

-- 
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/6c12a467-0305-4236-ac7c-12bbc26c6041%40googlegroups.com.


Re: [ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread Nick Kakouros
Thanks for the tip!

On Wednesday, April 22, 2020 at 1:50:55 PM UTC, Felix Fontein wrote:
>
> Hi Nick, 
>
> > Is the a way to combine `with_` and a lookup from a collection? E.g. 
> > the flattened lookup from community.general. 
>
> you can use "with_namespace.collection.plugin:". 
>
> Looks ugly, but works :) 
>
> Cheers, 
> Felix 
>
>
>

-- 
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/d1460697-9a3c-4bd8-9883-f04aab6726c1%40googlegroups.com.


[ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread Nick Kakouros
Is the a way to combine `with_` and a lookup from a collection? E.g. the 
flattened lookup from community.general. 

-- 
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/8f4fa245-3035-492d-83c8-538ad5a6fc0d%40googlegroups.com.


Re: [ansible-project] OS support contribution guidelines

2020-03-24 Thread Nick Venenga
Thanks!

On Wednesday, March 18, 2020 at 8:32:32 PM UTC-4, Matt Davis wrote:
>
> This thread hits on a number of discussions that have been happening for 
> years- rather than trying to recap them here, I wrote a blog post about it: 
> http://blog.rolpdog.com/2020/03/why-no-ansible-controller-for-windows.html
>
> On another note: it bothers me that there's perception that Ansible is a 
> "Red Hat only" project. It's true that those of us that are paid by Red Hat 
> to work on Ansible have to pick and choose carefully where we spend our 
> time, and that the concerns of paying customers (including keeping the 
> underlying codebase reasonably stable) often take priority over shiny 
> things. At the end of the day, Red Hat can't possibly capital-S-support 
> everything, and we have to be really careful about large contributions or 
> projects that are potentially destabilizing (especially when they involve 
> things we currently have no way to test).
>
> One of the major purposes of the move to collections is to get us out of 
> the community's way in this regard. Rather than applying overly-harsh 
> filters to all contributions in the name of capital-S-supportability and 
> releasing at a relatively slow cadence, community-owned collections will be 
> able to apply whatever quality rules they like, apply whatever 
> compatibility policies they like, and release on whatever schedule they 
> like, while still having a way to be part of a "batteries included" 
> community Ansible distribution. For the collections that are 
> capital-S-supported by Red Hat, the requirements for getting contributions 
> accepted will still remain pretty high, but anyone is free to release their 
> own version of that content themselves with whatever changes they like, 
> while still enjoying the stability of the core Ansible engine itself.
>
> We're also working to further plugin-ify and democratize even more of the 
> "guts" of the Ansible engine in future releases. That doesn't directly 
> address this case, but a number of others around first-class target support 
> for many things that aren't Windows or POSIX, and will also probably knock 
> down a few more of the barriers to a hypothetical native-Windows Ansible.
>
> -Matt Davis (@nitzmahone)
>
>

-- 
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/38b49561-b87b-4f2f-b198-108e2b04c3aa%40googlegroups.com.


Re: [ansible-project] Ansible - errno 101 network is unreachable

2020-03-17 Thread Nick Venenga
It sounds like you require a network proxy but haven't configured dnf to 
use it correctly. See https://unix.stackexchange.com/a/436562/249351

On Tuesday, March 17, 2020 at 7:20:54 PM UTC-4, Santhosh Ganesan wrote:
>
> anyhow newbie communication makes bad,
>
> tried setting up a new vm tried a fresh ansible-playbook run on the vm,  
> still getting the same error
>
> dunno where it falls
>
> On Wednesday, March 18, 2020 at 9:26:06 AM UTC+11, Dick Visser wrote:
>>
>> I'm not going to waste more of my time by having information spoon fed 
>> like this. 
>> We're done. 
>>
>> On Tue, 17 Mar 2020 at 22:52, Santhosh Ganesan  wrote: 
>> > 
>> > followed few help from this link 
>> https://access.redhat.com/discussions/4222851#comment-1751291 like dnf 
>> upgrade -y --releasever=8 
>> > 
>> > after that on first run of 
>> > 
>> > ansible-playbook -vvv --flush-cache elk-playbook.yml 
>> > 
>> > Escalation succeeded 
>> > <172.28.158.118> (1, b'\r\n{"msg": "Failed to download packages: Cannot 
>> download 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried", 
>> "results": [], "failed": true, "exception": "  File 
>> \\"/tmp/ansible_dnf_payload_mmu8acfl/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py\\",
>>  
>> line 1179, in ensure\\n  File 
>> \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1159, in 
>> download_packages\\nself._download_remote_payloads(payloads, drpm, 
>> progress, callback_total)\\n  File 
>> \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1089, in 
>> _download_remote_payloads\\nraise 
>> dnf.exceptions.DownloadError(errors._irrecoverable)\\n", "invocation": 
>> {"module_args": {"name": ["elasticsearch"], "state": "present", 
>> "allow_downgrade": false, "autoremove": false, "bugfix": false, 
>> "disable_gpg_check": false, "disable_plugin": [], "disablerepo": [], 
>> "download_only": false, "enable_plugin": [], "enablerepo": [], "exclude": 
>> [], "installroot": "/", "install_repoquery": true, "install_weak_deps": 
>> true, "security": false, "skip_broken": false, "update_cache": false, 
>> "update_only": false, "validate_certs": true, "lock_timeout": 30, 
>> "conf_file": null, "disable_excludes": null, "download_dir": null, "list": 
>> null, "releasever": null}}}\r\n', b'Shared connection to 172.28.158.118 
>> closed.\r\n') 
>> > <172.28.158.118> Failed to connect to the host via ssh: Shared 
>> connection to 172.28.158.118 closed. 
>> > <172.28.158.118> ESTABLISH SSH CONNECTION FOR USER: None 
>> > <172.28.158.118> 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=/root/.ansible/cp/9f99d47bcf 172.28.158.118 '/bin/sh -c '"'"'rm 
>> -f -r /root/.ansible/tmp/ansible-tmp-1584481655.4368277-75248524508419/ > 
>> /dev/null 2>&1 && sleep 0'"'"'' 
>> > <172.28.158.118> (0, b'', b'') 
>> > The full traceback is: 
>> >   File 
>> "/tmp/ansible_dnf_payload_mmu8acfl/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py",
>>  
>> line 1179, in ensure 
>> >   File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1159, in 
>> download_packages 
>> > self._download_remote_payloads(payloads, drpm, progress, 
>> callback_total) 
>> >   File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1089, in 
>> _download_remote_payloads 
>> > raise dnf.exceptions.DownloadError(errors._irrecoverable) 
>> > 
>> > fatal: [172.28.158.118]: FAILED! => { 
>> > "changed": false, 
>> > "invocation": { 
>> > "module_args": { 
>> > "allow_downgrade": false, 
>> > "autoremove": false, 
>> > "bugfix": false, 
>> > "conf_file": null, 
>> > "disable_excludes": null, 
>> > "disable_gpg_check": false, 
>> > "disable_plugin": [], 
>> > "disablerepo": [], 
>> > "download_dir": null, 
>> > "download_only": false, 
>> > "enable_plugin": [], 
>> > "enablerepo": [], 
>> > "exclude": [], 
>> > "install_repoquery": true, 
>> > "install_weak_deps": true, 
>> > "installroot": "/", 
>> > "list": null, 
>> > "lock_timeout": 30, 
>> > "name": [ 
>> > "elasticsearch" 
>> > ], 
>> > "releasever": null, 
>> > "security": false, 
>> > "skip_broken": false, 
>> > "state": "present", 
>> > "update_cache": false, 
>> > "update_only": false, 
>> > "validate_certs": true 
>> > } 
>> > }, 
>> > "msg": "Failed to download packages: Cannot download 
>> 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried", 
>> > "results": [] 
>> > 
>> > On Wednesday, March 18, 2020 at 8:19:15 AM UTC+11, Santhosh Ganesan 
>> wro

Re: [ansible-project] OS support contribution guidelines

2020-03-17 Thread Nick Venenga
Sure, it'd be an astronomical amount of work to fully support Windows. 
That's definitely not going to happen in a single PR. As you mention

> it would be fantastic if we could ever get Ansible as a controller 
working on Windows but the practical realities is that this won't happen 
anytime soon

But that will never happen if PRs that fix Windows issues are rejected on 
the grounds that they may imply future Windows support

>With the introduction of WSL and WSL2 on Windows 10 there is even less of 
a reason to push for this as Ansible

Sure, but the docs also explicitly call out that as not being supported 
either 
https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-ansible-run-on-windows.
 
WSL2 is basically just a stripped down Linux VM so I would definitely 
expect that to work

>The link that sivel has posted explicitly states that Windows is not 
supported for the control node.

As I mentioned, not currently supported and "will never be supported" 
aren't the same thing

Either way sivel says "Changing this, adds to the misconception that we may 
support a windows controller" and now you've said "it would be fantastic if 
we could ever get Ansible as a controller working on Windows" which seem to 
contradict each other. This is why I posted to the list. It seems Ansible 
has no clear strategy here which is very confusing for potential 
contributors


On Tuesday, March 17, 2020 at 6:15:47 PM UTC-4, Jordan Borean wrote:
>
> Windows could be supported if someone did the work
>
>
> I think you are underestimating how much work this would actually require. 
> The biggest (but not the only) issue is that Ansible uses fork in it's 
> worker model and fork is not available on Windows. Changing that to use 
> threads is technically possible and there is/was some work going on to add 
> a way to specify either threading or forking in a strategy to control how 
> this works. This would solve 1 hurdle but there also remains a whole lot of 
> others not limited to
>
>- A whole bunch of other code on the controller is designed 
>specifically for Linux and not Windows. Things like the SSH plugin would 
>most likely break with using the Win32 OpenSSH port
>- Running a playbook on Windows localhost is different than Linux 
>localhost, lookups can act differently especially something like pipe
>   - Should delegate_to: localhost automatically redirect ping to 
>   win_ping for Windows, what happens if there is no win_* equivalent 
> module 
>   or specific options aren't supported
>   - This leads into playbooks developed on Windows as a controller 
>   aren't compatible with Linux as a controller and vice versa
>   - The basic.py module util wrapper imports a few Python modules 
>like 'grp', 'fcntl' and probably others. Without these common utilities 
>used by modules will not work and requires either workaround or more 
>caveats to apply to a Windows host
>   - This would need to be solved and tested before you can start 
>   running Python modules on Windows
>   - Python is riddled with lots of modules only work on X platform or 
>   specific features of this module won't work. This isn't Python's fault 
> but 
>   just due to the differences between Windows and POSIX compliant systems
>   - We don't test Ansible as a controller on Windows
>   - We could fix things as we go but without testing in CI these 
>   things will inevitably break leading to anger from people who use it 
> making 
>   no one happy
>   
>
> This is confusing because there's nothing explicitly calling out that 
>> Windows shouldn't be supported
>>
>
> The link that sivel has posted explicitly states that Windows is not 
> supported for the control node.
>
> As one of the Windows devs it would be fantastic if we could ever get 
> Ansible as a controller working on Windows but the practical realities is 
> that this won't happen anytime soon. With the introduction of WSL and WSL2 
> on Windows 10 there is even less of a reason to push for this as Ansible 
> works perfectly fine under those hosts and it allows you to run it on a 
> Windows host like you are asking.
>

-- 
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/5dabaeec-5522-47f5-9339-2d0d4e4368d6%40googlegroups.com.


Re: [ansible-project] OS support contribution guidelines

2020-03-17 Thread Nick Venenga
Obviously Windows isn't supported as a control host since it doesn't work. 
This has nothing to do with contribution guidelines. Windows could be 
supported if someone did the work but it sounds like that would be rejected 
regardless. This is confusing because there's nothing explicitly calling 
out that Windows shouldn't be supported and previous PRs seem open to the 
idea if community members are willing to do the work

On Tuesday, March 17, 2020 at 5:09:15 PM UTC-4, Matt Martz wrote:
>
> This is documented at 
> https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements
>
> > This includes Red Hat, Debian, CentOS, macOS, any of the BSDs, and so 
> on. Windows is not supported for the control node.
>
> Windows is only supported as the OS for managed nodes.  There are no plans 
> to support Windows as a control node.
>
> On Tue, Mar 17, 2020 at 3:04 PM Nick Venenga  > wrote:
>
>> What host operating systems does Ansible accept PRs for? I got hit with a 
>> hard no here 
>> https://github.com/ansible/ansible/pull/65381#issuecomment-600250171 
>> that sounds like anything Windows related it out of the question. I see 
>> various vague references to reserving the right to only support Linux but 
>> then I see other places referencing MacOS and *BSD. I tried to find 
>> development guidelines to no avail. Is there an official policy or does it 
>> just depend on maintainers mood?
>>
>> -- 
>> 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/01811128-bbc0-4ec8-9be0-7c5423657d48%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/01811128-bbc0-4ec8-9be0-7c5423657d48%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.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/875d794f-7979-459a-b827-55227acc935f%40googlegroups.com.


[ansible-project] OS support contribution guidelines

2020-03-17 Thread Nick Venenga
What host operating systems does Ansible accept PRs for? I got hit with a 
hard no here 
https://github.com/ansible/ansible/pull/65381#issuecomment-600250171 that 
sounds like anything Windows related it out of the question. I see various 
vague references to reserving the right to only support Linux but then I 
see other places referencing MacOS and *BSD. I tried to find development 
guidelines to no avail. Is there an official policy or does it just depend 
on maintainers mood?

-- 
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/01811128-bbc0-4ec8-9be0-7c5423657d48%40googlegroups.com.


Re: [ansible-project] json_query/jmespath filtering question

2020-03-11 Thread Nick Schendel
managed to get it working with this:
  - name: set variable for disk_snap_id
set_fact:
  disk_snap_id: 
"{{ snapshotdetails | to_json | from_json | 
json_query('json.snapshotDiskDetails[?fileName.contains(@, 
`host2restore_1`)].virtualDiskId') }}"

after finding this:
https://stackoverflow.com/questions/48318708/unexpected-templating-type-error-occured-on-ec2-instances-from-json-exp

On Wednesday, March 11, 2020 at 6:31:00 PM UTC-5, Dick Visser wrote:
>
> Can you put a debug task between the uri and set_fact tasks and post 
> what that outputs? 
>
>
> - debug: var=snapshotdetails 
>
>
> If you put this in your ansible.cfg then it's more readable: 
>
> stdout_callback = yaml 
> bin_ansible_callbacks = True 
>
> On Thu, 12 Mar 2020 at 00:01, Nick Schendel  > wrote: 
> > 
> > Yup I absolutely did not notice that, thank you for pointing it out. now 
> I am getting the following error: 
> > 
> > fatal: [host2]: FAILED! => { 
> > "msg": "Unexpected templating type error occurred on ({{ snapshotdetails 
> | from_json | json_query('json.snapshotDiskDetails[?fileName.contains(@, 
> `host2restore_1`)].virtualDiskId') }}): expected string or buffer" 
> > } 
> > 
> > On Wednesday, March 11, 2020 at 5:32:33 PM UTC-5, Dick Visser wrote: 
> >> 
> >> The query for json_query is between single quotes. But you also use 
> >> single quotes to quote 'host2restore_1' - that doesn't work. 
> >> You need to use backticks instead. 
> >> If you look closely you can see that those were in the previous 
> >> example. I agree that it's not easy to spot :) 
> >> 
> >> Dick 
> >> 
> >> On Wed, 11 Mar 2020 at 23:24, Nick Schendel  wrote: 
> >> > 
> >> > Still struggling to get this working.  Posting my entire playbook in 
> case it can help understand what I might be doing wrong: 
> >> > 
> >> > - hosts: '{{inventory_hostname}}' 
> >> >   gather_facts: no 
> >> >   vars: 
> >> > cluser_ip: "{{ rubrik_hostname }}" 
> >> > 
> >> >   tasks: 
> >> > 
> >> >   - name: login to rubrik to generate token 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/session # URL to generate 
> an auth token to be used by subsequent calls 
> >> > force_basic_auth: yes 
> >> > user: '{{ lookup("env", "rubrik_username") }}' 
> >> > password: '{{ lookup("env", "rubrik_password") }}' 
> >> > method: POST 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > validate_certs: yes 
> >> > register: authtoken # token is available as authtoken.json.token 
> >> > delegate_to: localhost 
> >> > become: no 
> >> > 
> >> > 
> >> >   - name: get target vm id 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/vmware/vm?name={{ 
> inventory_hostname_nfq }} 
> >> > headers: 
> >> >   Content-Type: "application/json" 
> >> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> >> > method: GET 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > validate_certs: yes 
> >> > register: vminfo 
> >> > delegate_to: localhost 
> >> > become: no 
> >> > 
> >> >   - name: set variable for target_vm_id 
> >> > set_fact: 
> >> >   target_vm_id: "{{ vminfo.json.data[0].id }}" 
> >> > 
> >> >   - name: get list of snapshots 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/vmware/vm/{{ source_vm_id 
> }}/snapshot 
> >> > headers: 
> >> >   Content-Type: "application/json" 
> >> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> >> > method: GET 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > register: snapshotlist 
> >> > delegate_to: localhost 
> >> > become: no 
> >&

Re: [ansible-project] json_query/jmespath filtering question

2020-03-11 Thread Nick Schendel
Managed to get it working with: 
  - name: set variable for disk_snap_id
set_fact:
  disk_snap_id: 
"{{ snapshotdetails | to_json | from_json | 
json_query('json.snapshotDiskDetails[?fileName.contains(@, 
`PRDEBS100_1`)].virtualDiskId') }}"

after finding this:
https://stackoverflow.com/questions/48318708/unexpected-templating-type-error-occured-on-ec2-instances-from-json-exp


On Wednesday, March 11, 2020 at 6:31:00 PM UTC-5, Dick Visser wrote:
>
> Can you put a debug task between the uri and set_fact tasks and post 
> what that outputs? 
>
>
> - debug: var=snapshotdetails 
>
>
> If you put this in your ansible.cfg then it's more readable: 
>
> stdout_callback = yaml 
> bin_ansible_callbacks = True 
>
> On Thu, 12 Mar 2020 at 00:01, Nick Schendel  > wrote: 
> > 
> > Yup I absolutely did not notice that, thank you for pointing it out. now 
> I am getting the following error: 
> > 
> > fatal: [host2]: FAILED! => { 
> > "msg": "Unexpected templating type error occurred on ({{ snapshotdetails 
> | from_json | json_query('json.snapshotDiskDetails[?fileName.contains(@, 
> `host2restore_1`)].virtualDiskId') }}): expected string or buffer" 
> > } 
> > 
> > On Wednesday, March 11, 2020 at 5:32:33 PM UTC-5, Dick Visser wrote: 
> >> 
> >> The query for json_query is between single quotes. But you also use 
> >> single quotes to quote 'host2restore_1' - that doesn't work. 
> >> You need to use backticks instead. 
> >> If you look closely you can see that those were in the previous 
> >> example. I agree that it's not easy to spot :) 
> >> 
> >> Dick 
> >> 
> >> On Wed, 11 Mar 2020 at 23:24, Nick Schendel  wrote: 
> >> > 
> >> > Still struggling to get this working.  Posting my entire playbook in 
> case it can help understand what I might be doing wrong: 
> >> > 
> >> > - hosts: '{{inventory_hostname}}' 
> >> >   gather_facts: no 
> >> >   vars: 
> >> > cluser_ip: "{{ rubrik_hostname }}" 
> >> > 
> >> >   tasks: 
> >> > 
> >> >   - name: login to rubrik to generate token 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/session # URL to generate 
> an auth token to be used by subsequent calls 
> >> > force_basic_auth: yes 
> >> > user: '{{ lookup("env", "rubrik_username") }}' 
> >> > password: '{{ lookup("env", "rubrik_password") }}' 
> >> > method: POST 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > validate_certs: yes 
> >> > register: authtoken # token is available as authtoken.json.token 
> >> > delegate_to: localhost 
> >> > become: no 
> >> > 
> >> > 
> >> >   - name: get target vm id 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/vmware/vm?name={{ 
> inventory_hostname_nfq }} 
> >> > headers: 
> >> >   Content-Type: "application/json" 
> >> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> >> > method: GET 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > validate_certs: yes 
> >> > register: vminfo 
> >> > delegate_to: localhost 
> >> > become: no 
> >> > 
> >> >   - name: set variable for target_vm_id 
> >> > set_fact: 
> >> >   target_vm_id: "{{ vminfo.json.data[0].id }}" 
> >> > 
> >> >   - name: get list of snapshots 
> >> > uri: 
> >> > url: https://{{ cluser_ip }}/api/v1/vmware/vm/{{ source_vm_id 
> }}/snapshot 
> >> > headers: 
> >> >   Content-Type: "application/json" 
> >> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> >> > method: GET 
> >> > status_code: 200 
> >> > return_content: yes 
> >> > register: snapshotlist 
> >> > delegate_to: localhost 
> >> > become: no 
> >> > 
> >

Re: [ansible-project] json_query/jmespath filtering question

2020-03-11 Thread Nick Schendel
Yup I absolutely did not notice that, thank you for pointing it out. now I 
am getting the following error:

fatal: [host2]: FAILED! => {
"msg": "Unexpected templating type error occurred on ({{ snapshotdetails | 
from_json | json_query('json.snapshotDiskDetails[?fileName.contains(@, 
`host2restore_1`)].virtualDiskId') }}): expected string or buffer"
}

On Wednesday, March 11, 2020 at 5:32:33 PM UTC-5, Dick Visser wrote:
>
> The query for json_query is between single quotes. But you also use 
> single quotes to quote 'host2restore_1' - that doesn't work. 
> You need to use backticks instead. 
> If you look closely you can see that those were in the previous 
> example. I agree that it's not easy to spot :) 
>
> Dick 
>
> On Wed, 11 Mar 2020 at 23:24, Nick Schendel  > wrote: 
> > 
> > Still struggling to get this working.  Posting my entire playbook in 
> case it can help understand what I might be doing wrong: 
> > 
> > - hosts: '{{inventory_hostname}}' 
> >   gather_facts: no 
> >   vars: 
> > cluser_ip: "{{ rubrik_hostname }}" 
> > 
> >   tasks: 
> > 
> >   - name: login to rubrik to generate token 
> > uri: 
> > url: https://{{ cluser_ip }}/api/v1/session # URL to generate an 
> auth token to be used by subsequent calls 
> > force_basic_auth: yes 
> > user: '{{ lookup("env", "rubrik_username") }}' 
> > password: '{{ lookup("env", "rubrik_password") }}' 
> > method: POST 
> > status_code: 200 
> > return_content: yes 
> > validate_certs: yes 
> > register: authtoken # token is available as authtoken.json.token 
> > delegate_to: localhost 
> > become: no 
> > 
> > 
> >   - name: get target vm id 
> > uri: 
> > url: https://{{ cluser_ip }}/api/v1/vmware/vm?name={{ 
> inventory_hostname_nfq }} 
> > headers: 
> >   Content-Type: "application/json" 
> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> > method: GET 
> > status_code: 200 
> > return_content: yes 
> > validate_certs: yes 
> > register: vminfo 
> > delegate_to: localhost 
> > become: no 
> > 
> >   - name: set variable for target_vm_id 
> > set_fact: 
> >   target_vm_id: "{{ vminfo.json.data[0].id }}" 
> > 
> >   - name: get list of snapshots 
> > uri: 
> > url: https://{{ cluser_ip }}/api/v1/vmware/vm/{{ source_vm_id 
> }}/snapshot 
> > headers: 
> >   Content-Type: "application/json" 
> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> > method: GET 
> > status_code: 200 
> > return_content: yes 
> > register: snapshotlist 
> > delegate_to: localhost 
> > become: no 
> > 
> >   - name: get info on the snapshot to be used 
> > uri: 
> >   url: https://{{ cluser_ip }}/api/v1/vmware/vm/snapshot/{{ 
> snapshotlist.json.data[0].id }} 
> >   headers: 
> >   Content-Type: "application/json" 
> >   Authorization: "Bearer {{ authtoken.json.token  }}" # pass 
> authentication token from earlier rather than basic auth 
> >   method: GET 
> >   status_code: 200 
> >   return_content: yes 
> > register: snapshotdetails 
> > delegate_to: localhost 
> > become: no 
> > 
> >   - name: set variable for disk_snap_id 
> > set_fact: 
> >   disk_snap_id: "{{ snapshotdetails | from_json | 
> json_query('json.snapshotDiskDetails[?fileName.contains(@, 
> 'host2restore_1')].virtualDiskId') }}" 
> > 
> > 
> > Error I am getting currently: 
> > TASK [set variable for disk_snap_id] 
> *** 
> > task path: 
> /tmp/awx_56722_7ypjkkvu/project/oracle_refresh_fixorder.yml:67 
> > fatal: [host2]: FAILED! => { 
> > "msg": "template error while templating string: expected token ',', got 
> 'host2restore_1'. String: {{ snapshotdetails | from_json | 
> json_query('json.snapshotDiskDetails[?fileName.contains(@, 
> 'host2restore_1')]') }}" 
> > } 
> > 

Re: [ansible-project] json_query/jmespath filtering question

2020-03-11 Thread Nick Schendel
Still struggling to get this working.  Posting my entire playbook in case 
it can help understand what I might be doing wrong:

- hosts: '{{inventory_hostname}}'
  gather_facts: no
  vars:
cluser_ip: "{{ rubrik_hostname }}"

  tasks:

  - name: login to rubrik to generate token
uri:
url: https://{{ cluser_ip }}/api/v1/session 
# URL to generate an auth token to be used by subsequent calls
force_basic_auth: yes 
user: '{{ lookup("env", "rubrik_username") }}'
password: '{{ lookup("env", "rubrik_password") }}'
method: POST 
status_code: 200
return_content: yes
validate_certs: yes
register: authtoken # token is available as authtoken.json.token
delegate_to: localhost
become: no 


  - name: get target vm id
uri:
url: 
https://{{ cluser_ip }}/api/v1/vmware/vm?name={{ inventory_hostname_nfq }}
headers:
  Content-Type: "application/json"
  Authorization: "Bearer {{ authtoken.json.token  }}" 
# pass authentication token from earlier rather than basic auth
method: GET 
status_code: 200
return_content: yes 
validate_certs: yes 
register: vminfo
delegate_to: localhost
become: no 

  - name: set variable for target_vm_id
set_fact:
  target_vm_id: "{{ vminfo.json.data[0].id }}"

  - name: get list of snapshots
uri:
url: 
https://{{ cluser_ip }}/api/v1/vmware/vm/{{ source_vm_id }}/snapshot 
headers:
  Content-Type: "application/json"
  Authorization: "Bearer {{ authtoken.json.token  }}" 
# pass authentication token from earlier rather than basic auth
method: GET 
status_code: 200
return_content: yes
register: snapshotlist
delegate_to: localhost
become: no 

  - name: get info on the snapshot to be used
uri:
  url: 
https://{{ cluser_ip }}/api/v1/vmware/vm/snapshot/{{ 
snapshotlist.json.data[0].id }}
  headers:
  Content-Type: "application/json"
  Authorization: "Bearer {{ authtoken.json.token  }}" 
# pass authentication token from earlier rather than basic auth
  method: GET 
  status_code: 200
  return_content: yes
register: snapshotdetails
delegate_to: localhost
become: no 

  - name: set variable for disk_snap_id
set_fact:
  disk_snap_id: 
"{{ snapshotdetails | from_json | 
json_query('json.snapshotDiskDetails[?fileName.contains(@, '
host2restore_1')].virtualDiskId') }}"


Error I am getting currently:
TASK [set variable for disk_snap_id] 
***
*task path: /tmp/awx_56722_7ypjkkvu/project/oracle_refresh_fixorder.yml:67*
fatal: [host2]: FAILED! => {
"msg": "template error while templating string: expected token ',', got '
host2restore_1'. String: {{ snapshotdetails | from_json | 
json_query('json.snapshotDiskDetails[?fileName.contains(@, 
'host2restore_1')]') }}"
}

I also attempted setting the actual query string in a separate var, and 
passing that to the json_query as I have seen in many examples but that 
also did not work. not sure what I am doing wrong.  A few permutations I 
have tried have run successfully but then returned a blank value.  As you 
can see from the playbook snapshotdetails is a registered variable from the 
previous task.


On Tuesday, March 10, 2020 at 4:15:54 PM UTC-5, Nick Schendel wrote:
>
> Oops I said the wrong register variable name in my question.  snapshotlist 
> is the registered output of a previous task, snapshotdetails is the 
> register of the task right before this particular task.  the chunk of json 
> I pasted in is pulled from the previous task's output.
> I was previously able to use 
> snapshotdetails.json.snapshotDiskDetails[1].virtualDiskId to get a value in 
> the play, it was the filtering that I have been struggling with. 
>
> Thanks for the reply I will give that a shot. 
>
> On Tuesday, March 10, 2020 at 4:05:15 PM UTC-5, Dick Visser wrote:
>>
>> You need to filter a variable through json_query.
>> Also, I don't see any key called 'snapshotdetails'.
>> And that json string should be filtered through from_json, ideally.
>>
>> It looks like your "json" var isn't really what you are using.
>> If I shuffle things around slightly, then below playbook works:
>>
>> ---
>> - hosts: localhost
>>   connection: local
>>   gather_facts: no
>>
>>   vars:
>> json: |
>>   {
>> "vmwareTagList": [],
>> "isCorrupt": false,
>> "snapshotDiskDetails": [
>>

Re: [ansible-project] json_query/jmespath filtering question

2020-03-10 Thread Nick Schendel
Oops I said the wrong register variable name in my question.  snapshotlist 
is the registered output of a previous task, snapshotdetails is the 
register of the task right before this particular task.  the chunk of json 
I pasted in is pulled from the previous task's output.
I was previously able to use 
snapshotdetails.json.snapshotDiskDetails[1].virtualDiskId to get a value in 
the play, it was the filtering that I have been struggling with. 

Thanks for the reply I will give that a shot. 

On Tuesday, March 10, 2020 at 4:05:15 PM UTC-5, Dick Visser wrote:
>
> You need to filter a variable through json_query.
> Also, I don't see any key called 'snapshotdetails'.
> And that json string should be filtered through from_json, ideally.
>
> It looks like your "json" var isn't really what you are using.
> If I shuffle things around slightly, then below playbook works:
>
> ---
> - hosts: localhost
>   connection: local
>   gather_facts: no
>
>   vars:
> json: |
>   {
> "vmwareTagList": [],
> "isCorrupt": false,
> "snapshotDiskDetails": [
>   {
> "virtualDiskId": 
> "23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2001",
> "deviceKey": 2001,
> "size": 214748364800,
> "id": "83fecf84-26db-42db-9f33-ec7e10b5f736",
> "fileName": "[DC1_LINUX_VM_STORAGE] 
> host2restore/host2restore_1.vmdk"
>   },
>   {
> "virtualDiskId": 
> "23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2002",
> "deviceKey": 2002,
> "size": 214748364800,
> "id": "1a9c094f-f19b-4ea7-1406-ab145b0ec2f1",
> "fileName": "[DC1_LINUX_VM_STORAGE] 
> host2restore/host2restore_2.vmdk"
>   },
>   {
> "virtualDiskId": 
> "23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2000",
> "deviceKey": 2000,
> "size": 42949672960,
> "id": "83182b0a-bc21-4ef8-8582-7ec95465380b",
> "fileName": "[DC1_LINUX_VM_STORAGE] 
> host2restore/host2restore.vmdk"
>   }
> ],
> "date": "2020-03-10T05:42:32.675Z",
> "cloudState": 0
>   }
>
>   tasks:
> - set_fact:
> disk_snap_id: "{{ json | from_json | 
> json_query('snapshotDiskDetails[?fileName.contains(@, 
> `host2restore_1.vmdk`)].virtualDiskId') }}"
> - debug: var=disk_snap_id
>
>
> Output:
>
> (ansible-2.9.6) dnmvisser@NUC8i5BEK playbooks$ ansible-playbook 
> json_vmware.yml 
> [WARNING]: No inventory was parsed, only implicit localhost is available
>
> PLAY [localhost] 
> *
>
> TASK [set_fact] 
> **
> ok: [localhost]
>
> TASK [debug] 
> *****
> ok: [localhost] => 
>   disk_snap_id:
>   - 23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2001
>
> PLAY RECAP 
> ***
> localhost  : ok=2changed=0unreachable=0   
>  failed=0skipped=0rescued=0ignored=0   
>
>
>
>
>
>
> On Tue, 10 Mar 2020 at 21:31, Nick Schendel  > wrote:
>
>> Trying to wrap my head about how to query json results from a URI call & 
>> could use some guidance.  I am guessing there are plenty in this group 
>> which this will be an easy question for.
>>
>> I am registering the json response from a URI call to our backup system 
>> to 'snapshotlist'
>>
>> Here is an example chunk of the json:
>>
>>   "json": {
>> "vmwareTagList": [],
>> "isC

[ansible-project] json_query/jmespath filtering question

2020-03-10 Thread Nick Schendel
Trying to wrap my head about how to query json results from a URI call & 
could use some guidance.  I am guessing there are plenty in this group 
which this will be an easy question for.

I am registering the json response from a URI call to our backup system to 
'snapshotlist'

Here is an example chunk of the json:

  "json": {
"vmwareTagList": [],
"isCorrupt": false,
"snapshotDiskDetails": [
{
"virtualDiskId": 
"23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2001",
"deviceKey": 2001,
"size": 214748364800,
"id": "83fecf84-26db-42db-9f33-ec7e10b5f736",
"fileName": 
"[DC1_LINUX_VM_STORAGE] host2restore/host2restore_1.vmdk"
},
{
"virtualDiskId": 
"23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2002",
"deviceKey": 2002,
"size": 214748364800,
"id": "1a9c094f-f19b-4ea7-1406-ab145b0ec2f1",
"fileName": 
"[DC1_LINUX_VM_STORAGE] host2restore/host2restore_2.vmdk"
},
{
"virtualDiskId": 
"23478e90-0228-4tab-ba99-d3894f94c8c837-vm-98-2000",
"deviceKey": 2000,
"size": 42949672960,
"id": "83182b0a-bc21-4ef8-8582-7ec95465380b",
"fileName": 
"[DC1_LINUX_VM_STORAGE] host2restore/host2restore.vmdk"
}
],
"date": "2020-03-10T05:42:32.675Z",
"cloudState": 0,

I am trying to get the value of "id" for the object with fileName that ends 
with host2retore_1.vmdk

This is what I currently have to try to pull that value out based on some 
example I found on a blog somewhere.  However I get errors.  Anyone able to 
help me figure out what I am doing wrong?

- name: set variable for disk_snap_id
set_fact:
  disk_snap_id: 
"{{ json_query('snapshotdetails.json.snapshotDiskDetails[?fileName.contains(@, 
'host2restore_1.vmdk')].virtualDiskId') }}"

-- 
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/518e3077-690f-42ea-905c-d6be12954161%40googlegroups.com.


[ansible-project] Re: Any updates on this, please help on my POST? https://groups.google.com/forum/#!topic/ansible-project/vVYN7qsRn7U

2020-01-23 Thread Nick Schendel
Creating a second post hours after your first simply pointing back at it 
might not be the best way to get help.  Just for future reference.  

On Thursday, January 23, 2020 at 1:45:06 PM UTC-6, Work-Hard wrote:
>
> Any updates on this, please help on my POST? 
> https://groups.google.com/forum/#!topic/ansible-project/vVYN7qsRn7U
>

-- 
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/dcbb0fb1-4b0d-4f62-9da7-3b3d6bc8c7cc%40googlegroups.com.


Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Nick Schendel
Based on that message it appears that a reboot is requried before you can 
install the patches.  The win_updates module is not going to reboot the 
host after changes if it doesnt make any changes.  Reboot the host 
manually, then try running again and I bet it goes.  Otherwise you could 
probably put in a separate task to reboot the host first, then patch and 
reboot after if needed.



On Thursday, January 23, 2020 at 2:00:01 PM UTC-6, Work-Hard wrote:
>
> I have tried multiple machines to download the updates but it's not 
> working. 
> *Playbook*
> *  tasks:*
> *   - name: Search and download Windows updates without installing them*
> * win_updates:*
> *  state: downloaded*
> *  win_reboot: true*
>
> *Throwing error - *
> fatal: [EC2AMAZ-5TQR7L8.corp.medqia.com]: FAILED! => {"changed": false, 
> "filtered_updates": {"ca3bb521-a8ea-4e26-a563-2ad6e3108b9a": {"categories": 
> ["Feature Packs", "Silverlight"], "filtered_reason": "category_names", 
> "id": "ca3bb521-a8ea-4e26-a563-2ad6e3108b9a", "installed": false, "kb": 
> ["4481252"], "title": "Microsoft Silverlight (KB4481252)"}}, 
> "found_update_count": 2, "installed_update_count": 0, "msg": "A reboot is 
> required before more updates can be installed", "reboot_required": true, 
> "updates": {"46de78a6-89c2-4adc-a827-d55e913ca853": {"categories": 
> ["Security Updates", "Windows Server 2016"], "id": 
> "46de78a6-89c2-4adc-a827-d55e913ca853", "installed": false, "kb": 
> ["4534271"], "title": "2020-01 Cumulative Update for Windows Server 2016 
> for x64-based Systems (KB4534271)"}, 
> "a4816cdf-d87e-4555-afa3-b839655fc564": {"categories": ["Update Rollups", 
> "Windows Server 2016"], "id": "a4816cdf-d87e-4555-afa3-b839655fc564", 
> "installed": false, "kb": ["890830"], "title": "Windows Malicious Software 
> Removal Tool x64 - January 2020 (KB890830)"}}}
>
> *I have already enabled the command to reboot. why it's not rebooting ? I 
> can't download or install anything through ansible.. kinda sucks*
>
>
>
>
>
> On Thursday, January 23, 2020 at 11:52:50 AM UTC-8, Dick Visser wrote:
>>
>> since it works for other hosts, the problem is related to that specific 
>> host, not ansible. 
>> There may be many reasons why it doesn't work.
>> Since ansible is just an automation tool, best to try an troubleshoot 
>> things manually on that host. 
>>
>>
>> On Thu, 23 Jan 2020 at 18:46, Work Email  wrote:
>>
>>> *KB number upgrades/ security patches are not installing?*
>>> *Playbook*
>>>   tasks:
>>>- name: Install all security, critical, and rollup updates without a 
>>> scheduled task
>>>  win_updates:
>>>category_names:
>>>- Upgrades
>>>- SecurityUpdates
>>>whitelist:
>>>- KB4494452
>>>- *KB2267602*
>>>- KB4494452
>>>state: installed
>>>register: update_result
>>>win_reboot: yes
>>>
>>> *For one of my server, it's still filtering out. I have provided 
>>> KB2267602. it's not installing why ?*
>>> ok: [EC2AMAZ-3FFNIJH.CORP.MEDQIA.COM] => {
>>> "changed": false,
>>> "filtered_updates": {
>>> "1b20f24b-2b80-43cb-8511-4677f3915843": {
>>> "categories": [
>>> "Definition Updates",
>>> "Windows Defender"
>>> ],
>>> "filtered_reason": "category_names",
>>> "id": "1b20f24b-2b80-43cb-8511-4677f3915843",
>>> "installed": false,
>>> "kb": [
>>> "2267602"
>>> ],
>>> "title": "Security Intelligence Update for Windows Defender 
>>> Antivirus - *KB2267602 *(Version 1.307.2889.0)"
>>> }
>>> },
>>> PLAY RECAP 
>>> ***
>>> EC2AMAZ-3FFNIJH.CORP.MEDQIA.COM : ok=2changed=0unreachable=0
>>> failed=0skipped=0rescued=0ignored=0
>>> MQN-CKMH5E31UM7.corp.medqia.com : ok=0changed=0unreachable=1
>>> failed=0skipped=0rescued=0ignored=0
>>> jimmy.corp.medqia.com  : ok=2changed=0unreachable=0
>>> failed=0skipped=0rescued=0ignored=0
>>> mqn-huddlermpc.corp.medqia.com : ok=2changed=0unreachable=0
>>> failed=0skipped=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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/adea7788-cccd-4baf-8f63-31a139c987ea%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> Sent from a mobile device - please excuse the brevity, spelling and 
>> punctuation.
>>
>

-- 
You received

[ansible-project] Re: Need help using URI module for a curl command with json body

2019-12-11 Thread Nick Schendel
Sorry for the delay, I meant to grab the example when I got back to my desk 
and lost track of it.
Here is an example I am using currently that works
  - name: restore disk from snapshot
uri:
url: https://{{ cluser_ip }}/api/internal/vmware/vm/snapshot/
{{snapshotlist.json.data[0].id}}/mount_disks
headers:
  Content-Type: "application/json"
  Authorization: "Bearer {{ authtoken.json.token  }}" 
# pass authentication token from earlier rather than basic auth
body: 
  targetVmId: '{{ target_vm_id }}' 
# VM to restore the disk snapshots to
  vmdkIds: ['
{{ snapshotdetails.json.snapshotDiskDetails[1].virtualDiskId }}'] 
# Rubrik wants an array of vmdk ID's to restore, without it will restore all in 
the snapshot 
body_format: json
method: POST 
status_code: 202 # Rubrik returns 202 on sucess.
return_content: yes 
validate_certs: yes 
tags: restore
delegate_to: localhost
become: no

On Wednesday, December 4, 2019 at 6:24:51 PM UTC-6, Robert Heppe wrote
>
> Thanks Nick,
>
> I have not.  I just tried this but get another error for the , at the end 
> of the line.  So I removed them and it errors again.
>
>  body:
>"id": "{{ customer_id }}"
>"name": "{{ customer_name }}"
>"disabledFeatures": 
> ["visualize","dev_tools","advancedSettings","indexPatterns","savedObjectsManagement","timelion","graph","monitoring","ml","apm","maps","canvas","infrastructure","logs","siem","uptime"]
>
> Could you post your entire uri block as an example and I could try to 
> modify mine to match the syntax?
>

-- 
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/0a725704-4d20-4cd3-baa9-dfbae22d40d8%40googlegroups.com.


Re: [ansible-project] Re: Need help using URI module for a curl command with json body

2019-12-06 Thread Nick Schendel
Sure, I will grab my entire example task in just a bit here.  Happy to
share if it might help.

On Thu, Dec 5, 2019, 12:23 PM Robert Heppe  wrote:

> Hi Bram,
> Yes, I just removed the IP for the post.  I think connectivity should be
> fine as I can telnet to the hostname from the ansible system.
>
> [centos@jumphost ~]$ telnet us1-ki01 5601
> Trying x.x.101.185...
> Connected to us1-ki01.
> Escape character is '^]'.
> ^]
>
>
> I wonder if I have the double headers entered correctly?
>
>headers:
>kbn-xsrf: "true"
>Content-Type: "application/json"
>
> Thanks,
> Robert
>
> --
> 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/ed97fba9-bab4-410e-9c26-87de06e6105e%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/CA%2BBXYZGtZeR5KuVRCsAMipbk51h_kYGVX4Nhm3G5f_-sU3FYBQ%40mail.gmail.com.


[ansible-project] Re: Need help using URI module for a curl command with json body

2019-12-04 Thread Nick Schendel
Have you tried the body section with the the curly braces?  Like so:
body: 
   "id": "{{ customer_id }}",
   "name": "{{ customer_name }}",
   "disabledFeatures": 
["visualize","dev_tools","advancedSettings","indexPatterns","savedObjectsManagement","timelion","graph","monitoring","ml","apm","maps","canvas","infrastructure","logs","siem","uptime"]

I have a playbook using URI module with a json body and mine works without 
those.

On Wednesday, December 4, 2019 at 4:41:41 PM UTC-6, Robert Heppe wrote:
>
> Hi all,
> I have a working curl command that I've been trying to get into an ansible 
> playbook in a testing environment.  I've found several posts on various 
> forums for similar situations, but not the one I'm working with, so my 
> attempts are still erroring.  I have the curl below, which when run on the 
> cli works correctly.
>
> curl -X POST -k -u : "https://x.x.x.x:5601/api/spaces/space"; -H 
> 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
> {
>   "id": "some_id",
>   "name": "some_name",
>   "disabledFeatures": 
> ["visualize","dev_tools","advancedSettings","indexPatterns","savedObjectsManagement","timelion","graph","monitoring","ml","apm","maps","canvas","infrastructure","logs","siem","uptime"]
> }
> '
>
> However, I have tried many variations of it in a playbook without 
> success.  Can anyone suggestions modifications to this playbook?
>
> ---
>  - hosts: "{{ region }}-ki01"
>become: true
>tasks:
>  - name: Create Kibana Space for client "{{ customer_name }}"
>uri:
>  url: "https://{{ region }}-ki01:5601/api/spaces/space"
>  user: 
>  password: 
>  validate_certs: no
>  method: POST
>  body: {
>"id": "{{ customer_id }}",
>"name": "{{ customer_name }}",
>"disabledFeatures": 
> ["visualize","dev_tools","advancedSettings","indexPatterns","savedObjectsManagement","timelion","graph","monitoring","ml","apm","maps","canvas","infrastructure","logs","siem","uptime"]
>   }
>  body_format: json
>  headers:
>kbn-xsrf: "true"
>Content-Type: "application/json"
>
> The output I'm getting right now is this:
>
> [centos@jumphost playbooks]$ ansible-playbook kibana_spaces_test.yml 
> --extra-vars "region=us1 customer_id=some_id customer_name=some_name"
>
> PLAY [us1-ki01] 
> **
>
> TASK [Gathering Facts] 
> ***
> ok: [us1-ki01]
>
> TASK [Create Kibana Space for client "some_name"] 
> 
> fatal: [us1-ki01]: FAILED! => {"changed": false, "content": "", "msg": 
> "Status code was not [200]: Request failed:  or service not known>", "redirected": false, "status": -1, "url": "
> https://us1-ki01:5601/api/spaces/space"}
>  [WARNING]: Could not create retry file 
> '/etc/ansible/roles/proficio-ansible/playbooks/kibana_spaces_test.retry'.  
>[Errno 13] Permission denied:
> u'/etc/ansible/roles/proficio-ansible/playbooks/kibana_spaces_test.retry'
>
>
> PLAY RECAP 
> ***
> us1-ki01   : ok=1changed=0unreachable=0failed=1
>
>
>
> Thanks,
> Robert
>

-- 
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/b5fca020-e38c-405a-8f39-77170cc19211%40googlegroups.com.


[ansible-project] Using Github hosted private repos with Tower

2019-10-17 Thread Nick Schendel
How are people using Tower with GitHub private repositories within a team?  

My company has a GitHub enterprise subscription hosted by GitHub in the 
cloud w/ SAML auth enforced.  I have setup a service account/machine 
account for our team for use with our Tower instance.  It is setup as an 
outside collaborator to the org due to the SAML requirements for in org 
accounts.  This works OK, however every time we create a new repository I 
have to individually invite that account to the repository on GitHub and 
then have to log into that account and approve the invite.  It gets 
extremely tedious to do this for each new repository I create & I would 
like to avoid having to explain this process to other members of the team.  
I am going to start looking into using the GitHub API to automate some of 
the permissions/approvals but I would prefer to not have to waste time on 
this as it would be better spent working on useful automation within our 
environment.

How are others solving this problem?

It seems that GitHub is not really designed to work this way, and is not an 
ideal tool for private repositories & internal tools.  Am I wrong in 
expecting there to be an easier way to handle 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/715060f3-a1e8-4c29-97bc-95608af2db60%40googlegroups.com.


[ansible-project] Ansible role README generator

2019-10-08 Thread Nick Kakouros
I think I have seen at some point a role that used a yaml array to specify 
the contents of the REAMDE. That's all I remember. In any case, are there 
tools to automatically generate a README for a role or based on a template 
of some sort? Has anyone used anything?

-- 
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/06c80163-0c85-4d9c-afb2-fa0521326184%40googlegroups.com.


[ansible-project] Re: Loading variables with data from REST

2019-09-24 Thread Nick Schendel
I am working on some playbooks right now using the URI module and doing 
what you describe. If you register the output of the task, you can call the 
response contents with output.json.keyname.  Where output is the name you 
used in the register. So as an example:

  - name: get some value via URI call
uri:
url: https://{{ server_hostname }}/api/somepath
register: uri_output

Now in later plays you can use uri_output.json.keyx, or uri_output.somekey 
for values returned in the response body itself.  Some of the stuff I am 
doing will return a json aray, and for those I am using 
uri_output.json.data[0].key to get at what I need.  Now I just need to 
figure out how to query the returned array to match a particular value.

I was also able to set a specific value to a variable with set_fact:

- name: set variable for target_vm_id
set_fact:
  target_vm_id: "{{ vminfo.json.data[0].id }}"


On Tuesday, September 24, 2019 at 1:25:45 PM UTC-5, Paul Hoffman wrote:
>
> I'd like to leverage systems with an API to provide variables to playbooks 
> running on the controller.
> Something similar to a dynamic inventory script loading from an external 
> system.
>
> For example with a curl command and can get the exact contents I need.  
> IE: {"myVariable":"myValue"}  or yaml format:
> myVariable: myValue
>
> I've looked at the uri module and it looks promising.  The values returned 
> by the GET call are embedded in the 
> returned contents along with many other API variables.
>
> The idea being when I need a value that changes frequently or shouldn't be 
> included in static playbooks I call the 
> external system that has the master value and load it.
> I'd prefer not pulling the data into a variable file first.  That would 
> avoid file management issues.
>
> I'm not too familiar with jinja2 but perhaps there's a way to take the 
> output from URI and parse out the values.
> I'm sure there is a way to do this that I haven't come across yet.
>
> If anyone has already solved this point me in the right direction.
> v/r
>
>

-- 
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/e59bab51-b707-40fe-8df4-2efc7ef946d5%40googlegroups.com.


[ansible-project] Can I run plays in parallel?

2019-08-27 Thread Nick Kakouros
I have 10 files with a play each. In total these plays provision 4 hosts. I 
have written a function in bash that takes as an argument the host I want 
to provision and calls ansible with all 10 playbooks and a `-l`(limit) 
parameter for only the host I provided. I can pass multiple hosts too.

So, when I pass 3 hosts, ansible starts running and it goes through each 
play one by one. This means that a host may have to unnecessarily wait for 
previous plays to finish before it is the turn of one of its play. 

Is there a way to say to ansible to run all plays in parallel? I could find 
workaround in bash, but I would like to know if this is possible in 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/46931a49-feab-42db-8ed4-eaad4464b221%40googlegroups.com.


Re: [ansible-project] How to write selected values to a file from a list of JSON arrays?

2018-11-24 Thread Nick Ellson
WOW!

That worked SLICK! And thank you for the much better example, that is very 
readable but I had a hell of a time finding anything like that on google. 

OK, so you mentions jinja... I have heard this term and I hear it is 
something I need to learn as well... what might this look like using jinja, 
if you have time? (I have a working file now, thank you very much!)


On Saturday, November 24, 2018 at 11:18:21 AM UTC-8, Kai Stian Olstad wrote:
>
> On Saturday, 24 November 2018 20:10:19 CET Nick Ellson wrote: 
> > 
> > I have a task that I am scratching my head on, and my google foo is just 
> > getting some really basic examples of the COPY - CONTENT method of 
> writing 
> > a file. 
> > 
> > my variable returned from the URI module is data, which is a 4 variable 
> > JSON array. data.json.devices is the list I want to dump to a file to 
> use 
> > as my future hosts file for cli config operations. 
> > 
> > ok: [localhost] => { 
> > "msg": [ 
> > { 
> > "hostname": "host1", 
> > "id": "0093253e", 
> > "mgmtIP": "10.10.10.1" 
> > }, 
> > { 
> > "hostname": "host2", 
> > "id": "00e75962", 
> > "mgmtIP": "10.10.10.8" 
> > }, 
> >  
> > 
> > I'd like to spit this to a ./inventory/hosts file in a format that my 
> > playbook can then use in the next set of tasks. So just the "hostname" 
> and 
> > "mgmtIP" variables written to a line. 
> > 
> > How might that look? 
>
> You can use the template or the copy module, the jinja template code is 
> the same in both so i just show the copy module 
>
> - name: Create inventory 
>   copy: 
> content: | 
>   {% for i in data.json.devices %} 
>   {{ i.hostname }} ansible_host={{ i.mgmtIP }} 
>   {% endfor %} 
> dest: inventory/hosts 
>
> -- 
> Kai Stian Olstad 
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9e50454a-07db-4904-9684-54a1b6e791f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to write selected values to a file from a list of JSON arrays?

2018-11-24 Thread Nick Ellson


I have a task that I am scratching my head on, and my google foo is just 
getting some really basic examples of the COPY - CONTENT method of writing 
a file.

my variable returned from the URI module is data, which is a 4 variable 
JSON array. data.json.devices is the list I want to dump to a file to use 
as my future hosts file for cli config operations.

ok: [localhost] => {
"msg": [
{
"hostname": "host1", 
"id": "0093253e", 
"mgmtIP": "10.10.10.1"
}, 
{
"hostname": "host2", 
"id": "00e75962", 
"mgmtIP": "10.10.10.8"
}, 


I'd like to spit this to a ./inventory/hosts file in a format that my 
playbook can then use in the next set of tasks. So just the "hostname" and 
"mgmtIP" variables written to a line.

How might that look?

Nick



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/533b0316-afbd-461e-a0d9-0c20416252c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to access a play's vars section?

2018-11-10 Thread Nick Kakouros
I forgot to mention that `import_tasks` or `include_tasks` also results in 
the undefined alias error.

On Saturday, November 10, 2018 at 2:50:05 PM UTC+1, Nick Kakouros wrote:
>
> Thanks. In that case, could I add a task to a play programmatically? I 
> have around 20 plays and I try to have the vars section of each play to be 
> saved locally to a yaml file. Right now, at the end of each play, I use a 
> 'copy' tasks that reads the vars via a yaml alias. I would like to not 
> repeat myself. I tried to place this task in a different play that is run 
> after each one of the above plays , but ansible complains about an 
> undefined alias. Do you see any way to not have to repeat the task in every 
> play?
>
> On Saturday, November 10, 2018 at 2:01:09 AM UTC+1, Brian Coca wrote:
>>
>> You cannot, play vars are only in scope for that play. The only vars 
>> in a playbook you can reference across all plays are host vars. 
>>
>>
>>
>>
>> -- 
>> -- 
>> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a8d59546-2845-4844-b718-fd277d9b5fb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to access a play's vars section?

2018-11-10 Thread Nick Kakouros
Thanks. In that case, could I add a task to a play programmatically? I have 
around 20 plays and I try to have the vars section of each play to be saved 
locally to a yaml file. Right now, at the end of each play, I use a 'copy' 
tasks that reads the vars via a yaml alias. I would like to not repeat 
myself. I tried to place this task in a different play that is run after 
each one of the above plays , but ansible complains about an undefined 
alias. Do you see any way to not have to repeat the task in every play?

On Saturday, November 10, 2018 at 2:01:09 AM UTC+1, Brian Coca wrote:
>
> You cannot, play vars are only in scope for that play. The only vars 
> in a playbook you can reference across all plays are host vars. 
>
>
>
>
> -- 
> -- 
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd9f3f47-13cb-4bbd-b0cc-8f8d8f1f7f0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is there a way to access a play's vars section?

2018-11-09 Thread Nick Kakouros
Given a play, I would like to reference somehow its vars section. I would 
like to achieve any of the two:

- The next play to have access to the vars of the previous play like "{{ 
prev_play_vars }}"
- The vars section of each play to be available to the rest of the plays 
via sth like "{{play_name_here_vars}}"

I tried messing around with a custom callback plugin but that didn't get me 
anywhere. 

How could I achieve sth like that?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/19565c3b-3cd2-4d5a-8969-e4421c0ba599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Modify various groups if present

2018-05-16 Thread Nick Rogers
You may not need to use the getent module at all - the group module already 
uses groupmod if the group already exists.

If you want to use getent, then it looks like you are missing '_' 
characters in the "when" conditions. They should be 
when: getent_passwd ...
and
when: getent_group ...
respectively. And there's a typo in your last call to the group module, 
"git" should be "gid".

You could move the items list into host_vars and then iterate just the 
groups the host needs, you can have the items list in group_vars that need 
the groups on the systems, there are lots of ways to partition that up.

On Wednesday, May 16, 2018 at 12:38:17 PM UTC-5, John Harmon wrote:
>
> How would you approach modifying the gid of a group on a server only if it 
> exists?  I know I can do this for 3 groups within 3 separate tasks (as an 
> example), but I was hoping to combine them into a single task (see last 
> task below.).  The problem with my current setup is that it may create 
> an unnecessary group (ie.  server1 needs gomer, server2 needs pyle.  As I 
> search for a group gomer, or pyle, then both servers would get both groups, 
> which isn't desirable).  Do I have to break this out in multiple tasks? or 
> is there another way?  I haven't tested the following yet.
>
> - name: Gather User Information
>   getent:
> database: passwd
>
> - name: Gather Group Information
>   getent:
> database: group
>
> - name: Create common group when gomer or pyle user present
>   group:
> name: army
> gid: 2003
> state: present
>   when: getent passwd | lower | search("gomer|pyle)"
>
> - name: Modify Group GIDs if Group is Present
>   group:
> name: "{{ item.name }}"
> git: "{{ item.gid }}"
>   with_items:
> - {name: "gomer", gid: "2000"}
> - {name: "pyle", gid: "2001"}
>   when: getent group | lower | search("gomer|pyle)"
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4338c5d7-9162-4ab4-abb5-3c98840d2d28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: azure_rm_virtualmachine: error to import AzureRMModuleBase

2018-05-16 Thread Nick Rogers
Have you tried running

pip install packaging

On Wednesday, May 16, 2018 at 8:43:06 AM UTC-5, Irfan Sayed wrote:
>
> please suggest. I m stuck 
>
> On Wednesday, May 16, 2018 at 10:05:08 AM UTC+2, Irfan Sayed wrote:
>>
>> Hello,
>>
>> I am trying to create the azure VM using ansible module : 
>> azure_rm_virtualmachine
>> document referred : 
>> *https://docs.ansible.com/ansible/2.4/azure_rm_virtualmachine_module.html* 
>> 
>>
>>
>> *Actual error*
>>
>> TASK [azure_vm_create : Create azure vm] 
>> 
>> fatal: [worker1]: FAILED! => {"changed": false, "module_stderr": "Shared 
>> connection to worker1 closed.\r\n", "module_stdout": "Traceback (most 
>> recent call last):\r\n File 
>> "/tmp/ansible_3PPl_f/ansible_module_azure_rm_virtualmachine.py", line 556, 
>> in \r\n from ansible.module_utils.azure_rm_common import AzureRMModuleBase, 
>> azure_id_to_dict\r\n File 
>> "/tmp/ansible_3PPl_f/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py",
>>  
>> line 28, in \r\nImportError: No module named packaging.version\r\n", "msg": 
>> "MODULE FAILURE", "rc": 0}
>>
>> *Environment :*
>> Ansible version : ansible 2.4.2.0
>> python version = 2.7.5
>> Ansible controller machine : centos 7
>> ansible managed node : centos 7
>>
>>
>> *azure packages :*
>> python2-msrestazure-0.4.21-1.el7.noarch
>> azure-repo-svc-1.0-0.el7.centos.noarch
>> python2-azure-sdk-2.0.0-2.el7.noarch
>>
>>
>> *expected behavior :*
>> provision the VM without any issue
>>
>>
>> I am not getting what is the issue. my other playbooks are just working 
>> fine. do I need to install any other dependency OR module ??
>>
>>
>> please suggest.
>>
>>  
>>
>> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c0fdb87f-6885-45d9-93e9-f02d83e722d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] playbooks and tasks

2018-05-15 Thread Nick Rogers
Brian states things the way we define them.

I broke things up that way for a few reasons:
- Development process: Our dev team works in a similar fashion with their 
code base, and objectifying the infrastructure Ansible is controlling in a 
similar way lets the dev team use my Ansible work on their environment copy 
and they can change installation requirements for test/prod as needed in 
one role, for example. Wrap all that up in the sprint/peer review/merge 
process, and it's pretty slick. They get to learn how things should be 
properly deployed, I get to learn coding best practices. Win-win.
- Isolation: Once I have a role narrowed down specifically enough, I rarely 
look at the task(s) again. This keeps me from modifying an existing role 
for a new environment that adversely affect other environments. I heavily 
use inventory grouping mapped with playbooks to keep track of what tasks to 
run where (some of that falls down from the development process, a similar 
concept to branching).
- Future-proofing: Putting a single module in a role's individual files 
allows me to look at the Ansible changelog and quickly refactor affected 
tasks during our Ansible upgrades. The con here is that I have a lot of 
playbooks that are just 20 lines of 'import_playbook' and 'include_role: 
tasks_from' - which isn't necessarily intuitive from a playbook maintenance 
perspective. But the above pros of development and isolation win over that 
con (for us).

Whether the way I've demonstrated in my GitHub is the right way is not 
certain, but it makes sense in my head. Ansible appears to be quite 
flexible, and there's a lot about Ansible I don't fully grok yet, so if 
there are better ways to do things, I'm open (PR's are open on that 
project).

On Tuesday, May 15, 2018 at 2:25:00 PM UTC-5, Brian Coca wrote:
>
> playbook => contains plays 
>
> play => maps hosts to tasks 
>
> roles => reusable content, can be vars, templates, files, tasks, etc 
>
> task => action to perform on a host 
>
>
> playbook does get overloaded as it is both an object and a file that 
> contains plays, but files that contain just tasks (task lists) are 
> many times also called playbooks, but they really are not. 
>
>
>
> -- 
> -- 
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e7b34d72-b001-4cbc-a3c5-8e8e0ac9678f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Question on 'networks' parameter for VMWare cloud module

2018-05-15 Thread Nick Rogers
Ansible creates a sysprep/linuxprep script:
https://github.com/ansible/ansible/blob/3a6f0fbb9c698b9440f1c21c973822d1b8883124/lib/ansible/modules/cloud/vmware/vmware_guest.py#L1239

I have a lab with only static IPs and the networks parameter(s) work fine 
for me when creating new/cloning.


On Friday, April 20, 2018 at 9:58:29 AM UTC-5, EspressoBeanies wrote:
>
> I have a question about the 'networks' parameter for the VMWare cloud 
> module. How do the options in this particular parameter get passed to the 
> operating system during the initial deployment or setup process? With the 
> virtual machine NIC settings for any ESXi instance, there is no place to 
> define the IP address, netmask, gateway, etc... and with Linux operating 
> systems, I can only get around this via Kickstart. Could someone clarify 
> how this mechanism works when setting up new VMWare vm's using 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1bccfea4-081d-4864-bb3d-5d08410d6909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: VMware - convert template to virtual machines

2018-05-15 Thread Nick Rogers
It looks to me like "num_cpus" is number of sockets, and 
"num_cpu_cores_per_socket" 
can set the cores per socket.

Is that what you're asking? or am I way off the mark... If you don't 
specify "num_cpu_cores_per_socket", it defaults to 1, if I'm reading the 
pyvmomi source correctly: 
https://github.com/vmware/pyvmomi/blob/575ab56eb56f32f53c98f40b9b496c6219c161da/docs/vim/vm/VirtualHardware.rst


On Thursday, May 3, 2018 at 9:46:56 AM UTC-5, talha jilal wrote:
>
> Hello Folks, 
>
> with ansible 2.5 we can control cpu cores  but not cpu virutal number of 
> sockets. Any idea ? 
>
> Thanks 
>
>
>
> On Friday, 27 April 2018 09:55:55 UTC-4, Ted wrote:
>>
>> Hi All,
>>
>> I'm looking for a way to convert a VMware template to a virtual machine 
>> using Ansible.
>> The work flow is:
>> Convert a template to a virtual machine
>> Power on
>> Login to the virtual machine
>> Update the OS patches (Linux)
>> Power off
>> Convert Virtual machine back to template
>>
>> As you can see I want to keep the patch levels up to date on my templates 
>> and do all the above in Ansible.
>> I've searched for ways to do this but haven't come up with anything.
>>
>> Any suggestions are most welcome.
>>
>> Thanks,
>>
>> Ted
>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2566c91c-d0a8-4bf1-8826-e2c88b3bef91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Unable to use 'yum install'

2018-05-10 Thread Nick Rogers
I would try to `curl 
https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml'
 
from the error on worker1/2 and see if it reports anything more helpful 
than what you're getting back. Feels like a networking problem to me.

On Thursday, May 10, 2018 at 11:25:36 AM UTC-5, Fabio Gomes Sakiyama wrote:
>
> Hi,
>
> I'm trying to install kubelet with *Ansible*, but I'm struggling to do it.
>
>
> This is my *playbook*:
>
>
> ---
>   - hosts: all
> become: yes
> tasks:
>   - name: install docker
> yum:
>   name: docker
>   state: present
>   update_cache: true
>
>   - name: add repo
> yum_repository:
>   name: kuberepo
>   description: kubernetes-repo
>   baseurl: 
> "https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64";
>   enabled: yes
>   gpgcheck: yes
>   repo_gpgcheck: yes
>   gpgkey:
> - "https://packages.cloud.google.com/yum/doc/yum-key.gpg";
> - "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg";
>
>   - name: setenforce
> shell: setenforce 0
>
>   - name: install kubelet
> yum:
>   name: kubelet
>   state: present
>   update_cache: true
>
>
> This is the *error* when i run the playbook (ansible-playbook -i hosts 
> kube-dependencies.yml) 
>
>
> 
>
>
> The "ok" from [master] node is because I manually executed "sudo yum 
> install kubelet" on that machine, and it worked.
>
>
> *Conclusions:* So basically, manually executing the yum install command 
> it works, but I can't make it work with ansible.
>
>
> Any clues? What am I doing wrong?
>
>
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f103b5af-17d9-49ee-919d-b6d9495e7043%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Get basic vmware module working - vmware_guest_find

2018-05-10 Thread Nick Rogers
The play is running properly, but I'm not sure what your intent is for the 
output. Try running it with -vvv, or if you register a variable like 
- name: "Find Guest's Folder using name"
  vmware_guest_find:
   hostname: "{{ vmware_esxi.hostname }}"
   validate_certs: "{{ vmware_esxi.validate_certs }}"
   username: "{{ vmware_esxi.username }}"
   password: "{{ vmware_esxi.password }}"
   datacenter: "{{ vmware_esxi.datacenter }}"
   name: "{{ item }}"
  delegate_to: localhost
  register: vm_folder
  tags: findvm
  with_items:
   - "{{ vm_hostname }}"

- name: debug vm_folder
  debug:
var: vm_folder


You will then see what it's doing and can move on from there.

On Thursday, May 10, 2018 at 4:06:32 AM UTC-5, Ted wrote:
>
> Hi Nick,
>
> Thanks for the response. I'm actually basing my tasks on your github repo 
> you shared!
> So I've tried what you suggested but its not returning any data.
>
> Updated task:
>
> - name: Find Guest's Folder using name
>   vmware_guest_find:
>hostname: "{{ vmware_esxi.hostname }}"
>validate_certs: "{{ vmware_esxi.validate_certs }}"
>username: "{{ vmware_esxi.username }}"
>password: "{{ vmware_esxi.password }}"
>datacenter: "{{ vmware_esxi.datacenter }}"
>name: "{{ item }}"
>   delegate_to: localhost
>   tags: findvm
>   with_items:
>- "{{ vm_hostname }}"
>
> Playbook run:
>
> # ansible-playbook -i hosts vmware-template.yml --tags findvm  
> PLAY [vms] 
> *
> TASK [vmware-template : Find Guest's Folder using name] 
> 
> ok: [testvm01 -> localhost]
> PLAY RECAP 
> *
> testvm01 : ok=1changed=0unreachable=0failed=0   
>
> The VM is definitely in a folder.
> I can see the session opening in the VMware client so I'm assuming that 
> its connecting and versions of the various software components are 
> compatible.
> Must be missing something simple
>
> Regards,
>
>
> Ted
>
>
> On Wednesday, May 9, 2018 at 7:54:56 PM UTC+1, Nick Rogers wrote:
>
>> It looks like your problem is using the "vm_hostname" in the task.
>>
>> In my experiments, I either use "{{ inventory_hostname }}" for a per 
>> vm/host/target definition in the hosts group or a "with_items" loop:
>>
>> - name: Find Guest's Folder using name
>>   vmware_guest_find:
>>hostname: "{{ vmware_esxi.hostname }}"
>>validate_certs: "{{ vmware_esxi.validate_certs }}"
>>username: "{{ vmware_esxi.username }}"
>>password: "{{ vmware_esxi.password }}"
>>datacenter: "{{ vmware_esxi.datacenter }}"
>>name: "{{ item }}"
>>   delegate_to: localhost
>>   tags: findvm
>>   with_items:
>> - "{{ vm_hostname }}"
>>
>>
>>
>> On Wednesday, May 9, 2018 at 9:52:01 AM UTC-5, Ted wrote:
>>>
>>> Hi,
>>>
>>> I'm having issues with getting basic VMware modules working. For example 
>>> vmware_guest_find. I'm running the below from a RHEL 7 server.
>>>
>>> Versions installed:
>>> pyvmomi 6.7.0
>>> ansible 2.5.2
>>> vSphere vCenter 6.0
>>>
>>>
>>>
>>> playbook:
>>> ---
>>> - hosts: vms
>>>
>>>   roles:
>>>  - vmware-template
>>>
>>> Role task:
>>> ---
>>> # tasks file for vmware-template
>>>
>>> - name: Find Guest's Folder using name
>>>   vmware_guest_find:
>>>hostname: "{{ vmware_esxi.hostname }}"
>>>validate_certs: "{{ vmware_esxi.validate_certs }}"
>>>username: "{{ vmware_esxi.username }}"
>>>password: "{{ vmware_esxi.password }}"
>>>datacenter: "{{ vmware_esxi.datacenter }}"
>>>name: "{{ vm_hostname }}"
>>>   delegate_to: localhost
>>>   tags: findvm
>>>
>>> Role vars:(sensitive info hashed out)
>>>
>>&g

[ansible-project] Re: Get basic vmware module working - vmware_guest_find

2018-05-09 Thread Nick Rogers
It looks like your problem is using the "vm_hostname" in the task.

In my experiments, I either use "{{ inventory_hostname }}" for a per 
vm/host/target definition in the hosts group or a "with_items" loop:

- name: Find Guest's Folder using name
  vmware_guest_find:
   hostname: "{{ vmware_esxi.hostname }}"
   validate_certs: "{{ vmware_esxi.validate_certs }}"
   username: "{{ vmware_esxi.username }}"
   password: "{{ vmware_esxi.password }}"
   datacenter: "{{ vmware_esxi.datacenter }}"
   name: "{{ item }}"
  delegate_to: localhost
  tags: findvm
  with_items:
- "{{ vm_hostname }}"



On Wednesday, May 9, 2018 at 9:52:01 AM UTC-5, Ted wrote:
>
> Hi,
>
> I'm having issues with getting basic VMware modules working. For example 
> vmware_guest_find. I'm running the below from a RHEL 7 server.
>
> Versions installed:
> pyvmomi 6.7.0
> ansible 2.5.2
> vSphere vCenter 6.0
>
>
>
> playbook:
> ---
> - hosts: vms
>
>   roles:
>  - vmware-template
>
> Role task:
> ---
> # tasks file for vmware-template
>
> - name: Find Guest's Folder using name
>   vmware_guest_find:
>hostname: "{{ vmware_esxi.hostname }}"
>validate_certs: "{{ vmware_esxi.validate_certs }}"
>username: "{{ vmware_esxi.username }}"
>password: "{{ vmware_esxi.password }}"
>datacenter: "{{ vmware_esxi.datacenter }}"
>name: "{{ vm_hostname }}"
>   delegate_to: localhost
>   tags: findvm
>
> Role vars:(sensitive info hashed out)
>
> ---
> # vars file for vmware-template
> vmware_esxi:
>   hostname: ###
>   validate_certs: no
>   username: ###
>   password: 
>   datacenter: ###
>  
> vm_hostname:
>- testvm01
>
> Hosts file:
> [local]
> localhost
>
> [vms]
> testvm01
>
>
>
> Playbook run: (sensitive info hashed out)
>
> # ansible-playbook -i hosts vmware-template.yml --tags findvm -
> ansible-playbook 2.5.2
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u'/root/.ansible/plugins/modules', u
> '/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/site-packages/
> ansible
>   executable location = /bin/ansible-playbook
>   python version = 2.7.5 (default, May  3 2017, 07:55:04) [GCC 4.8.5 
> 20150623 (Red Hat 4.8.5-14)]
> Using /etc/ansible/ansible.cfg as config file
> setting up inventory plugins
> Set default localhost to localhost
> Parsed /etc/ansible/plays/hosts inventory source with ini plugin
> Trying secret FileVaultSecret(filename='') for vault_id=default
> Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2
> .7/site-packages/ansible/plugins/callback/default.pyc
> PLAYBOOK: vmware-template.yml 
> **
> 1 plays in vmware-template.yml
> PLAY [vms] 
> *
> META: ran handlers
> TASK [vmware-template : Find Guest's Folder using name] 
> 
> task path: /etc/ansible/roles/vmware-template/tasks/main.yml:52
> Using module file 
> /usr/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest_find.py
>  ESTABLISH LOCAL CONNECTION FOR USER: root
>  EXEC /bin/sh -c 'echo ~ && sleep 0'
>  EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
> /root/.ansible/tmp/ansible-tmp-1525877042.27-257095638403837 `" && echo 
> ansible-tmp-1525877042.27-257095638403837="` echo 
> /root/.ansible/tmp/ansible-tmp-1525877042.27-257095638403837 `" ) && 
> sleep 0'
>  PUT /root/.ansible/tmp/ansible-local-24670bWH_Sz/tmptyQ4GF TO 
> /root/.ansible/tmp/ansible-tmp-1525877042.27-257095638403837/vmware_guest_find.py
>  EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-
> 1525877042.27-257095638403837/ /root/.ansible/tmp/ansible-tmp-
> 1525877042.27-257095638403837/vmware_guest_find.py && sleep 0'
>  EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-
> tmp-1525877042.27-257095638403837/vmware_guest_find.py && sleep 0'
>  EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-
> 1525877042.27-257095638403837/ > /dev/null 2>&1 && sleep 0'
> fatal: [testvm01 -> localhost]: FAILED! => {
> "changed": false, 
> "invocation": {
> "module_args": {
> "datacenter": "###", 
> "hostname": "###", 
> "name": "['##']", 
> "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
> "port": ###, 
> "username": "#", 
> "uuid": null, 
> "validate_certs": false
> }
> }, 
> "msg": "Unable to find folders for virtual machine ['testvm01']"
> }
> to retry, use: --limit @/etc/ansible/plays/vmware-template.retry
> PL

Re: [ansible-project] Re: VMware - convert template to virtual machines

2018-04-30 Thread Nick Rogers
Ok, here you go, it's still in progress, but it's up.

https://github.com/nickrnet/ansible-vmware

On Saturday, April 28, 2018 at 5:32:41 AM UTC-5, Ted wrote:
>
> Hi Nick,
>
> Thanks for the reply. If you could put it up on Github that would be 
> brilliant. 
>
> Thanks again,
>
> Ted 
>
> On Fri 27 Apr 2018 at 23:00, Nick Rogers > 
> wrote:
>
>> I do all of this with playbooks and the Ansible vmware_guest module with 
>> Ansible 2.4.4 against vCenter currently - though I am not sure the status 
>> of the vmware_guest module goingb forward (there are Github issues in 2.5 
>> that discuss removing/depracating it).
>>
>> I have the following structure:
>> project
>> - inventory
>> ... other inventory dirs ...
>> - vms
>> - group_vars
>> all.yml
>> - host_vars
>> rhel75x64-base.yml
>> rhel75x64-updated.yml
>> hosts
>> - playbooks
>> ... other playbook dirs ...
>> - vcenter
>> create_snapshots.yml
>> revert_snapshots.yml
>> update_template.yml
>> - roles
>> ... other role dirs ...
>> - vcenter
>> - tasks
>> create_snapshot.yml
>> create_template.yml
>> create_vm.yml
>> delete_vm.yml
>> refresh_vm.yml
>> revert_snapshot.yml
>> shutdown_vm.yml
>> start_vm.yml
>> - vars
>> main.yml
>>
>> We have the following set up on a schedule:
>> playbooks/vcenter/update_template.yml gets run weekly and creates a vm in 
>> our vcenter, updates it from our yum repo, and turns it into a template
>> playbooks/vcenter/create_snapshots.yml gets run weekly (1 hour later than 
>> update_template) that destroys a vcenter inventory, creates a new set in 
>> vcenter, and creates snapshots so they are ready for CI builds
>>
>> If you'd like more info, I can thow it in a Github for you to peruse, but 
>> will be a day or so.
>>
>>
>> On Friday, April 27, 2018 at 8:55:55 AM UTC-5, Ted wrote:
>>>
>>> Hi All,
>>>
>>> I'm looking for a way to convert a VMware template to a virtual machine 
>>> using Ansible.
>>> The work flow is:
>>> Convert a template to a virtual machine
>>> Power on
>>> Login to the virtual machine
>>> Update the OS patches (Linux)
>>> Power off
>>> Convert Virtual machine back to template
>>>
>>> As you can see I want to keep the patch levels up to date on my 
>>> templates and do all the above in Ansible.
>>> I've searched for ways to do this but haven't come up with anything.
>>>
>>> Any suggestions are most welcome.
>>>
>>> Thanks,
>>>
>>> Ted
>>>
>>> -- 
>> 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 post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/0b1d35ea-aaf9-4cb6-926e-390ee6dfb952%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/0b1d35ea-aaf9-4cb6-926e-390ee6dfb952%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1dc3552f-e133-4e6c-a244-9a75fb56f3c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: VMware - convert template to virtual machines

2018-04-27 Thread Nick Rogers
I do all of this with playbooks and the Ansible vmware_guest module with 
Ansible 2.4.4 against vCenter currently - though I am not sure the status 
of the vmware_guest module going forward (there are Github issues in 2.5 
that discuss removing/depracating it).

I have the following structure:
project
- inventory
... other inventory dirs ...
- vms
- group_vars
all.yml
- host_vars
rhel75x64-base.yml
rhel75x64-updated.yml
hosts
- playbooks
... other playbook dirs ...
- vcenter
create_snapshots.yml
revert_snapshots.yml
update_template.yml
- roles
... other role dirs ...
- vcenter
- tasks
create_snapshot.yml
create_template.yml
create_vm.yml
delete_vm.yml
refresh_vm.yml
revert_snapshot.yml
shutdown_vm.yml
start_vm.yml
- vars
main.yml

We have the following set up on a schedule:
playbooks/vcenter/update_template.yml gets run weekly and creates a vm in 
our vcenter, updates it from our yum repo, and turns it into a template
playbooks/vcenter/create_snapshots.yml gets run weekly (1 hour later than 
update_template) that destroys a vcenter inventory, creates a new set in 
vcenter, and creates snapshots so they are ready for CI builds

If you'd like more info, I can thow it in a Github for you to peruse, but 
will be a day or so.

On Friday, April 27, 2018 at 8:55:55 AM UTC-5, Ted wrote:
>
> Hi All,
>
> I'm looking for a way to convert a VMware template to a virtual machine 
> using Ansible.
> The work flow is:
> Convert a template to a virtual machine
> Power on
> Login to the virtual machine
> Update the OS patches (Linux)
> Power off
> Convert Virtual machine back to template
>
> As you can see I want to keep the patch levels up to date on my templates 
> and do all the above in Ansible.
> I've searched for ways to do this but haven't come up with anything.
>
> Any suggestions are most welcome.
>
> Thanks,
>
> Ted
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0b1d35ea-aaf9-4cb6-926e-390ee6dfb952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ( vmware-guest module) Creating VM from template and adding "No of cores per socket"

2018-03-22 Thread Nick Rogers
Well, I'll be honest, I don't have a place to run 2.5 currently, so someone 
else may have to chime in. I saw that config in the source on GitHub.

I also create many VMs from templates currently with 2.4, from a base 
template configured with 1 CPU that is deployed to targets with multiple 
CPUs, vastly different network and disk, etc., and they show up fine, 
though I'm not adjusting cores per cpu. 

Including the output from '-vvv' may be helpful to others that might be 
reading.

If you want more sockets, you want to set num_cpus higher. If you want 
cores per cpu but aren't getting them in the machine, but you should make 
sure that you're running an appropriate version of vCenter and that indeed 
they are missing in the machine's settings in vCenter. Could be an issue 
needs to be opened.

On Thursday, March 22, 2018 at 4:02:08 PM UTC-5, talha jilal wrote:
>
>
> Yes I also tried this option but it does not impact my number of sockets. 
> Thank you for your reply , 
>
> Appreciate your response.
>
> ( Note I am creating vms from templates ) . 
>
> Any suggestion ? 
>
> Output from ( 
>
> hardware:
>   memory_mb: "{{ ram_size }}"
>   num_cpus: "{{ cpu_nums }}"
>   num_cpu_cores_per_socket: 2
>
>
> = Output --
>
>
>
> ok: [kuber-n-03] => {
> "deploy": {
> "changed": true,
> "failed": false,
> "instance": {
> "annotation": "",
> "current_snapshot": null,
> "customvalues": {},
> "guest_tools_status": "guestToolsNotRunning",
> "guest_tools_version": "2147483647",
> "hw_eth0": {
> "addresstype": "assigned",
> "ipaddresses": null,
> "label": "Network adapter 1",
> "macaddress": "00:50:56:b7:a8:a8",
> "macaddress_dash": "00-50-56-b7-a8-a8",
> "summary": "VM Network"
> },
> "hw_guest_full_name": null,
> "hw_guest_id": null,
> "hw_interfaces": [
> "eth0"
> ],
> "hw_memtotal_mb": 2048,
> "hw_name": "kuber-n-03",
> "hw_power_status": "poweredOn",
> "hw_processor_count": 2,
> "hw_product_uuid": "42371497-b8e6-5c9d-8859-6d73af6b9f78",
> "ipv4": null,
> "ipv6": null,
> "module_hw": true,
> "snapshots": []
> }
> }
> }
>
>  End of output =
>
>
>
>
>
>
>
> On Thursday, 22 March 2018 16:55:01 UTC-4, Nick Rogers wrote:
>>
>> Looks like in 2.5 you specify 'num_cpu_cores_per_socket' in the 
>> vmware_guest 'hardware' dictionary.
>>
>> - name: Create VM
>>   vmware_guest:
>> hostname: somevmwareesxhost
>> ... other vmware_guest config ...
>> hardware:
>>   num_cpus: 4
>>   num_cpu_cores_per_socket: 8
>>   ... other hardware config ...
>> ... other vmware_guest config ...
>>
>>
>>
>>
>> On Thursday, March 22, 2018 at 3:05:47 PM UTC-5, talha jilal wrote:
>>>
>>> Hello, 
>>>
>>> I am deploying vms with vmware_guest module, and I need to edit "number 
>>> of cores per socket" what statement should I use ?
>>>
>>> I tried the following statement but it always give me error. 
>>>
>>> customvalues:
>>>   - key: cpuid.coresPerSocket
>>> value: 2
>>>
>>> Error : 
>>>
>>>
>>>
>>>
>>> fatal: [kuber-n-03 -> localhost]: FAILED! => {"changed": false, "msg": 
>>> "Failed t  
>>>o set custom value for 
>>> key='numvcpus' and value='two'. Error was: (vmodl.fault.I  
>>> 
>>>nvalidArgument) {\n   dynamicType = ,\n  
>>>  dynamicProperty = (vmodl.Dynami

[ansible-project] Re: ( vmware-guest module) Creating VM from template and adding "No of cores per socket"

2018-03-22 Thread Nick Rogers
Looks like in 2.5 you specify 'num_cpu_cores_per_socket' in the 
vmware_guest 'hardware' dictionary.

- name: Create VM
  vmware_guest:
hostname: somevmwareesxhost
... other vmware_guest config ...
hardware:
  num_cpus: 4
  num_cpu_cores_per_socket: 8
  ... other hardware config ...
... other vmware_guest config ...




On Thursday, March 22, 2018 at 3:05:47 PM UTC-5, talha jilal wrote:
>
> Hello, 
>
> I am deploying vms with vmware_guest module, and I need to edit "number of 
> cores per socket" what statement should I use ?
>
> I tried the following statement but it always give me error. 
>
> customvalues:
>   - key: cpuid.coresPerSocket
> value: 2
>
> Error : 
>
>
>
>
> fatal: [kuber-n-03 -> localhost]: FAILED! => {"changed": false, "msg": 
> "Failed t  
>o set custom value for 
> key='numvcpus' and value='two'. Error was: (vmodl.fault.I  
> 
>nvalidArgument) {\n   dynamicType = ,\n  
>  dynamicProperty = (vmodl.Dynami
>  cProperty) 
> [],\n   msg = 'A specified parameter was not correct. \\nkey',\n   fa  
> 
>ultCause = ,\n   faultMessage = 
> (vmodl.LocalizableMessage) [],\n   invali  
>   
>  dProperty = u'key'\n}"}
>
>
>
> When I set 
>
> customvalues:
>   - key: cpuid.coresPerSocket
> value: two
>
>
> Error: 
> > localhost]: FAILED! => {"changed": false, "msg": "Failed t  
> 
>o set custom value for key='numvcpus' and value='two'. 
> Error was: (vmodl.fault.I  
>nvalidArgument) 
> {\n   dynamicType = ,\n   dynamicProperty = (vmodl.Dynami
> 
>  cProperty) [],\n   msg = 'A specified parameter was 
> not correct. \\nkey',\n   fa
>  ultCause = 
> ,\n   faultMessage = (vmodl.LocalizableMessage) [],\n   invali  
> 
>dProperty = u'key'\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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c31bb4c2-cce8-4765-9195-ab2e7c774d10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Copy file(s) locally in Ansible machine

2017-09-12 Thread Nick Mellor
Hi,

My playbook selects a bunch of files from various places on the Ansible 
host, puts them together in a directory, processes them then sends that 
processed directory to remote servers, something like this:

  - copy source dir 1 to proc_dir directory on Ansible master
  - coipy source dir 2 to proc_dir directory on Ansible master
  - process files in proc_dir on Ansible master
  - win_copy src=proc_dir, dest=remote_dir

Are there any facilities for such local processing? It strikes me that it's 
an efficient way to work, but is it an accepted Ansible pattern, and is 
there support for it?

Cheers,

Nick

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd1352b6-e02f-409d-971c-c14224a63092%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Line breaks are excluded when copying a file from ansible linux host to windows server using win_copy

2017-09-03 Thread Nick Mellor
Hi Ishan,

As mentioned previously, the file has not changed, just that Windows and 
Linux expect different line endings.

 

This is what worked for me using Powershell, converting Linux line-endings 
to Windows line-endings:

 

- name: convert line endings from Linux to Windows (PowerShell)

  win_shell: '(Get-Content "filename_from") -replace "`n", "`r`n" | 
Set-Content "filename_to.txt"'

 

The reason I needed to do this was that I was checking out text files on 
Linux, then copying them to a Windows server.


But the problem is, Git automatically ensures files have the "right" 
line-endings during checkout (meaning "right" for the machine doing the 
checkout, not the machine the file's copied to.)


Cheers,

 

Nick

On Thursday, 3 March 2016 22:33:17 UTC+11, ishan jain wrote:
>
> I am copying some text files located on a linux file system to windows 
> file system using the win_copy module of Ansible. The final copied file do 
> not have line breaks in it.
>
> So the file which is like this on linux:
>
> line1
> line2
> line3
>
>
> Becomes this on windows:
> line1line2line3
>
> How can i make sure win_copy just copy the file exactly as it is ?
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a42665bc-2d5a-460c-929b-78a1c1f2a3b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Nick Couchman
Thank you for the suggestion, Mike.

I've tried it both ways, and neither of them works.  In fact, the "YAML 
Syntax" doesn't seem to actually attempt to change directory - if I use 
that, I get an error along the lines of file not found or command not 
found, indicating that it isn't even going to the directory.  If I put it 
up on the line with win_command, it seems to actually try to chdir, but 
fails due to the space.

I forgot to mention in the original post that I have tried all sorts of 
variations of double and single quotes and combinations thereof, and that 
hasn't made a difference - however it gets passed in to the command, it 
seems like PowerShell ends up interpreting it as C:\Program and just 
chopping it off at the space.

I am able to get a command in a directory to run using PowerShell's special 
escape syntax:
& 'C:\Program Files\Application\mycmd.exe'

But this doesn't seem to work in the chdir argument.  Unfortunately because 
the application that I'm running relies on the presence of certain files in 
the current working directory, I need to actually move to that directory.

Thanks,
Nick

On Wednesday, July 26, 2017 at 12:35:59 PM UTC-4, Swedish Mike wrote:
>
> Nick,
>
> I saw it mentioned somewhere that if you use 'YAML syntax'  with the :'s 
> instead of Ansibles ='s you should not need escape characters for 
> directories with spaces in them. Ie, if you do it like this:
>
> - win_command: runsomething.exe
> args:
> chdir: c:\Program Files\Application
>
> The other thing I can think of is adding single quotes ' around the path.
>
> Sadly I don't have any Windows boxes around that I can test this on right 
> now for you, but it could be worth a try?
>
> Cheers, Mike
>
> On Wed, Jul 26, 2017 at 4:17 PM Nick Couchman  > wrote:
>
>> So, I'm trying to run a command via Ansible, and the command exists in a 
>> path that's in a directory with spaces, namely c:\Program Files.  I need 
>> the module to chdir to the directory where the command is actually located 
>> because there are files that it needs to reference inside that directory.  
>> Unfortunately it doesn't seem to want to work, no matter what I try.  I've 
>> tried the following variations on the path to make it work:
>> C:\Program Files\Application
>> C:\\Program Files\\Application
>> C:\\Program\ Files\\Application
>> C:\\Program^ Files\\Application
>> C:/Program Files/Application
>> C:/Program\ Files/Application
>>
>> No matter what I try, here, I get the following message from the module:
>>
>> The directory name is invalid
>>
>> What's the trick to making chdir work for directories with spaces??
>>
>> Thanks - Nick
>>
>> -- 
>> 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 post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/8581aa1e-4010-4616-b399-771acf2fa96f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/8581aa1e-4010-4616-b399-771acf2fa96f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/15ccacde-3e94-4347-a0f7-d5013bbb6d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] win_shell/win_command chdir to Directory with Spaces

2017-07-26 Thread Nick Couchman
So, I'm trying to run a command via Ansible, and the command exists in a 
path that's in a directory with spaces, namely c:\Program Files.  I need 
the module to chdir to the directory where the command is actually located 
because there are files that it needs to reference inside that directory. 
 Unfortunately it doesn't seem to want to work, no matter what I try.  I've 
tried the following variations on the path to make it work:
C:\Program Files\Application
C:\\Program Files\\Application
C:\\Program\ Files\\Application
C:\\Program^ Files\\Application
C:/Program Files/Application
C:/Program\ Files/Application

No matter what I try, here, I get the following message from the module:

The directory name is invalid

What's the trick to making chdir work for directories with spaces??

Thanks - Nick

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8581aa1e-4010-4616-b399-771acf2fa96f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] EFS Module Not Updating Existing EFS Filesystems

2017-03-30 Thread Nick P
The EFS module is not updating an existing EFS filesystem. It seems to 
creating a new filesystem no matter what information I provide. When 
looking at the code it looks like it creates a new filesystem every time no 
matter what. So maybe this is expected behavior. But the documentation 
indicates that you can modify an EFS share.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/51a30b52-27e6-488d-b0db-ccd209b675a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Help with Nested Loops

2017-01-23 Thread Nick Couchman
Hey, everyone,
I'm having figuring out how to use with_items (or some variation thereof) 
in order to loop over a list of items within another list.  What I'm trying 
to do is allow a playbook to accept a mountpoint variable/input, and then 
find the top-level disk device responsible for that.  The trick here is 
that, when using LVM, you have to find not just the LV associated with the 
mountpoint, but also the SCSI device that holds that LV.  For example, if 
I'm looking at mountpoint / on one of my Linux hosts, Ansible has the 
following facts about that mountpoint:
{
"device": "/dev/mapper/centos-root", 
"fstype": "xfs", 
"mount": "/", 
"options": "rw,seclabel,relatime,attr2,inode64,noquota", 
"size_available": 9923756032, 
"size_total": 14879293440, 
"uuid": "e871816f-a069-44a4-a563-cb80e9b733c2"
}, 

This tells me the device (/dev/mapper/centos-root), but I want the parent 
device, and that info is contained in the ansbile_devices fact:
"sda": {
"holders": [], 
"host": "SCSI storage controller: LSI Logic / Symbios Logic 
53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)", 
"model": "Virtual disk", 
"partitions": {
"sda1": {
"holders": [], 
"sectors": "1024000", 
"sectorsize": 512, 
"size": "500.00 MB", 
"start": "2048", 
"uuid": "e3e17f87-fc28-46a4-9842-d8844c618946"
}, 
"sda2": {
"holders": [
"centos-root", 
"centos-swap"
], 
"sectors": "32528384", 
"sectorsize": 512, 
"size": "15.51 GB", 
"start": "1026048", 
"uuid": null
}
}, 

So, we see that the "holders" sub-element of the "sda2" partition, which is 
under the partitions element of "sda", which is a device in ansible_devices 
is what actually contains the LV that I'm after.  Basically what I want to 
be able to do is identify that disk "sda" is what contains this volume 
given the mountpoint /.  I can't quite figure out how, in a playbook, to 
loop through in such a way that I'm looking at each of the entries in 
ansible_devices (sda, sdb, sdc), then each of the holders entries there 
(empty in the above example), then each of the partitions (sda1, sda2, 
sda3, etc.), then each of the holders devices on those partitions, until I 
find one or more devices that contain the logical volume associated with 
the mount point?

Any ideas?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0fac77e8-c75d-4d2d-990e-f06cab387f00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] trouble using sros modules to log in with a specific user

2016-12-01 Thread Nick Keeling
First of all, I am still learning Ansible, so there is a very real 
possibility this is user error, but here is my issue:

When I try to log in using the sros module, regardless of the username I am 
using in the yml file, it is using my username from the ansible host machine

Here is the yml:

---
- name: Test SROS in lab
  hosts: lab-12e
  vars:
cli:
  host: "{{ inventory_hostname }}"
  username: ansible
  ssh_keyfile: /home/nkeeling/ansible/rsa-keys/ansible_rsa.pub
  transport: cli
  tasks:
- name: run show version on remote devices
  sros_command:
commands: show version
provider: "{{ cli }}"

This was taken directly from the examples for the module. When I run the 
module, I get a failure:

nkeeling@eng-tools:~/ansible$ ansible-playbook sros_test.yml


PLAY [Test SROS in lab] 



TASK [setup] 
***
fatal: [192.168.253.137]: UNREACHABLE! => {"changed": false, "msg": "Failed 
to connect to the host via ssh: TiMOS-C-13.0.R4 cpm/hops64 ALCATEL SR 7750 
Copyright (c) 2000-2015 Alcatel-Lucent.\r\nAll rights reserved. All use 
subject to applicable license agreements.\r\nBuilt on Wed Jul 29 16:27:26 
PDT 2015 by builder in /rel13.0/b1/R4/panos/main\r\nThis computer system is 
the property of x Networks. It is for authorized use only. Users 
(authorized or unauthorized) have no explicit or implicit expectation of 
privacy. Unauthorized or improper use of this system may result in 
administrative disciplinary action and civil and criminal penalties. 
\r\nPermission 
denied (publickey,password).\r\n", "unreachable": true}
to retry, use: --limit @/home/nkeeling/ansible/sros_test.retry


PLAY RECAP 
*
192.168.253.137: ok=0changed=0unreachable=1failed=0 
  

When I look at the security log on my SR-OS device, I see:

64 2001/02/23 22:41:40.17 PST MINOR: SECURITY #2011 Base nkeeling
"User nkeeling from 172.17.25.236 failed authentication"

I have tried setting the username in multiple places in the yml file, with 
no change in the result. If anyone is able to steer me in the right 
direction, it would be VERY much appreciated!


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7a2fb8ea-c77c-4b8d-a2aa-7caed9ced2ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible cron module creates jobs for the wrong user

2016-10-28 Thread Nick Santamaria
I have run into a similar issue. System info below:

host: OS X Sierra
target: Ubuntu 16.04

$ ansible --version
ansible 2.1.2.0


The following task results in a cron entry for the *root* user, not the *ubuntu 
*user.

---
- hosts: all
  become: yes
  become_method: sudo
  tasks:
- name: Example cron job
  cron:
user: "ubuntu"

job: "echo test > /dev/null 2>&1"
state: present


If I remove the privilege escalation, the cron entry ends up in the *ubuntu* 
user's 
crontab.



On Friday, October 7, 2016 at 10:14:13 AM UTC+11, Jay LaCroix wrote:
>
> I have noticed, since upgrading to 2.1.2.0 from 2.1.1.0, that the cron 
> module is now creating cron jobs for the root user, in addition to the user 
> specified. For example:
>
> - name: install cron job (ansible run)
>   cron: user="ansible" name="my job" minute="30" job="uptime > /dev/null"
>
> If I run this playbook on the shell, it runs as expected. User "myuser" 
> will have the cronjob "my job" created. However, if I run this playbook via 
> cron, the job will ALSO be created under root's crontab. Please note that 
> the cron that runs this playbook is NOT being run as root. It's being run 
> as the ansible user. Before 2.1.2.0, this worked as intended. Now, every 
> time my system runs its playbooks, it gets duplicate cron jobs (one for the 
> specified user, and another for root).
>
> I'm assuming this is a bug, but I figured I'd check here first.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3dae2483-c52e-486f-9a09-b64fc00b5556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: looping over set of tasks (roles?)

2016-10-19 Thread Nick Tkach
Thank you very much!  No wonder I hadn't figured this out earlier!  I'm 
sure there's just some aspect I never looked into.  Just for the next 
person who comes along what I got to work was

playbook.yml
---
- hosts: localhost
  become: false

  tasks:
- include: "roles/httpd/tasks/main.yml"
  with_fileglob:
- vars/*.yml


roles/httpd/tasks/main.yml:
---
- include_vars: "{{ item }}"
- debug: msg="{{ site_name }}"


vars/site1.yml:
---
site_name: "site1"
http_port: 


vars/site2.yml:
---
site_name: "site2"
http_port: 8899


ansible-playbook playbook.xml does give the output I needed (snippet):

ok: [localhost] => {
"msg": "site1"
}
ok: [localhost] => {
"msg": "site2"
}


On Wednesday, October 19, 2016 at 12:51:48 PM UTC-5, Brian Coca wrote:
>
> - include: file.yml
>with_fileglob:
>   - vars/*.yml
>
>
> file.yml
>
>   - include_vars: {{ item }}
>   - debug: msg="{{ field1 }} from with list"
>   - debug: msg="{{ field2 }} from with list"
>   - template: src="templates/site.conf.j2" dest="site.conf"
>
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2761b49d-f0cb-485f-9ab2-fd428ce2a2c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: looping over set of tasks (roles?)

2016-10-19 Thread Nick Tkach
Can you expand on what you mean by "include + with_items"?  I have a use 
case that is almost identical to what Daniel gives above.  Need something 
like this (I'm sure it's not exactly right):
roles/httpd/tasks/main.yml:
---
- block:
  - include_vars: {{ item }}
  - debug: msg="{{ field1 }} from with list"
  - debug: msg="{{ field2 }} from with list"
  - template: src="templates/site.conf.j2" dest="site.conf"
  with_fileglob:
- vars/*.yml

So basically pulling in a group of variables file one at a time (*not* 
merging) and running through an *entire* set of tasks on each, one at a 
time.


On Friday, April 17, 2015 at 9:37:19 AM UTC-5, Brian Coca wrote:
>
> yes 
>
> On Fri, Apr 17, 2015 at 10:33 AM, Daniel Siechniewicz 
> > wrote: 
> > Or is this a role for include + with_items that will be available in 
> 2.0? 
> > 
> > Regards, 
> > Daniel 
> > 
> > 
>
>
> -- 
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cbb9378f-507d-4346-9ea1-ba3af281b6fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to read variable file each iteration of a task?

2016-10-19 Thread Nick Tkach
I just realized I left out one key piece of info on this.  It's all running 
on localhost always.  The idea with this is we're generating a series of 
config files locally that a separate script later is going to deal with 
actually pushing out (for various reasons it needs to be outside of Ansible 
for now).  So unfortunately I don't think we can take advantage of 
inventory or group.

On Wednesday, October 19, 2016 at 8:39:35 AM UTC-5, Nick Tkach wrote:
>
> Yes, thanks I think that does help some.  I think the part I'm missing 
> still is how to somehow pull in each file name one at a time.  I know in 
> pseudo-code it's something like
>
> for( one_filename in fileglob( vars/*.yml) {
>
> - include_vars "{{ one_filename ))"
> - debug: msg="{{ site_name }} on port {{ port }}"
> }
>
> I know you can't just do something like
>
> - include_vars "{{ item }}"
>   with_fileglob:
> - "vars/*.yml"
>
> since that's going to just pull in the whole list immediately and print 
> out the results at the end.
>
>
> On Tuesday, October 18, 2016 at 3:56:52 PM UTC-5, Alexander H. Laughlin 
> wrote:
>>
>> Have you considered conditional includes 
>> <http://docs.ansible.com/ansible/playbooks_conditionals.html#applying-when-to-roles-and-includes>?
>>  
>> Along with include_vars 
>> <http://docs.ansible.com/ansible/include_vars_module.html#include-vars-load-variables-from-files-dynamically-within-a-task>
>>  
>> I think you should be able to achieve the desired effect.
>>
>> Something like the below:
>>
>> ---
>>
>> - name: include_vars example 
>>
>>   hosts: all
>>
>>   tasks:
>>
>> - name: Debug hostname.
>>
>>   debug:
>>
>> var: inventory_hostname
>>
>>   # Different filenames with the same variables *should* override 
>> the variables for each instance of playbook execution.
>>
>>   # But precedence is tricky and I've had trouble getting things like 
>> this to work in the past, so ymmv.
>>- name: Include variables based on hostname.
>>
>>   include_vars: "vars/{{ inventory_hostname }}.yml"
>>
>> - name: Print site name and port number.
>>  debug:
>>
>> msg: "My site {{ site_name }} is running on port {{ port_number 
>> }}."
>>
>> ...
>>
>> # vim: ft=ansible:
>>
>> Sorry if the formatting is a little wonky the code widget is a little 
>> weird sometimes.
>>
>> Hope this helps, best of luck.
>>
>> Alex
>>
>>
>>
>> On Tuesday, October 18, 2016 at 12:02:43 PM UTC-7, Nick Tkach wrote:
>>>
>>> So, the general idea is I've got a playbook that has a set of "property" 
>>> files (yaml format).  Different filenames, but the variable names inside 
>>> are the same:
>>>
>>> group_vars/siteA.yml
>>> ---
>>> site_name: appA
>>> port: 8080
>>>
>>> group_vars/siteB.yml
>>> ---
>>> site_name: appB
>>> port: 8090
>>>
>>>
>>>
>>> and so on.  I want to run a task that does work using each of those in 
>>> turn like
>>>
>>> - name: print out the value of site_name and port for each of the 
>>> group_vars files
>>>   debug: msg="My site {{ site_name }} is on port {{ port }}"
>>>
>>>
>>>
>>> So you'd expect output like
>>>
>>> My site appA is on port 8080
>>> My site appB is on port 8090
>>>
>>> I'm not finding a way to get this result.  You can't apply a 
>>> with_fileglob to a task block so I'm not sure how to do something to *both* 
>>> "reset" the variables (something like var_files?) *and* do some kind of 
>>> work with the values from *that* file.  I'm assuming I'm missing something 
>>> about how to look at 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2b2ab616-4b99-449d-85c5-155584cdb2ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to read variable file each iteration of a task?

2016-10-19 Thread Nick Tkach
Yes, thanks I think that does help some.  I think the part I'm missing 
still is how to somehow pull in each file name one at a time.  I know in 
pseudo-code it's something like

for( one_filename in fileglob( vars/*.yml) {

- include_vars "{{ one_filename ))"
- debug: msg="{{ site_name }} on port {{ port }}"
}

I know you can't just do something like

- include_vars "{{ item }}"
  with_fileglob:
- "vars/*.yml"

since that's going to just pull in the whole list immediately and print out 
the results at the end.


On Tuesday, October 18, 2016 at 3:56:52 PM UTC-5, Alexander H. Laughlin 
wrote:
>
> Have you considered conditional includes 
> <http://docs.ansible.com/ansible/playbooks_conditionals.html#applying-when-to-roles-and-includes>?
>  
> Along with include_vars 
> <http://docs.ansible.com/ansible/include_vars_module.html#include-vars-load-variables-from-files-dynamically-within-a-task>
>  
> I think you should be able to achieve the desired effect.
>
> Something like the below:
>
> ---
>
> - name: include_vars example 
>
>   hosts: all
>
>   tasks:
>
> - name: Debug hostname.
>
>   debug:
>
> var: inventory_hostname
>
>   # Different filenames with the same variables *should* override the 
> variables for each instance of playbook execution.
>
>   # But precedence is tricky and I've had trouble getting things like 
> this to work in the past, so ymmv.
>- name: Include variables based on hostname.
>
>   include_vars: "vars/{{ inventory_hostname }}.yml"
>
> - name: Print site name and port number.
>  debug:
>
> msg: "My site {{ site_name }} is running on port {{ port_number 
> }}."
>
> ...
>
> # vim: ft=ansible:
>
> Sorry if the formatting is a little wonky the code widget is a little 
> weird sometimes.
>
> Hope this helps, best of luck.
>
> Alex
>
>
>
> On Tuesday, October 18, 2016 at 12:02:43 PM UTC-7, Nick Tkach wrote:
>>
>> So, the general idea is I've got a playbook that has a set of "property" 
>> files (yaml format).  Different filenames, but the variable names inside 
>> are the same:
>>
>> group_vars/siteA.yml
>> ---
>> site_name: appA
>> port: 8080
>>
>> group_vars/siteB.yml
>> ---
>> site_name: appB
>> port: 8090
>>
>>
>>
>> and so on.  I want to run a task that does work using each of those in 
>> turn like
>>
>> - name: print out the value of site_name and port for each of the 
>> group_vars files
>>   debug: msg="My site {{ site_name }} is on port {{ port }}"
>>
>>
>>
>> So you'd expect output like
>>
>> My site appA is on port 8080
>> My site appB is on port 8090
>>
>> I'm not finding a way to get this result.  You can't apply a 
>> with_fileglob to a task block so I'm not sure how to do something to *both* 
>> "reset" the variables (something like var_files?) *and* do some kind of 
>> work with the values from *that* file.  I'm assuming I'm missing something 
>> about how to look at 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3006934d-91b1-4518-a63c-dfdb7d256eb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to read variable file each iteration of a task?

2016-10-18 Thread Nick Tkach
So, the general idea is I've got a playbook that has a set of "property" 
files (yaml format).  Different filenames, but the variable names inside 
are the same:

group_vars/siteA.yml
---
site_name: appA
port: 8080

group_vars/siteB.yml
---
site_name: appB
port: 8090



and so on.  I want to run a task that does work using each of those in turn 
like

- name: print out the value of site_name and port for each of the 
group_vars files
  debug: msg="My site {{ site_name }} is on port {{ port }}"



So you'd expect output like

My site appA is on port 8080
My site appB is on port 8090

I'm not finding a way to get this result.  You can't apply a with_fileglob 
to a task block so I'm not sure how to do something to *both* "reset" the 
variables (something like var_files?) *and* do some kind of work with the 
values from *that* file.  I'm assuming I'm missing something about how to 
look at 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f18c0ce3-07d4-4667-aea7-8b284be4b974%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Nested facts get clobbered with an update to child fact

2016-09-30 Thread Nick

On 29/09/16 03:53, E.C. Raymond wrote:

I am testing on both 1.9.4 and 2.1 and seeing the exact same behavior.

We have a fact.d generator that creates a tree of facts under 
ansible_local.  We use this to set defaults, but if during playbook 
execution it needs to update a default, it clobbers the entire 
ansible_local parent fact. I created a test playbook to replicate the 
same issue.


I'm no authority, for instance I've not switched to using 2.x versions 
of Ansible since I got an essentially functional setup, but I'll chip in 
and say I *think* this is normal behaviour when variable scopes are 
composed.


I used to try and nest role variables into hierarchies but a long time 
ago decided this was simply too fraught when composing them (and this 
not even using set_fact).  I started treating them as globals (albeit 
"with structure"), and naming them with prefixes accordingly: replace 
underscores for dots.  This resolved my problems at the time.


If it wasn't or is no longer the case, I'd be interested to hear about 
it, I'm not aware of anything in the docs which describe scope 
composition rules in this level of detail.


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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b5afd341-d513-4ede-e0f7-124728f0bcbb%40letterboxes.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Examples of Multiple Instances of a "thing" on a single box

2016-09-20 Thread Nick Tkach
Does anyone know of any good examples of having more than one instance of 
an app per box?  Most examples seem to be grouped into something like 
web_servers group has boxes 1,2,3 and has a nice, neat *one* httpd on 1, 
*one* httpd on 2, and *one* httpd on 3.  Problem I'm having is that I'm 
working with an Apache httpd setup where there aren't any nice, neat 
divisions like that.  Apache httpd is on all the boxes, but box 1 might 
have conf appA, appB, and appC and box2 might have appB, appC, and appQ.

I've got something that sort of works based on a combination of group_vars 
files (appA.yml, appB.yml, etc) and clunky site.yml tasks like

- hosts: all
  become: true
  become_user: my_webadm
  vars_files:
- group_vars/appA.yml
  roles:
- httpd
  tags:
- appA

- hosts: all
  become: true
  become_user: my_webadm
  vars_files:
- group_vars/appB.yml
  roles:
- httpd
  tags:
- appB

And inventory is a flat file like

box1
box2
box3

My concern is it doesn't easily scale to add in other environments or 
apps.  Eventually we'll need to add in "dev" and "qa" and "staging".  I 
realize this isn't a great description and I don't expect a full solution.  
I'm just looking for examples beyond just okay here's a tomcat on box1, 
box2, and box4 and an apache on box 2 and box 4.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/27dfd044-d57c-4c46-96a1-c2e1ad405570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Looping over a list to use with with_fileglob

2016-07-11 Thread Nick Tran
I want to loop over a hash list that will provide two items. 

1) The file glob
2) the destination

Is this possible via some sort of nested loop and with_fileglob?

The list would look something like below, and I'm hoping a single 'copy' 
command using with_fileglob can accomplish it. The list in actuality will 
be several dozen lines long and passed as a parameter so hardcoding it is 
not that easy.

list_of_items:
 - {{ glob: "/path/to/items/*", dest: "/new/path/to/items/" }}
 - {{ glob: "/path/to/moreitems/*", dest: "/new/path/to/moreitems/" }}
etc




-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e546ee1e-55df-4977-bf25-413fa29da11e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Variable woes

2016-03-28 Thread Nick Walke
Fairly new to Ansible so I'm trying to wrap my head around the best way to 
handle variables and such.

I've been trying to follow the best practices page, so I have a group_vars 
folder with my environments underneath like so:

group_vars/
  staging/
vars.yml

I then have a role called "fms" that has a template that uses some of these 
variables like so:

common:
  license_key: '{{ newrelic.license_key }}'
  app_name: {{ newrelic.app_name }}
  monitor_mode: {{ newrelic.monitor_mode }}
  developer_mode: false
  log_level: info
  ssl: true
  capture_params: {{ newrelic.monitor_mode }}


  browser_monitoring:
auto_instrument: false


  audit_log:
enabled: false


  sidekiq:
capture_params: {{ newrelic.monitor_mode }}


  transaction_tracer:
enabled: {{ newrelic.monitor_mode }}
transaction_threshold: apdex_f
record_sql: obfuscated
stack_trace_threshold: 0.500
explain_enabled: true
explain_threshold: 0.5


  error_collector:
enabled: {{ newrelic.monitor_mode }}
capture_source: {{ newrelic.monitor_mode }}
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"

All of the variables here are defined in my vars.yml file and other 
templates are working.  But when Ansible goes to create this one, I get:
fatal: [fmsapp]: FAILED! => {"changed": false, "failed": true, "msg": 
"AnsibleUndefinedVariable: 
'dict object' has no attribute 'app_name'"}


I'm using that specific variable just like I used license_key, but 
license_key seems to work and app_name doesn't.  Is app_name a protected 
variable name or something?

Let me know if you have any suggestions.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/12922c13-d277-4d99-86a4-8c21e0c8db0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Galaxy - Install Role from Subdirectory of Github Repo

2016-02-25 Thread Nick Allen

I have a Github repository that contains multiple roles, each in separate 
subdirectories.  For example, I have separate roles 'role-alpha' and 
'role-beta' in a repo at https://github.com/whoami/project.git each located 
in subdirectories as follows.

   - provisioning/roles/role-alpha
   - provisioning/roles/role-beta


I am trying to install these roles via a 'requirements.yml' file by running 
the following.

ansible-galaxy install -r requirements.yml
 
Can I install roles from a single Github repository that have multiple 
roles, each in unique subdirectories?  What would the definition look like?

- name: role-alpha
  src: https://github.com/whoami/project.git
  ???: provisioning/roles/role-alpha

Many thanks for any advice.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b5a34332-2971-457e-aa50-4cd2ea114364%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Can not attach CM rom in Vmware

2015-10-20 Thread Nick Vanadium
Dude, thank you so much. It worked! Of course I tried moving the entry 
everywhere else other than what you suggested lol. But yeah man you finally 
gave me some peace. 

On Sunday, October 18, 2015 at 4:30:15 AM UTC-4, Markus Ellers wrote:
>
> hi,
>
> try making vm_cdrom a parameter under vm_hardware
>
> vm_hardware:
>   memory_mb: "{{ memory }}"
>   num_cpus: "{{ cpucount }}"
>   osid: "{{ osid }}"
>   scsi: paravirtua
>   vm_cdrom:
> type: "iso"
> iso_path: "datastore1/iso/ansible-ks.iso"
>
>
> On Friday, 16 October 2015 18:12:32 UTC+2, Nick Vanadium wrote:
>>
>> Greetings all. Apologies if this is not the correct place to post this 
>> but I wasn't able to find anything related to this. 
>>
>> So I have recently began playing with Ansible and I am trying to build 
>> some VMs in Vmware Sphere using the Ansible module. However I can't seem to 
>> be able to attach the CD rom to the VM with VMware. Below is the error I 
>> receive along with the syntax of my playbook. Any assistance would be much 
>> appreciated. 
>>
>> *My error:*
>>
>> PLAY [all] 
>> 
>>
>> TASK: [vsphere_guest ] 
>> 
>> failed: [EXAMPLE-Web01] => {"failed": true}
>> msg: unsupported parameter for module: vm_cdrom
>>
>> FATAL: all hosts have already failed -- aborting
>>
>> PLAY RECAP 
>> 
>>to retry, use: --limit @/home/ansible/create_vm.retry
>>
>> EXAMPLE-Web01  : ok=0changed=0unreachable=0   
>>  failed=1
>>
>>
>> --
>> *My playbook*:
>>
>> - hosts: all
>>   gather_facts: false
>>   connection: local
>>   user: ansible
>>   sudo: true
>>
>>   vars_prompt:
>> - name: "vcenter_hostname"
>>   prompt: "Enter vcenter hostname"
>>   private: no
>>   default: "vsphere.mydomain.com"
>> - name: "vcenter_user"
>>   prompt: "Enter vcenter username"
>>   private: no
>> - name: "vcenter_pass"
>>   prompt: "Enter vcenter password"
>>   private: yes
>>
>>   vars:
>> datacenter: 'My-Datacenter'
>> esxi_host: 'esx1.mydomain.com'
>> notes: 'Created by Ansible'
>>   tasks:
>> - vsphere_guest:
>> vcenter_hostname: "{{ vcenter_hostname }}"
>> username: "{{ vcenter_user }}"
>> password: "{{ vcenter_pass }}"
>> guest: "{{ inventory_hostname }}"
>> state: powered_on
>> vm_extra_config:
>>   notes: "{{ notes }}"
>> vm_disk:
>>   disk1:
>> size_gb: "{{ disk }}"
>> type: thick
>> datastore: "{{ datastore }}"
>> # Attach CD ROM to VM
>> vm_cdrom:
>> type: "iso"
>> iso_path: "datastore1/iso/ansible-ks.iso"
>> vm_nic:
>>   nic1:
>> type: vmxnet3
>> network: "{{ network }}"
>> network_type: standard
>> vm_hardware:
>>   memory_mb: "{{ memory }}"
>>   num_cpus: "{{ cpucount }}"
>>   osid: "{{ osid }}"
>>   scsi: paravirtual  
>> esxi:
>>   datacenter: "{{ datacenter }}"
>>   hostname: "{{ esxi_host }}"
>> 
>>
>>
>>
>>
>> *Hosts definedEXAMPLE-Web01 disk='8' datastore='datastore1' 
>> network='vlan1' memory='512' cpucount='2' osid='rhel6_64Guest'*
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8387a626-417e-4ea7-8680-f7fd797f4fd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Can not attach CM rom in Vmware

2015-10-16 Thread Nick Vanadium
Greetings all. Apologies if this is not the correct place to post this but 
I wasn't able to find anything related to this. 

So I have recently began playing with Ansible and I am trying to build some 
VMs in Vmware Sphere using the Ansible module. However I can't seem to be 
able to attach the CD rom to the VM with VMware. Below is the error I 
receive along with the syntax of my playbook. Any assistance would be much 
appreciated. 

*My error:*

PLAY [all] 


TASK: [vsphere_guest ] 

failed: [EXAMPLE-Web01] => {"failed": true}
msg: unsupported parameter for module: vm_cdrom

FATAL: all hosts have already failed -- aborting

PLAY RECAP 

   to retry, use: --limit @/home/ansible/create_vm.retry

EXAMPLE-Web01  : ok=0changed=0unreachable=0failed=1

--
*My playbook*:

- hosts: all
  gather_facts: false
  connection: local
  user: ansible
  sudo: true

  vars_prompt:
- name: "vcenter_hostname"
  prompt: "Enter vcenter hostname"
  private: no
  default: "vsphere.mydomain.com"
- name: "vcenter_user"
  prompt: "Enter vcenter username"
  private: no
- name: "vcenter_pass"
  prompt: "Enter vcenter password"
  private: yes

  vars:
datacenter: 'My-Datacenter'
esxi_host: 'esx1.mydomain.com'
notes: 'Created by Ansible'
  tasks:
- vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
guest: "{{ inventory_hostname }}"
state: powered_on
vm_extra_config:
  notes: "{{ notes }}"
vm_disk:
  disk1:
size_gb: "{{ disk }}"
type: thick
datastore: "{{ datastore }}"
# Attach CD ROM to VM
vm_cdrom:
type: "iso"
iso_path: "datastore1/iso/ansible-ks.iso"
vm_nic:
  nic1:
type: vmxnet3
network: "{{ network }}"
network_type: standard
vm_hardware:
  memory_mb: "{{ memory }}"
  num_cpus: "{{ cpucount }}"
  osid: "{{ osid }}"
  scsi: paravirtual  
esxi:
  datacenter: "{{ datacenter }}"
  hostname: "{{ esxi_host }}"





*Hosts definedEXAMPLE-Web01 disk='8' datastore='datastore1' network='vlan1' 
memory='512' cpucount='2' osid='rhel6_64Guest'*

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3d33c63e-f0dd-4ace-aba9-8a3c162ac13b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] csvlookups referencing variables

2015-10-14 Thread Nick Wolff
Still can't figure this out if anyone has any ideas.

Thanks,

Nick Wolff

On Tuesday, September 22, 2015 at 12:25:21 PM UTC-4, Nick Wolff wrote:
>
> On Tuesday, September 22, 2015 at 10:56:34 AM UTC-4, Brian Coca wrote:
>>
>> the 2nd one is right, but you need a space: 
>>
>>  '{{ lookup("csvfile", name + " file=/etc/passwd col=3 delimiter=:")  }}' 
>>
>>
>>
>> -- 
>> Brian Coca 
>>
>
> If I do that I get back 
>
> [WARNING]: non fatal error while trying to template play variables: Failed 
> to
> template {{ lookup("csvfile", name + " file=/etc/passwd col=3 delimiter=:")
> }}: csvfile: "delimiter" must be an 1-character string
>  
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/87df0ddb-4517-4c0d-9890-53a4091f732a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] csvlookups referencing variables

2015-09-22 Thread Nick Wolff
On Tuesday, September 22, 2015 at 10:56:34 AM UTC-4, Brian Coca wrote:
>
> the 2nd one is right, but you need a space: 
>
>  '{{ lookup("csvfile", name + " file=/etc/passwd col=3 delimiter=:")  }}' 
>
>
>
> -- 
> Brian Coca 
>

If I do that I get back 

[WARNING]: non fatal error while trying to template play variables: Failed 
to
template {{ lookup("csvfile", name + " file=/etc/passwd col=3 delimiter=:")
}}: csvfile: "delimiter" must be an 1-character string
 

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48118fb0-4503-4a9c-83ac-d6865c49cfed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] csvlookups referencing variables

2015-09-22 Thread Nick Wolff
Hello all,

I'm trying to do a csvlookup that references a variable so I can 
dynamically choose which line of the file. I tried the first two thinks to 
do the lookup with name only the third directly referencing the name works


- hosts: "{{ target }}"
  vars:
name : "REALUSER"
uid  : "{{ lookup('csvfile', ''name delimiter=: file=/etc/passwd col=2 
')  }}"
gid  : '{{ lookup("csvfile", name + "file=/etc/passwd col=3 
delimiter=:")  }}'
comment  : '{{ lookup("csvfile", "REALUSER  file=/etc/passwd 
delimiter=: col=4")  }}'
  tasks:
  - debug: msg="The uid is {{ uid  }} and the name is {{name}} and the gid 
is {{ gid }}"

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/41fe4265-8fb9-454a-bb31-21a6b8aa0ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Reset vars between plays on same host

2015-07-14 Thread Nick Tkach
Is there a way to somehow "reset" variables in-between plays?  What I'm 
trying to do is make a playbook that creates my standard tomcat instance 
layout.

So given the setup below, as I understand it you'd have "app" files 
group_vars where you could set whatever things specific to that app 
instance like port.  Then you'd have in the 
roles/tomcat-7/defaults/main.yml some default values for everything with 
the idea you'd set what you actually care about in the top level 
group_vars/app1.yml and app2.yml such as port number for that specific 
app.  Then you use an inventory file for a given environment (such as 
dev.hosts) to "hook" together a given app with a given group of host(s).  
Then you call ansible-playbook passing in the inventory file you care about 
right now (such as dev.hosts), the top level playbook (such as 
tomcat7servers.yml),  Then Ansible would iterate through the playbook ( 
tomcat7servers.yml in this case), taking the group_vars/myapp1 and run the 
tomcat-7 role on the myapp1 group of hosts.  Then the same for myapp2.

That much seems like it works, but the problem I get is that there doesn't 
seem to be a way to say ok, this time around I don't want to do both myapp1 
and myapp2.  I want to limit to just myapp2.  I've tried doing something 
like

ansible-playbook -i dev.hosts tomcat7servers.yml --limit=myapp2

but it picks up both.  Not only that but unless I re-define values from the 
myapp1 "run" it keeps the values from myapp1 when it hits myapp2.  This 
usually suggests I'm not "getting" something about how Ansible models 
things.  What am I "missing" about this picture?  I want to be able to run 
something like I gave above there and have a tomcat 7 on appsvr1.internal 
created that has totally default except for the values explicitly set in 
group_vars/myapp1 and another tomcat 7 on that same box that has totally 
default values except for what's explcitly set in group_vars/myapp2.

/usr/local/apache-tomcat-7.0.51   (where this is just a totally plain tar 
xzf of a tarball off Apache's site extracted as root so it's *NOT* writable)

Then the tomcat instances (owned by app user such as tcadm):
/appl/app1/
then under that
/bin
/conf/
/webapps
and so on


/appl/appt2/
same setup as app1 here, but different ports, different instance name


So, trying to extrapolate from Ansible best practices in the documentation 
the local "repo" is something like this

roles/tomcat-7/defaults/main.yml (where you'd set things you don't normally 
care about overriding like maxAjpThreads but you *could* override what's in 
the group_vars top level)
roles/tomcat-7/tasks
roles/tomcat-7/templates
and so on

group_vars/ (where you'd have yml files with the values for a given 
app-such as myapp1.yml, myapp2.yml)
(example myapp1.yml)
ajpPort: 8109
httpPort: 8180
instanceName: myapp1
(example myapp2.yml)
ajpPort: 8209
httpPort: 8280
instanceName: myapp2



dev.hosts (which would match up group_names (such as myapp1 and myapp2) to 
actual hosts in dev environment)
(example dev.hosts)
[myapp1]
appsvr1.dev

[myapp2]
appsvr1.dev

tomcat7servers.yml ("matching" groups for the inventory to actual roles)
- hosts: myapp1
  become_user: tomcat
  roles:
  - tomcat-7
  tasks:
  - include_vars: group_vars/myapp1.yml

- host: myapp2
  become_user: tomcat
  roles:
  - tomcat-7
  tasks:
  - include_vars: group_vars/myapp2.yml



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fb7f72cc-5e29-4164-8bfd-121f49aabaeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Service Module Timeout?

2015-01-13 Thread Nick Fraker
Hi all,

I'm trying to automate standing up a JBoss instance and keep running into 
periodic timeouts from the ansible service module. I've seen a lot of 
information around what to do if you're running into this as part of a 
tasklist ("use wait_for"), but the problem I'm having doesn't really apply 
to that; I'm calling a jboss restart through notify, and at the end of my 
play it's restarting the service and timing out waiting for JBoss to 
respond with "OK".

It's definitely got to do with the amount of time Ansible is waiting for a 
response, because it's an intermittent issue and about 2/3rds of the time 
it restarts fine. However, in that 1/3rd of failures any handlers that are 
scheduled to run AFTER the JBoss one will be skipped, and the tasks which 
notified them haven't changed so they aren't *re*notified on successive 
plays, and I'm forced to manually go run the task via SSH.

Since I can't use "wait_for" in a handler (and besides, the timeout is 
occurring within the service module itself, not errors caused in steps 
later on), is there any way to increase the timeout of a task using the 
service module? This is a JBoss instance with nothing on it at the moment 
and can take upwards of 20 seconds to respond; A fully-loaded JBoss 
instance in my OLTP stack can sometimes take 70 seconds just to start, let 
alone the time it takes to complete current transactions and transfer 
queued ones to other nodes whenever it's stopped.

And hey if I were automating management of my Atlassian services, those 
take 3 - 5 minutes for their Tomcat to start!

I'd really like to not be forced to use "ignore_errors: yes" for this, 
since it gives false-positives for monitoring ansible performance later on.

Thanks,

-Nick F.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0719264b-14fd-437b-816d-402d9ad646e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Radical RFE: ansible should differentiate between constants and variables

2014-12-09 Thread Nick Irvine
By constant, I mean all variables that can be computed prior to any tasks 
being run and will not change, like inventory_hostname. Variables are 
therefore things that may change due to a task being executed.

The idea is that any "when" clause that contains only constants can also be 
evaluated prior to any tasks being executed, and thereby potentially 
excluded. Right now, the --list-tasks flag is rather silly: it prints tasks 
that are conditionally skipped.  Yes, there's the --check flag, but it has 
its own problems (not supported by all modules).

It also means if somehow no tasks are going to be run on host X, we can 
essentially exclude it, skipping gathering tasks.

Right now, I work around the problem by including a human-friendly 
description of the when condition in the task name, but this obviously 
sucks.

Stupid? Impossible?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ce14e4ac-8b54-4b56-9675-b038ab4985f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] the precedence of var_files includes when path is constructed from vars

2014-10-30 Thread Nick
On 30/10/14 20:48, Michael DeHaan wrote:
> inventory scoped variables have less priority than globally scoped things.
>
> This is expected, yes.

Thanks for confirming.  This case didn't appear to be inventory scoped, as it
wasn't taking information from host_vars or group_vars, but I see why it is
logically the same.
Even so, the precedence seems backward: less specific globals beat more specific
inventory vars.  Is there a reason for this or is it purely historical?  If you
can tell me I'll attempt a documentation patch.

Assuming I'm not a weirdo and it is indeed a common case to want global defaults
which can be over-ridden on specific hosts, then I don't see a way to do that at
a playbook level rather than using role defaults or follownig the docs'
recommendation that "Site wide defaults should be defined as a ‘group_vars/all’
setting".  These both force me to move playbook specific information into a
location where they lose context or may be swamped by unrelated definitions. 
Task includes and the set_fact module might be another option, but they set vars
at "task time", which I believe is too late for the values to be seen in roles
the playbook might include.

Would playbook default vars be considered a reasonable feature request?

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5452B6B9.3020605%40letterboxes.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] the precedence of var_files includes when path is constructed from vars

2014-10-30 Thread Nick
For the record, currently I am working around the aforementioned var 
precedence behaviour with a diabolical hack, as follows:


---
- name: test
  hosts: all
  user: root

  vars_files:

# Defines xxx.yyy default value. Diabolical hack, inserts 
inventory_hostname and then removes it.
- "vars.yml{{inventory_hostname| inventory_hostname|truncate(0, 
end='') }}"


# This can now override xxx.yyy
- "{{inventory_hostname}}.yml"

  tasks:
- debug: msg="my var is {{ xxx.yyy }}"

This tricks Ansible into putting the variables from vars.yml into the 
same precedence level as those from "{{inventory_hostname}}.yml" 
include.   I think it would make far more sense to the user if the 
precedence of included vars were simply dependent on the order of 
vars_files inclusion, whether the path is fixed or generated with 
"inventory_hostname", but for now this means I can actually make progress.


Cheers,

Nick

--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/54520149.8070608%40letterboxes.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] the precedence of var_files includes when path is constructed from vars

2014-10-27 Thread Nick

Hello,

Something I discovered about ansible this morning surprised me. 
Essentially: when loading vars files, anything loaded with a 
*dynamically constructed name depending on the host* seems to be lower 
precedence than those files with fixed names, or even dynamic names not 
depending on the host. I'd have expected the opposite? (My ansible 
version is a recent development one, specific information appended below.)


To elaborate, I was trying to override some variables like this:

---
- name: test
  hosts: all
  user: root

  vars:
myhost: my.host.name

  vars_files:

# defines xxx.yyydefault value
- vars.yml

# overrides xxx.yyy(I thought!  Apparently it cannot.)
- "{{inventory_hostname}}.yml"

  tasks:
- debug: msg="my var is {{ xxx.yyy }}"

This playbook uses two included vars files, vars.yml and 
my.host.name.yml (where the playbook is being applied to a host named 
"my.host.name" in the inventory).


I had expected the order of inclusion to define the precedence, in the 
absence of any other information in the documentation:


http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

However, whatever order I used, vars.yml won.  It wasn't a mistake in my 
naming, as


 - If a variable was named in my.host.name.yml but not vars.yml, that 
got set fine.
 - If I removed vars.yml from the includes entirely, xxx.yyy got set 
from my.host.name.yml fine.


Interestingly, "{{myhost}}.yml" still wins over 
"{{inventory_hotname}}.yml", when "myhost" is set to "my.host.name", and 
the order still doesn't seem to affect this.


To conclude, if I'm right, there seems to be an implicit order of 
preference which means that paths constructed with "inventory_hostname" 
(and maybe other built-in variables?) are evaluated first, but later 
includes override them.  Apparently it isn't possible to override 
non-host specific vars depending on the host this way.  To be clear, I 
know there are other ways including using host_vars, the include task 
module, etc., but that's a different point and not what I want to ask about.


The documentation seems to have nothing to say on this behaviour, so I 
thought I'd:


 a) point that out, assuming it is intentional...

but also:

 b) ask for clarification of the details, and whether it really is 
intentional, since it seems to preclude overriding vars as in this use case?


Are the are any other special variables?
What precedence is intended when ordinary vars like "myhost" are used 
instead of ones like "inventory_host"?


 c) ask if is it something which may be changed at a later date, or 
relied on not to change?



Thanks,


Nick

---

ansible --version
ansible 1.8 (devel 2eda9a3a47) last updated 2014/10/10 18:43:36 (GMT +100)
  lib/ansible/modules/core: (detached HEAD 5af8d55b03) last updated 
2014/10/10 18:43:44 (GMT +100)
  lib/ansible/modules/extras: (detached HEAD 681db4ce2c) last updated 
2014/10/10 18:43:45 (GMT +100)
  v2/ansible/modules/core: (detached HEAD cb69744bce) last updated 
2014/10/08 10:13:54 (GMT +100)
  v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 
2014/10/08 10:14:38 (GMT +100)

  configured module search path = library/modules

--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/544E8DB4.8010308%40letterboxes.org.
For more options, visit https://groups.google.com/d/optout.


  1   2   >