[ansible-project] Re: Variable Prompt under a Task

2018-03-14 Thread Vyacheslav
I believe you are over-complicating things, per described.


On Wednesday, 14 March 2018 07:17:59 UTC+1, Mohit Dhingra wrote:
>
> But if i would first ask, It will ask all the variables that are being 
> used in roles A, B and C.  But i want to ask first which role to use and 
> then i want to ask the variables that are being used in selected role. 
>
> On Tuesday, 13 March 2018 15:41:18 UTC+5:30, Vyacheslav wrote:
>>
>> Why would not first ask, and than pass choice as an external variable to 
>> playbook?
>>
>> You can ask with native shell support.
>>
>> On Tuesday, 13 March 2018 10:10:16 UTC+1, Mohit Dhingra wrote:
>>>
>>> Hi All,
>>> I want to get the variable from user. But the definition of the variable 
>>> prompt has to be in the role.
>>>
>>> I am using three actions, Lets say A,B and C. for every action(input 
>>> from user) different roles will be called. But before calling respective 
>>> role it should prompt the variable requirement of that role. So can we use 
>>> variable prompt in a task. or any other solution for the same.
>>>
>>> Thanks,
>>> Mohit
>>>
>>

-- 
You received this message because you are 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/dc26527a-ff5e-4c9a-a031-a9dbbe0a84fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Variable Prompt under a Task

2018-03-13 Thread Vyacheslav
Why would not first ask, and than pass choice as an external variable to 
playbook?

You can ask with native shell support.

On Tuesday, 13 March 2018 10:10:16 UTC+1, Mohit Dhingra wrote:
>
> Hi All,
> I want to get the variable from user. But the definition of the variable 
> prompt has to be in the role.
>
> I am using three actions, Lets say A,B and C. for every action(input from 
> user) different roles will be called. But before calling respective role it 
> should prompt the variable requirement of that role. So can we use variable 
> prompt in a task. or any other solution for the same.
>
> Thanks,
> Mohit
>

-- 
You received this message because you are 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/86353738-f3c3-41b0-b828-aa1a0656e1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: can we install an ansible role being s3 as source?

2018-02-25 Thread Vyacheslav
Why would not work

- src: https://some.s3.bucket.site/files/master.tar.gz
  name: http-role


On Sunday, 25 February 2018 04:13:36 UTC+1, kaja salaam wrote:
>
> can we install an ansible role being s3 as source?
>
> for ex: 
>
> cat requirements.yml
> ---
> - name: ansible-role-ansible
>   src: 's3://ansible-role-ansible.tar.gz'
>

-- 
You received this message because you are 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/df2e0e0d-78dd-4ac0-bba9-8f9ede10301a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using 2 inventories. Can someone explain what I'm doing wrong?

2018-02-13 Thread Vyacheslav

>  Missing (or not readable) key file: '/workstation/gcloud/
credentials.json'

what says ls -la /workstation/gcloud | grep credentials.json ?

On Tuesday, 13 February 2018 17:06:35 UTC+1, Varun Chopra wrote:
>
> So I plan to use a static and a dynamic inventory (gce) and this is what 
> my play folder looks like:
>
> .
> ├── ansible.cfg
> ├── credentials.json
> ├── gce_vars
> │   ├── auth
> │   └── test_servers
> ├── group_vars
> │   └── all
> ├── hosts.yml
> ├── inventory
> │   ├── gce.ini
> │   ├── gce.py
> │   └── hosts.yml
> └── provision.yml
>
> 3 directories, 10 files
>
>
> credentials.json is the json private key for my service account.
>
> [root@workstation gcloud]# cat gce_vars/auth
> ---
> service_account_email: "x-...@developer.gserviceaccount.com 
> "
> path_to_credentials: /workspace/gcloud/credentials.json
> project_id: "heroic-XXX-XXX"
> ...
>
> gce.ini
>
> [gce]
> libcloud_secrets =
> gce_service_account_email_address = X-compute@developer.
> gserviceaccount.com
> gce_service_account_pem_file_path = /workstation/gcloud/credentials.json
> gce_project_id = heroic-XXX-XXX
>
> [inventory]
> inventory_ip_type = external
>
> [cache]
> cache_path = ~/.ansible/tmp
> cache_max_age = 300
>
> However, when I try to run the dynamic inventory, I get this error:
>
> [root@workstation inventory]# ./gce.py --list
> Traceback (most recent call last):
>   File "./gce.py", line 508, in 
> GceInventory()
>   File "./gce.py", line 170, in __init__
> self.driver = self.get_gce_driver()
>   File "./gce.py", line 318, in get_gce_driver
> gce = get_driver(Provider.GCE)(*args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/gce.py", 
> line 1795, in __init__
> super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line 
> 975, in __init__
> self.connection = self.connectionCls(*args, **conn_kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/gce.py", 
> line 99, in __init__
> credential_file=credential_file, **kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 
> 767, in __init__
> user_id, key, auth_type, credential_file, scopes, **kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 
> 653, in __init__
> self.user_id, self.key, self.scopes, **kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 
> 495, in __init__
> "file: '%s'" % key)
> ValueError: Missing (or not readable) key file: 
> '/workstation/gcloud/credentials.json'
>
>
>

-- 
You received this message because you are 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/de244804-97c6-48a1-a16f-0c9cacce59b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] vim as default editor on ubuntu/debian

