Re: [ansible-project] template backups in conf.d style locations

2014-10-14 Thread Adam Heath
Shouldn't such programs have a filter exclude setting? dpkg and rpm will both place temp files into .d style folders, while installing a package. I can't speak as to what temp extension rpm uses, but dpkg will create a $file.dpkg-new or $file.dpkg-old in such a folder. Plus, vim creates

Re: [ansible-project] No color when running ansible SSH as an argument

2014-10-14 Thread Adam Heath
Use ssh -t On 10/14/2014 12:55 PM, Kevin Burton wrote: If I ssh into a box , interactively, then run ansible, I get color, without any issue. However, if I run it as a batch command, like: ssh rele...@myserver.com ansible-playbook ... Then it doesn't have color. The TERM is setup

Re: [ansible-project] Re: Unable to figure out arrays

2014-10-10 Thread Adam Heath
- name: foo shell: echo {{ users[item].name }} with_items: - alice - bob On 10/10/2014 01:59 AM, Michael Bushey wrote: Thanks for your response Michael. I've already read through that page a few times. It does not work for me because I need an array of users, and then I need to be

Re: [ansible-project] is it possible to maintain order within with_ loops?

2014-10-03 Thread Adam Heath
Untested, but maybe this: == - shell: {{ base_dir }} {{ item }} with_items: deploy_env.keys() | sort == And then be sure to name your keys so they sort the way you need. On 10/03/2014 12:39 PM, Guy Matz wrote: not sure what you mean . . . my data comes from json that looks like this:

Re: [ansible-project] apt module doesn't install module with a 'when' condition

2014-10-02 Thread Adam Heath
This is a total hack, but cute when used: == tasks: - name: foo set_fact: items: {{ items.remove('something') and items or items }} == This handles the case of remove() returning true or false, depending on the implementation language returning nothing, true when the list was

Re: [ansible-project] Totally Stuck...

2014-09-29 Thread Adam Heath
You can't call sudo from the shell module. The play would normal be like this: tasks: - name: foo sudo: true sudo_user: root file: state=directory dest=/tcp/core On 09/29/2014 02:56 PM, Tiglath wrote: Thank you for your reply. I did not explain myself too well.

Re: [ansible-project] Re: IMPORTANT HEADS UP: If running from devel branch, now using submodules

2014-09-29 Thread Adam Heath
Bother. I saw those emails(one request, 2 emails). However, I was rather surprised that my 6026 pull request hadn't yet been merged. I thought it would have been rather simple. It's been over 6 months, with no updates at all, and suddenly this is closed. How do I know if I go and do even

Re: [ansible-project] Progress bars

2014-09-05 Thread Adam Heath
Something like Play (7 of 12) Task (4 of 15). There's no way to have any kind of time estimate, but a simple X of Y count seems useful. On 09/05/2014 04:52 PM, Jason Harris wrote: On Friday, September 5, 2014 8:56:13 PM UTC+2, Michael DeHaan wrote: Thanks, I've locked the topic to save

Re: [ansible-project] recursively create symlinks with relative paths

2014-08-05 Thread Adam Heath
On debian, I could install the program 'symlinks'. I don't know if it is available elsewhere. It might be able to help. On 08/05/2014 12:05 PM, Dan Vaida wrote: Hello guys, I am trying to get my head around parsing a folder for its files and creating symlinks for those files found (depth

Re: [ansible-project] with_items and array concatenation?

2014-06-04 Thread Adam Heath
On 06/04/2014 04:47 PM, Dmitry Makovey wrote: with_items: groups[A] ansible uses jinga2. Look up that syntax. Then, off the top of my head, may not be exactly right, but: groups[A].concat(groups[B]) | set | list Some of that is python syntax(the contact, check jinga2 and python docs),

Re: [ansible-project] Users - passwords - not getting it

2014-05-28 Thread Adam Heath
On 05/28/2014 11:32 AM, Brian Dunbar wrote: mkpasswd --method=SHA-512 That runs mkpasswd with stdin unattached. If you run it manually, you'll see it prompting for a password. If you run it multiple times, and keep hitting enter(simulating a disconnected stdin), then you'll get different

Re: [ansible-project] Run a command on just 1 server (like pause)

2014-05-14 Thread Adam Heath
By default, ansible looks for tasks in $PWD. tasks are sent to the remote host, and don't run local. If you create ansible.cfg in $PWD, and override defaults.library, then you can have local modules; these run on the local machine. The following works when ansible is installed thru a

Re: [ansible-project] Run a command on just 1 server (like pause)

2014-05-14 Thread Adam Heath
question above I think?) On Wed, May 14, 2014 at 5:21 PM, Adam Heath a...@brainfood.com mailto:a...@brainfood.com wrote: By default, ansible looks for tasks in $PWD. tasks are sent to the remote host, and don't run local. If you create ansible.cfg in $PWD, and override defaults.library

