Re: [ansible-project] AWX: Updating roles on project update/install

2017-09-19 Thread Mike Biancaniello
ahh, thank you. I will look there for answers. -- 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

[ansible-project] AWX: mounted playbook dir in docker

2017-09-19 Thread Mike Biancaniello
I am running AWX in docker containers and have mounted the playbooks directory (I modified local_docker/tasks/main.yml:"Activate AWX Task Container" to include a volume argument). I created a directory and a playbook and it shows up inside the container: $ docker exec -it awx_task /bin/ls -hal

[ansible-project] AWX: install python libs

2017-09-19 Thread Mike Biancaniello
I am playing around with AWX and want to load a role (or "project" I suppose is the new term) that has some custom libraries and filter_plugins. The problem is that these python scripts require py libs that were never installed in the docker image. Is there a way to configure an additional

[ansible-project] AWX: Updating roles on project update/install

2017-09-19 Thread Mike Biancaniello
I am running AWX inside of some docker containers and can't get the project_update job to install roles from my requirements.yml file. false . It successfully finds the file, but, for some reason, scm_full_checkout is always set to false. I modified

[ansible-project] Re: Cumulative group variables?

2016-10-24 Thread Mike Biancaniello
So, the problem is that you can't combine lists, but you can merge dicts (it's a config setting, default=false). This will require either a double for loop or, (my preference, especially if you are going to use this type of construct a lot) a filter to combine them. # file: /group_vars/tors

Re: [ansible-project] Re: How do I use multiple ansible versions on the same machine for different playbooks that require specific versions?

2016-08-01 Thread Mike Biancaniello
I would also suggest python virtual environments. Although, I have also used Docker images for running Ansible. I create a Docker image with 'ansible' as the ENTRYPOINT, then create a shell script to execute 'docker run -it --rm []'. This will execute ansible inside the docker and use the

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

2016-07-22 Thread Mike Biancaniello
resent? Could it be also directory under > playbook? > > On Fri, Jul 22, 2016 at 6:02 PM, Mike Biancaniello <chep...@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

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

2016-07-22 Thread Mike Biancaniello
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 the Google Groups "Ansible Project" group. To unsubscribe from this group

[ansible-project] Re: Ansible Acton Plugins

2016-07-21 Thread Mike Biancaniello
me 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 B

[ansible-project] Re: Unsure how to merge this dict/list into a single dict/list

2016-06-21 Thread Mike Biancaniello
It sounds like you are looking to do something like this: https://github.com/chepazzo/ansible-filters-extras/blob/master/filter_plugins/listofdicts.py#L121 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and

Re: [ansible-project] Run Ansible Playbook inside Docker container?

2016-05-19 Thread Mike Biancaniello
I hadn't thought of using Ansible to create Docker images before, but this is an interesting way to do this, instead of using a complicated Dockerfile to manage each variety of service. I might want to figure out a way to be able to build an image for each group in your hosts file. On

[ansible-project] Re: Variable within Variable

2016-05-19 Thread Mike Biancaniello
You can reference variables within variables. e.g. # group_vars/all --- apple: JameslikesApples banana: IwentToSanFrancisco # group_vars/thing1 --- basket: {{ apple }} # group_vars/thing2 --- basket: {{ banana }} Then, you can reference {{ basket }} in your playbook or template: # site.yml

[ansible-project] Re: Ansible Acton Plugins

2016-04-15 Thread Mike Biancaniello
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

[ansible-project] Re: Question on import statement in ansible module?

2016-04-14 Thread Mike Biancaniello
Have you looked into creating an action_plugin (runs on localhost) that uses the non-standard module to do what it needs to do, then calls your module to be run remotely, but not needing the py lib anymore? Depending on what the py lib is doing, this may be an option for you. Check out

Re: [ansible-project] Ansible Network, junos_command.

2016-04-13 Thread Mike Biancaniello
might there be an application firewall between you and the switch that allows openssh, but not paramiko? On Wednesday, April 13, 2016 at 9:11:30 AM UTC-4, Oscar Bengtsson wrote: > > Hi, > From what I understood netconf is not needed for this module, but yes it > is enabled from when i tried

[ansible-project] Re: Ansible Vault

2016-03-31 Thread Mike Biancaniello
Every item in group_vars/ is named to match a group name. These items can be either files (my_group, my_group.yml) or directories (my_group/). If it is a directory, then it works similarly to a .d/ directory where all of the files in that dir are imported. These are equivilent structures: 1.

[ansible-project] Re: My first "role" isn't running