2018-01-21 Thread Vyacheslav
Speaking about that specific case , you can just create/temlate  
~/.selected_editor for the user you need.

https://github.com/Voronenko/dotfiles/blob/master/selected_editor

But if you want for all , you can do through 

- name: common | set emacs as default editor
  command: update-alternatives --set editor /usr/bin/emacs
  tags: common



On Monday, 22 January 2018 03:33:24 UTC+1, Andreas Olsson wrote:
>
> sön 2018-01-21 klockan 16:57 -0800 skrev Joli Martinez: 
> > I am looking for a way to make vim the default editor on my Ubuntu 
> > and  Debian based system.  Could you help me accomplish this?  On the 
> > CLI  I know that I have to run "update-alternatives --config editor" 
> > and then hit 3 for vim.  I just dont know if there is a way to have 
> > ansible hit 3. 
>
> Tried the alternatives[1] module? 
>
> - name: Set default editor 
>   alternatives: 
> name: editor 
> path: /usr/bin/emacs 
>
>
> // Andreas 
>
> [1]: https://docs.ansible.com/ansible/latest/alternatives_module.html 
>

-- 
You received this message because you are 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/210afbfa-2f59-42bd-9ada-71f90c76674b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Strange lookup behavior after ansible 2.2

2016-12-08 Thread Vyacheslav
Hi,

Assuming I have lookup plugins of such form:

Single



"""
"""
from __future__ import (absolute_import, division, print_function)
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase

__metaclass__ = type


class LookupModule(LookupBase):

def run(self, terms, variables=None, **kwargs):
result="single_row"
return [result]



Multiple



"""
"""
from __future__ import (absolute_import, division, print_function)
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase

__metaclass__ = type


class LookupModule(LookupBase):

def run(self, terms, variables=None, **kwargs):
result=[ "row1", "row2"]
return [result]





Play:



  - block:

- name: Lookup 1
  set_fact:
lookup1: "{{lookup('single')}}"

- debug: var="lookup1"

- name: Lookup 2
  set_fact:
lookup2: "{{lookup('multiple')}}"

- debug: var="lookup2"

- set_fact:
previously_it_was_working: "{{lookup1[0]}}"

- set_fact:
now_only_this_working: "{{lookup2[0]}}"


- debug: msg="This debug should not be skipped 
{{previously_it_was_working}}"

- debug: msg="This debug should not be skipped too 
{{now_only_this_working}}"

- shell: "echo This might be errored but not skipped 
{{previously_it_was_working}}. And was working in Ansible 2.1"

- shell: "echo This might be errored too but definitely not skipped 
{{now_only_this_working}}}. And was working in Ansible 2.1"

- debug: msg="Nice to meet you http://github.com/voronenko;

when: 1==1





Expected result:  returned array in both cases.

Side effect:  in more complex production play actions like below now 
sometimes are just skipped?

- debug: msg="This debug should not be skipped 
{{previously_it_was_working}}"

- shell: "echo This might be errored but not skipped 
{{previously_it_was_working}}. And was working in Ansible 2.1"

Instead I have play:

===
ansible 2.2.0.0
  config file = 
  configured module search path = Default w/o overrides

PLAY [Test play] 
***

TASK [setup] 
***
ok: [localhost]

TASK [Lookup 1] 

ok: [localhost]

TASK [debug] 
***
ok: [localhost] => {
"lookup1": "single_row"
}

TASK [Lookup 2] 

ok: [localhost]

TASK [debug] 
***
ok: [localhost] => {
"lookup2": [
"row1", 
"row2"
]
}

TASK [set_fact] 

ok: [localhost]

TASK [set_fact] 

ok: [localhost]

TASK [debug] 
***
ok: [localhost] => {
"msg": "This debug should not be skipped s"
}

TASK [debug] 
***
ok: [localhost] => {
"msg": "This debug should not be skipped too row1"
}

TASK [command] 
*
changed: [localhost]

TASK [command] 
*
changed: [localhost]

TASK [debug] 
***
ok: [localhost] => {
"msg": "Nice to meet you http://github.com/voronenko;
}

PLAY RECAP 
*
localhost  : ok=12   changed=2unreachable=0failed=0 
 


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To 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/c336ce47-a88e-4ab9-98f9-b3e64153aa68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible Acton Plugins

2016-07-22 Thread Vyacheslav Voronenko
Where should the library/ be present?  Could it be also directory under
playbook?

On Fri, Jul 22, 2016 at 6:02 PM, Mike Biancaniello <chepa...@gmail.com>
wrote:

> action_plugins/ will not be picked up by ansible unless there is a file in
> library/ with the same name. This file in library/ can be empty, but it
> must exist.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/AIzW4z3dEL4/unsubscribe.
> To unsubscribe from this group and all its topics, 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/e4ad06fc-7734-459f-bb14-20e8bed5b349%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e4ad06fc-7734-459f-bb14-20e8bed5b349%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best Regards,
  Vyacheslav Voronenko