Re: [ansible-project] apt returns: No package matching... but apt-get install on managed host works

2014-04-11 Thread Adam Heath
Multi-arch? Aka, this is a 64-bit machine, but that package is only available on i386, and the idempotent ansible apt module isn't capable of dealing with that? On 04/11/2014 01:21 PM, Todd Sampson wrote: I'm fairly new to Ansible. I really like it but can't get past this show stopper. If

Re: [ansible-project] apt returns: No package matching... but apt-get install on managed host works

2014-04-11 Thread Adam Heath
and now it works. Thanks for taking the time to help! Todd On Fri, Apr 11, 2014 at 4:37 PM, Adam Heath a...@brainfood.com mailto:a...@brainfood.com wrote: Multi-arch? Aka, this is a 64-bit machine, but that package is only available on i386, and the idempotent ansible apt module isn't

Re: [ansible-project] Firewall Module?

2014-03-04 Thread Adam Heath
There are too many ways of maintaining a firewall, across all types of admins, OS, etc. However, I make use of a firewall role, I set ports when I attach it to a host, and then, I made an executive decision that the 'app' I'm configuring will use a particular type of firewall software.

Re: [ansible-project] Specify host for a playbook task

2014-03-03 Thread Adam Heath
delegate_to: On 03/03/2014 02:51 PM, Michael Mahemoff wrote: Is there any way to override the current host for a given task? I want to set up a recurring database copy, so I need to run some commands within a playbook (all of which apply only if a variable is turned on at the command-line).

Re: [ansible-project] Re: YUM: Much slower in ansible than on the cli

2014-02-27 Thread Adam Heath
For yum, I disable fastestmirror, set hard-coded repo sites, then configure an http_proxy. For apt, I set hard-coded repo sites, then configure an http_proxy. This seems much lighter weight then cloning an entire OS distribution, when most packages aren't going to be installed anyways. ps:

Re: [ansible-project] Re: YUM: Much slower in ansible than on the cli

2014-02-27 Thread Adam Heath
Sure, but it's easier in debian, as snapshot/backports are also mirrored. On 02/27/2014 12:17 PM, Michael DeHaan wrote: Was talking about yum. -- You received this message because you are subscribed to the Google Groups Ansible Project group. To unsubscribe from this group and stop receiving

Re: [ansible-project] Resolve nested variable in template

2014-02-19 Thread Adam Heath
On 02/19/2014 10:11 AM, Serge van Ginderachter wrote: On 19 February 2014 15:03, Khuong Dinh Pham khuon...@gmail.com mailto:khuon...@gmail.com wrote: Vars: environements: [trunk, dev01] my_trunk_port: 8080 my_dev01_port: 8180 Template: {{ my_{{ env }}_port }} ​try

Re: [ansible-project] Re: Resolve nested variable in template

2014-02-19 Thread Adam Heath
vars: port_vars: my_trunk_port: 8080 my_dev01_port: 8180 my_dev02_port: 8280 my_dev03_port: 8480 - set_fact: my_ports: {} - pause: seconds=0 when: (my_ports[item[0].substring(3).substring(0,len(item[0]) - 3)] = item[1]) and false or false with_items: port_vars.items() -

Re: [ansible-project] Custom item output

2014-02-12 Thread Adam Heath
I find this annoying too. +1 on my vote. On 02/12/2014 12:55 PM, Rumen Telbizov wrote: Hello ansible list, Here's a quick question that I was trying to find an answer for. Maybe I am missing the obvious but I can't find a way to control the output of the item variable during a loop

Re: [ansible-project] ERROR: AsciiDoc 'a2x' command is not installed but is required to build

2014-02-05 Thread Adam Heath
root@urk:~# apt-file search bin/a2x asciidoc: /usr/bin/a2x And yum search asciidoc comes up with results. Does rpm.spec have a way to list a series of build dependencies? I'm a Debian guy, and that would be done thru debian/control:Build-Depends On 02/05/2014 11:28 AM, Yuri Lukyanov wrote:

Re: [ansible-project] ERROR: AsciiDoc 'a2x' command is not installed but is required to build

2014-02-05 Thread Adam Heath
On 02/05/2014 12:30 PM, Michael DeHaan wrote: Asciidoc produces no results on what platform? Confused by your apt-file command above. == apt-get install apt-file apt-file update == This will download the Contents-$arch.gz files from your debian mirror, then build an index of file-package

Re: [ansible-project] ERROR: AsciiDoc 'a2x' command is not installed but is required to build