2016-03-23 Thread Mike Biancaniello
I'm actually surprised that this tree worked; I would have expected 'roles' to need to be under powerbroker_install (i.e. powerbroker/powerbroker_install/roles/pb_install_dev, etc), but glad that things are working for you. For passwords, are you familiar with prompts

[ansible-project] Re: include custom python library from custom module

2016-03-23 Thread Mike Biancaniello
y over the dependent libraries to the target > systems? > > On Tuesday, 22 March 2016 17:13:38 UTC, Mike Biancaniello wrote: >> >> You can put them in the same or sub dir as your modules. Or, you can put >> them anywhere, just append the path in the module. However,

[ansible-project] Re: My first "role" isn't running

2016-03-22 Thread Mike Biancaniello
like I said, since you've put this into a role, "separating this into multiple plays would be more complicated", so you're better off not splitting it up and instead, doing what you were doing copied from your earlier post (with the typo pointed out by Uditha corrected: In

[ansible-project] Re: include custom python library from custom module

2016-03-22 Thread Mike Biancaniello
You can put them in the same or sub dir as your modules. Or, you can put them anywhere, just append the path in the module. However, if you want multiple modules in multiple roles to share the same libs, then things get tricky. I've done that by appending '../../pylibs/' to my sys.path to get

[ansible-project] Re: Playbooks in subdirectories

2016-03-21 Thread Mike Biancaniello
I agree that it's annoying, especially if you try to organize by includes and reusable playbooks, it's hard to tell, looking at a list of *.yml files which ones are the top-level and which are meant to be included. If you're not using roles and only using tasks, you can put your tasks in a

[ansible-project] Re: My first "role" isn't running

2016-03-21 Thread Mike Biancaniello
1. what Uditha said about 'testservers'. 2. By "use multiple plays", I meant to create one play that specifies hosts: testservers, another play that specifies hosts: dev-servers, and a third that specifies hosts: prod-servers. Then, have specific tasks for those servers. Now, re-looking at

[ansible-project] Re: My first "role" isn't running

2016-03-19 Thread Mike Biancaniello
Or ... your problem could be that you don't have a group defined as "testservers". Only "testsystems". -- 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] Re: My first "role" isn't running

2016-03-19 Thread Mike Biancaniello
Overall, you are better off customizing your plays for each group (maybe in separate playbooks) instead of trying to make a one-size-fits-all playbook. Tasks can be reused by either importing them or putting them in roles. The other nice thing about this model is that when you run

[ansible-project] Re: My first "role" isn't running

2016-03-18 Thread Mike Biancaniello
I think your tree should look more like this. Also notice the change of tasks/app_install_task.yml to tasks/main.yml ~/git/ansible$ tree . └── project1 ├── server_hosts ├── roles │ └── app_install │ ├── README.md │ ├── defaults │ │ └── main.yml │

Re: [ansible-project] Tags as variable inside of playbook

2016-03-15 Thread Mike Biancaniello
It sounds like you want to instruct a task to execute ONLY if a tag is present (skip if tag not set). I've seen that request before, but no idea if it may or may not be implemented. I wonder if a vars_plugin or lookup_plugin might work. would this work? # file ./lookup_plugins/get_tags.py

[ansible-project] Re: Tags as variable inside of playbook

2016-03-15 Thread Mike Biancaniello
This is probably very terrible, but... pre_tasks: - name: set tag as fact set_fact: myvar = mytag tags: mytag I don't think there is an 'ansible_tags' var passed to the playbook. I haven't looked, but It is possible that an action_plugin might have access to that (from

[ansible-project] Re: Calling a role, but only run tasks that use a certain tag

2016-03-09 Thread Mike Biancaniello
I have seen others ask for this. Hopefully, there will eventually be a more elegant method. However, I believe that the only way to do this is, as you said, use a variable. I do this for debug or testing tasks that I don't want to run normally, but if I pass -e '{"run_tests":true}' when I run

[ansible-project] setting 'always_run' from a var

2016-03-02 Thread Mike Biancaniello
I have a task that I would like to conditionally run even in check_mode (actually I want to set it for an entire role, but I'm seeing the same behavior in regular tasks). The idea is that this would NOT run the task: ansible-playbook always_run.yml --check And then to actually execute the

Re: [ansible-project] force --check

2016-02-25 Thread Mike Biancaniello
That might be what I'm looking for, but I'm not sure. I want to be able to run a playbook (*not* in check_mode), but tell one task to run *only* in check_mode. Currently, if you run in check_mode, setting `always_run: true` on a task makes that task run as if it is not in check_mode. I want

Re: [ansible-project] The new Python API is extremely complex.

2016-02-25 Thread Mike Biancaniello
interesting. My hybrid (custom) lookup_plugin: def run(self, terms='', **kwargs): '''Normalize terms and args and perform lookup. Args: terms (Optional[str,list]): Comma-delimited string (or python list) of terms. kwargs (**dict): See ``Store()`` object

Re: [ansible-project] The new Python API is extremely complex.

2016-02-25 Thread Mike Biancaniello
I have done similar things to enable my plugins for v1 AND v2. Essentially: from ansible import __version__ as ANSIBLE_VERSION if ANSIBLE_VERSION.startswith('2'): else: More recently, I am encouraging everyone to upgrade to v2 and trying to remove the v1 support esp as some things that

Re: [ansible-project] The new Python API is extremely complex.

2016-02-24 Thread Mike Biancaniello
I have found that if you want to wrap the running of a playbook inside of a python script (so you can make the interface a bit more user friendly and translate cmdline args to --extra-vars, etc), the 2.0 API is much simpler. from ansible.cli.playbook import PlaybookCLI cliargs = {

[ansible-project] Re: missing ansible.callbacks module

2016-02-12 Thread Mike Biancaniello
ansible.callbacks no longer exists in 2.0. it sounds like you are calling Ansible from a python script. If so, this process is very different in 2.0. You probably need to reach out to whomever wrote the software or downgrade your ansible to 1.9. If you want to take a stab at fixing it, the

Re: [ansible-project] Play single roles in a playbook

2016-02-12 Thread Mike Biancaniello
It would be nice if roles could be autotagged with the role name. > -- 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] Re: Ansible 2.0.1 RC1 is available for testing!

2016-01-28 Thread Mike Biancaniello
excellent. I was excited to see the diff['prepared'] (plugins/callback/) made into this release, but a little bummed that AnsibleModule._diff did not. Do you have a release target for that? ( https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/basic.py#L1144 ) -- You

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-27 Thread Mike Biancaniello
and update the ticket with the actual data specific to the playbook that is being run. I'm not sure I'm completely satisfied with this solution, but it does seem to work. On Tuesday, January 26, 2016 at 1:22:01 PM UTC-5, Mike Biancaniello wrote: > > Ok, so the problem I'm having in

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-26 Thread Mike Biancaniello
Ok, so the problem I'm having in making this a callback is that I want to open a ticket on playbook start and close it on stats. In order to open the ticket, I need certain information that will be specific to the playbook being run. The only way I can find to pass vars is through play_vars,

[ansible-project] role callback dependencies

2016-01-25 Thread Mike Biancaniello
So I have been playing around with multiple callbacks and ordering. I created two callback plugins: calltest1, calltest2. Each one simply prints its number and fcn to the screen: e.g. TEST1: v2_playbook_on_start() TEST2: v2_playbook_on_start() Some observations: 1. If I put the callbacks in

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-22 Thread Mike Biancaniello
So, it looks like, in my case, I'll want an action plugin since I don't really need anything run on a remote machine and I'll need access to the results of the playbook. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-22 Thread Mike Biancaniello
I actually started out to create a callback that triggered on change, but after some internal discussion, decided that I didn't want it to fire after each task, but rather, wanted to run it one time in the beginning and once at the end, so I figured that calling it as a task would be more

[ansible-project] Re: action_plugin/ vs library/ module

2016-01-22 Thread Mike Biancaniello
I'm trying to get Ansible to open a ticket in our internal config management system. I'm not new to modules, just thought that the action plugin looked more 2.0-ish. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-22 Thread Mike Biancaniello
I also notice that there seem to be a lot of action_plugins for core modules. It doesn't look like modules have access to ansible __main__ data (e.g. if --diff was passed on the cmdline). If I need that data, might I need an action_plugin? -- You received this message because you are

Re: [ansible-project] action_plugin/ vs library/ module

2016-01-22 Thread Mike Biancaniello
Perhaps. I'll probably build both and see which feels better. I need to be able to set vars for the plugin/module to use that might be different for each playbook. The callback_plugins have access to vars through the 'invocation' in res, right? I'll also need access to all of the diffs, so

[ansible-project] action_plugin/ vs library/ module

2016-01-21 Thread Mike Biancaniello
So, what's the deal with action_plugins? There is very little documentation on their purpose. Observations: 1. If action_plugin/foo.py and library/foo.py both exist, then only action_plugin/foo.py gets called (the plugin *may* call the module if it wants, but that is not by default). 2. If

Re: [ansible-project] callbacks with --check

2016-01-19 Thread Mike Biancaniello
worked great, thanks! Is there a way to do this in 1.94? For now, I added to my callback: from ansible import __version__ as ANSIBLE_VERSION if not ANSIBLE_VERSION.startswith('2'): from ansible.callbacks import display display("Logging not supported in Ansible <2.0",'red') from

[ansible-project] callbacks with --check

2016-01-19 Thread Mike Biancaniello
I am trying to put together a logging module to log changes, but I do not want to log anything when run in check-mode (because no changes were made, so this would be confusing to anyone reading the logs). Is there any way to do this? I can't find any place where play_context (or anything else

[ansible-project] Re: Get other group variables

2016-01-05 Thread Mike Biancaniello
You could also create a VIP list in 'all' and then reference them in the group_vars: group_vars/all/vips: all_vips: - name: cluster1_vip ip : 1.2.3.4 otherattr: yes - name: cluster1_othervip ip : 1.2.3.5 otherattr: yes - name: cluster2_vip ip : 1.2.4.4 otherattr:

Re: [ansible-project] --skip-tags equivalent inside playbooks

2015-12-17 Thread Mike Biancaniello
I agree that I'd like to be able to have roll contain a number of tasks and then have then selective run. A use-tags or play-tags option would be nice to use in that case. While you can certainly implement that with vars (see #2 below), it seems that a tags solution would be more elegant.

[ansible-project] Re: nested variables - again

2015-12-15 Thread Mike Biancaniello
Will this do what you need? using structure[list] instead of trying to nest. --- - name: stuff connection: local gather_facts: no hosts: localhost vars: list: list1 structure: list1: - {var1: "val1", var2: "val2", var3: "val3"} list2: - {var1:

[ansible-project] kerb host princ maintenance

2015-12-11 Thread Mike Biancaniello
Does anyone know of an existing module that allows me to manage krb5 princs and keytabs that also supports --check-mode? I found one that essentially runs a bash script to add princs, but it doesn't check first to see if the entry exists (if I remember, it was meant for creating the admin for

[ansible-project] Re: How to make an item in with_items conditional?

2015-12-11 Thread Mike Biancaniello
My first thought is to create a new task and use a when clause: - hosts: mt1-dummys101 tasks: - name: Install apt packages sudo: true apt: pkg={{ item }} with_items: - build-essential - libyaml-dev - python2.7-dev - name: Install apt packages

[ansible-project] Re: Access ansible list in python script.

2015-12-10 Thread Mike Biancaniello
Instead of passing a python list, can you pass a json string? Then, inside the py script, just use json.loads(). -- 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

[ansible-project] Re: help on loop over list of dicts

2015-12-10 Thread Mike Biancaniello
Not sure what you're doing wrong. Maybe it's the way you define dev_interfaces (yeah, it makes no sense why it would work in debug, but not in with_items, but sometimes that happens). This worked for me: --- - name: stuff connection: local gather_facts: no hosts: localhost vars:

[ansible-project] Re: Iterating over a list in a dictionary within a Jinja2 template

2015-12-08 Thread Mike Biancaniello
First, in your j2, you can't ever reference `item` without `item.key` or `item.value`. However, I think your amin problem is that your first iteration is a dict (not a list) and the second is a list of dicts without deterministic keys. Try this: hubot_bots: testbot: owner: 'Bot Wrangler

[ansible-project] Re: Ansible Best Practice.

2015-12-07 Thread Mike Biancaniello
Originally, I was containing my vars within the roles, but after realizing that those vars override everything else, instead, I only populate the default/main.yml with vars inside the roles, just so things don't error, and define everything else in my main group_vars. So, in my setup, when I

[ansible-project] Re: Combinations of lists

2015-12-07 Thread Mike Biancaniello
have you tried ansible_nested ( http://docs.ansible.com/ansible/playbooks_loops.html#nested-loops) Enter code here..--- - name: stuff hosts: localhost gather_facts: no connection: local vars: l: [a,b,c] n: [1,2,3] tasks: - name: show nested debug: msg="[{{ item[0]

[ansible-project] Re: How to define host var and append values to it from task

2015-11-19 Thread Mike Biancaniello
I think the short answer is that you don't. Ansible has a setting that will allow you to merge dictionaries together, but not lists. This setting is global and applies to all dicts. I'm guessing it doesn't merge lists because there's no way to indicate if your intent is to merge the list or

[ansible-project] Playbook organization with var files

2015-10-09 Thread Mike Biancaniello
I have the same issues trying to manage a ton of playbooks that all use the same resources (which is how I stumbled upon this). However, after reading the comments, I think I better understand where Ansible is coming from. (people who know I'm sure will correct me if I'm wrong) It seems as