Re: [ansible-project] How to add a number to an {{ item }}

2014-02-03 Thread Kahlil Hodgson
Try {{ item|int +1 }} K On 04/02/2014 5:58 AM, edrozenb...@gmail.com wrote: Hello, In certain cases it's useful to be able to add a number to the value of an {{ item }} variable For example when creating md (raid) devices, md0 for example is made up of partitions sda1 and sdb1.

Re: [ansible-project] different groups with different variables using the same role in the same host

2014-01-28 Thread Kahlil Hodgson
Hi Guillem. This looks like a modeling problem: the project variables need to be detached from the host/group variables. Try something like: # group_vars/all.yml --- project: test1: domain: test1.com #... other vars for project test1 test2: domain: test2.com # ...

Re: [ansible-project] Column does not work in lineinfile module

2014-01-15 Thread Kahlil Hodgson
try the YAML '' escaping mechanism ( http://yaml.org/spec/current.html#id2503232): lineinfile: dest={{deploy_root}}/{{instance}}/{{project}}/{{project}}/local_settings.py regexp='^NAME' line=NAME: {{db_name}}, The lines following the '' to be interpreted as a scalar and not a

Re: [ansible-project] Distro questions...

2014-01-15 Thread Kahlil Hodgson
Hi Peter, The CR released version you mentioned is for version 5.3p1-94. I Just did a quick google search and I believe you need a version 5.6 or better to get ControlPersist, unless RedHat backports the feature. The 94 at the end of the version suggests package has been modified at least 93

Re: [ansible-project] roles with per-host config?

2014-01-13 Thread Kahlil Hodgson
I use single-host roles for a couple of hosts. Sometimes a role only makes sense if only one host has it at a time. I also find this useful when I have to upgrade a whole server: I can build an test the new hardware using the role (with a couple of key bits turned off), then cut over once I'm

Re: [ansible-project] Looking up key/value pairs without iteration

2014-01-07 Thread Kahlil Hodgson
exactly what the differences are without having to infer it from a collection of examples. On Tuesday, January 7, 2014 2:32:48 PM UTC-6, Kahlil Hodgson wrote: Looks like you want to look up a package version by package name: ## Vars file version_for_package: foo: 1.1.19-1 bar: 3.11.0-6

Re: [ansible-project] Within a role... trying to use a group_by created in the previously run role

2014-01-06 Thread Kahlil Hodgson
I've never tried this but I would think you could just use the hosts option in the the parent playbook? Something like: - hosts: all roles: - generate_groups # generates group1, group2, etc - hosts: group1 roles: - do_something_with_a_group Otherwise you might try: - hosts: all

Re: [ansible-project] Extract IPv6 link-local address from facts

2014-01-02 Thread Kahlil Hodgson
. By all means, do not use a hammer. -- IBM maintenance manual, 1925 On Thu, Jan 2, 2014 at 8:23 PM, Anand Buddhdev arh...@gmail.com wrote: On Thursday, 2 January 2014 00:48:22 UTC+1, Kahlil Hodgson wrote: Hi again Kahlil, I branched my ansible setup, and patched jinja2 with the commit from

Re: [ansible-project] Extract IPv6 link-local address from facts

2014-01-01 Thread Kahlil Hodgson
be a reason. By all means, do not use a hammer. -- IBM maintenance manual, 1925 On Thu, Jan 2, 2014 at 10:48 AM, Kahlil Hodgson kahlil.hodg...@dealmax.com.au wrote: Hi Anand, Looking at the documentation again, it seems I misinterpreted: i did not realise that 'none' is a jinja test

Re: [ansible-project] Extract IPv6 link-local address from facts

2013-12-30 Thread Kahlil Hodgson
:00 UTC+1, Kahlil Hodgson wrote: There will be cleaner ways to do this once jinja2.7 becomes more readily available, but for now you could probably simulate the above loop with 'with_items' and a 'when' conditional: tasks: - name: ipv6 link local debug: msg={{ item.address }} when: item.scope

Re: [ansible-project] Extract IPv6 link-local address from facts

2013-12-29 Thread Kahlil Hodgson
There will be cleaner ways to do this once jinja2.7 becomes more readily available, but for now you could probably simulate the above loop with 'with_items' and a 'when' conditional: tasks: - name: ipv6 link local debug: msg={{ item.address }} when: item.scope == 'link'

Re: [ansible-project] Ansible vs Phing

2013-12-20 Thread Kahlil Hodgson
On 21 December 2013 02:29, RafaƂ Hajduk bleb...@gmail.com wrote: What I understand as deployment is: 1. Upload new version of code (specified git branch) to /{timestamp}/ 2. Replace current .htaccess with Deny from all 3. Change symlink /current/ to timestamp 4. Perfrom all SQL queries that

Re: [ansible-project] Escaping $ inside a variable

2013-12-11 Thread Kahlil Hodgson
that in TEST2 that the jinja2 filter gets applied BEFORE the ansible variable substitution, but it appears that in TEST1 the jinja2 filter comes after, or is not being applied somehow. Peculiar. kesten On Tuesday, December 10, 2013 4:03:51 PM UTC-6, Kahlil Hodgson wrote: On 11 December

Re: [ansible-project] Looking for ideas: secure user management

2013-12-08 Thread Kahlil Hodgson
How about --- # assuming non-system user ids start at 500 - name: grab existing users for this host shell: cat /etc/passwd | perl -ne -F: 'print $F[0] if $F[1] 499' register: users - name: lock unknown users user: name={{ item }} password='!' when: item not in known_users with_items:

Re: [ansible-project] Looking for ideas: secure user management

2013-12-08 Thread Kahlil Hodgson
On 9 December 2013 07:18, Kahlil Hodgson kahlil.hodg...@dealmax.com.au wrote: perl -ne -F: 'print $F[0] if $F[1] 499' Oops, missing '-a' in perl oneliner. That should be perl -ane -F: 'print $F[0] if $F[1] 499' K -- You received this message because you are subscribed to the Google

Re: [ansible-project] Looking for ideas: secure user management

2013-12-08 Thread Kahlil Hodgson
On 9 December 2013 07:22, Kahlil Hodgson kahlil.hodg...@dealmax.com.au wrote: perl -ane -F: 'print $F[0] if $F[1] 499' Arghhh! Not enough coffee. Got my index's wrong too. I should be perl -ane -F: 'print $F[0],\n if $F[2] 499' There is an open pull request for a 'capture' jinja

Re: [ansible-project] Blacklist specific hosts or groups in a role or playbook?

2013-12-06 Thread Kahlil Hodgson
Serge's suggestion is more elegant, but if you are paranoid, you can also add an early check to a task list: --- - fail: msg=Don't accidentally run this on my mailserver when: inventory_hostname == 'mailserver' - ... other tasks just in case you inadvertently include the task list without

Re: [ansible-project] group_vars best practices

2013-12-05 Thread Kahlil Hodgson
, Kahlil Hodgson kahlil.hodg...@dealmax.com.au wrote: I wonder if merging could be handled explicitly with a jinja filter, say, something like: mysql: prod_mysql | merge(default_mysql) That way the merging would be explicit and encapsulated in the playbook. Kahlil (Kal) Hodgson

Re: [ansible-project] group_vars best practices

2013-12-05 Thread Kahlil Hodgson
. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. -- IBM maintenance manual, 1925 On 6 December 2013 18:18, Kahlil Hodgson kahlil.hodg...@dealmax.com.au wrote: Er maybe? Checkout my quick implementation at https://github.com

Re: [ansible-project] install F-Secure

2013-11-28 Thread Kahlil Hodgson
Something like: - name: temporary f-secure install script copy: src=relative/path/to/local/f-secure-linux-security-9.20.2520 dest=/tmp/f-secure-linux-security-9.20.2520 - name: run f-secure installer command: /tmp/f-secure-linux-security-9.20.2520 --command-line-only --another-option

Re: [ansible-project] check if host is part of group

2013-11-27 Thread Kahlil Hodgson
Awesome tip! Much better than the quotation hell that I've been using :-) when 'frontendcluster1' in group_names K Kahlil (Kal) Hodgson GPG: C9A02289 Head of Technology (m) +61 (0) 4 2573 0382 DealMax Pty Ltd(w) +61 (0)