2014-02-05 Thread Adam Heath
On 02/05/2014 12:31 PM, C. Morgan Hamill wrote: Excerpts from Adam Heath's message of 2014-02-05 13:24:48 -0500: root@urk:~# apt-file search bin/a2x asciidoc: /usr/bin/a2x And yum search asciidoc comes up with results. Does rpm.spec have a way to list a series of build dependencies? I'm a

Re: [ansible-project] Configuring Ansible to run play books through a bastion host on aws/ec2

2014-02-05 Thread Adam Heath
I've had musings on that too. Currently, I think you'd have to manually configure $HOME/.ssh/config, with ProxyCommand. However, I just had a thought. What if there was an ansible_ssh_proxy=$other_inventory_host feature? When set, ansible would auto-add the -o ProxyCommand=$something.

Re: [ansible-project] Configuring Ansible to run play books through a bastion host on aws/ec2

2014-02-05 Thread Adam Heath
for those two files? Seems like it might cause some confusion. On 02/05/2014 01:51 PM, Adam Heath wrote: I've had musings on that too. Currently, I think you'd have to manually configure $HOME/.ssh/config, with ProxyCommand. However, I just had a thought. What if there was an ansible_ssh_proxy

Re: [ansible-project] Configuring Ansible to run play books through a bastion host on aws/ec2

2014-02-05 Thread Adam Heath
On 02/05/2014 02:31 PM, Matt Martz wrote: I use bastions for nearly all of my communication with servers. It is all done via my ~/.ssh/config file. Something like: Host bastion User myuser HostName bastion.example.org ProxyCommand none

Re: [ansible-project] Conditionals - when: var1 and var2 is defined works in a weird way

2014-02-03 Thread Adam Heath
false != false. You have a string/boolean issue. Aka, the var1 is not the boolean value false, but the string value false. On 02/03/2014 06:32 PM, Roman Revyakin wrote: Hi, I am not sure whether someone has come across this issue previously - trying to search the group for 'when' and 'is

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

2014-01-31 Thread Adam Heath
I've been using variants of dict.keys(), dict.values(), and dict.items() when utilizing with_items iteration. On 01/31/2014 09:07 AM, Guillem Liarte wrote: This works however: ## --- - hosts: moscatell tasks: - debug: msg={{ project[item] }} with_items: project_list -- You

Re: [ansible-project] register variable being truncated

2014-01-31 Thread Adam Heath
debug: msg={{ commit error }} On 01/31/2014 11:55 AM, David Gethings wrote: Hi, I am working with a custom module. Sometimes it returns an error that I want to capture and then act on in another task. I have a register set and ignore_errors set to True in the playbook. However the msg returned

Re: [ansible-project] roles with pre_tasks and post_task

2014-01-30 Thread Adam Heath
Oh, oops, my bad, I wasn't aware there was a -dev list. On 01/30/2014 04:40 PM, Paul Durivage wrote: Hi Adam, I suggest taking this to the developer list for further discussion. Features and ideas are regularly discussed there with the Ansible team.

[ansible-project] roles with pre_tasks and post_task

2014-01-29 Thread Adam Heath
I have a patch locally that enables pre and post processing for roles. The directory names are pre_tasks and post_tasks, of course. The flow is: - hosts: targets roles: - role-1 - role-2 pre_tasks: - name: one tasks: - name: two post_tasks: - name: three and evaluates

Re: [ansible-project] Not detecting whether variable for 'user' is setup.

2014-01-28 Thread Adam Heath
It's remote_user, which I think changed in 1.4. I just remember seeing that in the docs yesterday. On 01/28/2014 10:54 AM, Marcin Prączko wrote: Hi, Accually I think is still not working as expected: [vagrant@devopsadmin dir01]$ ansible --version ansible 1.4.3 Playbook: - name: Common |

Re: [ansible-project] git module now has sshopts and keyfile parameters

2014-01-24 Thread Adam Heath
On 01/23/2014 09:37 PM, James Tanner wrote: On 01/23/2014 08:46 PM, a...@brainfood.com wrote: The accept_hostkey fails if $HOME/.ssh doesn't already exist. -- You received this message because you are subscribed to the Google Groups Ansible Project group. To unsubscribe from this group and

Re: [ansible-project] Re: ansible now supports su as an alternative to sudo

2014-01-24 Thread Adam Heath
The following playbook doesn't do what I think it should. The su on the task stays as root. I was asked to file a bug; I could still do so. But if you think you have a handle on it, then it might just be better to past this here. cmd: ansible-playbook -i hosts.txt su-for-task-broken.yml

Re: [ansible-project] git module now has sshopts and keyfile parameters

2014-01-24 Thread Adam Heath
As for tests, I have a complete test system for the internal backup tool I've written and used at $work. I basically start up a user-mode-linux instance, then mount hostfs and overlayfs, so that I can run things as root, it has no outbound network, I then start up a dummy sshd, create a dummy