-- 
You received this message because you are 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/CAJMGCSQJfJ75bQqPtref5vO1STLveAS%2BRwSeQOiBPv_usMjQ%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible Acton Plugins

2016-07-21 Thread Vyacheslav Voronenko
in my case actions plugins are not picked up from action_plugins/ folder,
but lookup one do from lookup_plugins/ folder. Perhaps I missing smth
obvious.

i.e. I have set of lookup plugins:

/deployment/boxes/lookup_plugins
➜  lookup_plugins git:(feature-standalone-gl-ee) ls *.py
aws_ec2_allocation_id_from_eip.py  aws_secgroup_ids_from_names.py
 aws_subnet_ids_from_names.py  aws_vpc_id_from_name.py  sa_hashi_vault.py

and lookup plugins are picked just fine, I am able to use them in playbook

But the action plugins from  /deployment/boxes/action_plugins  are not
loaded or detected by ansible.




On Thu, Jul 21, 2016 at 5:06 PM, Mike Biancaniello <chepa...@gmail.com>
wrote:

> Vyacheslav, I'm not sure I understand your question?
>
> On Thursday, July 21, 2016 at 9:07:49 AM UTC-4, Vyacheslav wrote:
>>
>> Mike,
>>
>>   I think, I have similar issue.
>>
>> Mine local lookup plugins from playbook_dir/lookup_plugins are loaded and
>> executed fine,  but the same manner implemented action plugins are not
>> loaded from file like playbook_dir/action_plugins/action.py
>>
>> Is there additional magic linked to library too ?   Is there way I can
>> distribute local action plugin with playbook?
>>
>> On Friday, 15 April 2016 16:46:22 UTC+3, Mike Biancaniello wrote:
>>>
>>> Action plugins need to be in the action_plugins/ dir (can be either a
>>> subdir of the playbook_dir or of a role that you include), however, ansible
>>> won't recognize the plugin uless you also have a file of the same name in
>>> the library/ dir. All you **need** to do is 'touch' the library file,
>>> but you should at least use this to store the module documentation.
>>> Remember, though, that action_plugins are executed on ***localhost***,
>>> so action_plugin is often used for local preprocessing before calling the
>>> module to do the remote work.
>>>
>>> All of that being said, why can't you just pass the module the args that
>>> you need?
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/AIzW4z3dEL4/unsubscribe.
> To unsubscribe from this group and all its topics, 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/5659a1f3-0c44-4a28-9bde-ab47d529881d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5659a1f3-0c44-4a28-9bde-ab47d529881d%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best Regards,
  Vyacheslav Voronenko

-- 
You received this message because you are 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/CAJMGCST1f2_ZuttPC0J0ex41dD4zQ%3DV%2B68Sr_eBoOd8WZC6Cyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Running ansible playbooks in Bamboo?

2016-07-21 Thread Vyacheslav
If you have credentials to the host, you might create parametrized bamboo 
job like "bootstrap.box" , which will execute small playbook to configure 
new box for bamboo (like add keys, perhaps create some user and so on)

On Wednesday, 20 July 2016 17:53:31 UTC+3, ZillaYT wrote:
>
> I saw this post, but my problem is different.
>
> https://groups.google.com/forum/#!searchin/ansible-project/ansible$20in$20bamboo/ansible-project/BvITeLL0hiA/orjip4bMAgAJ
>
> I have Bamboo agents that runs scripts under a "bamboo" user. Now this 
> bamboo user needs to run ansible playbooks on a newly-created server. 
> However, this newly-created server does NOT have the bamboo user's ssh 
> public key yet. So what is the recommended way of adding bamboo user's 
> public key to the newly-created server's /home/bamboo/.ssh/authorized_keys 
> file? Do I just create an image with it there already?
>
> 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 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/5dbcbf4c-4194-4e2a-8052-bb03a48fc70d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Acton Plugins

2016-07-21 Thread Vyacheslav
Mike,

  I think, I have similar issue.

Mine local lookup plugins from playbook_dir/lookup_plugins are loaded and 
executed fine,  but the same manner implemented action plugins are not 
loaded from file like playbook_dir/action_plugins/action.py

Is there additional magic linked to library too ?   Is there way I can 
distribute local action plugin with playbook?

On Friday, 15 April 2016 16:46:22 UTC+3, Mike Biancaniello wrote:
>
> Action plugins need to be in the action_plugins/ dir (can be either a 
> subdir of the playbook_dir or of a role that you include), however, ansible 
> won't recognize the plugin uless you also have a file of the same name in 
> the library/ dir. All you **need** to do is 'touch' the library file, but 
> you should at least use this to store the module documentation. Remember, 
> though, that action_plugins are executed on ***localhost***, so 
> action_plugin is often used for local preprocessing before calling the 
> module to do the remote work.
>
> All of that being said, why can't you just pass the module the args that 
> you need?
>

-- 
You received this message because you are 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/26b1b2dd-c08f-4850-918c-8316127c29bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.