[ansible-project] Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?

2016-02-10 Thread Johannes Kastl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, I found some nice articles how to bootstrap FreeBSD machines with ansible, as they lack a python install by default. Seems bootstrapping pkg and installing python seems to be enough. http://lampros.chaidas.com/index.php?controller=post&a

[ansible-project] Debian/Ubuntu: Show available updates (or control if all updates are installed)

2016-02-11 Thread Johannes Kastl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, is it possible to show all available updates on Debian/Ubuntu/... via apt? Or rather, check if all updates have been installed without errors? Basically something like this (which does not work, I have not tested why): > --- > > - name

Re: [ansible-project] Re: Debian/Ubuntu: Show available updates (or control if all updates are installed)

2016-02-13 Thread Johannes Kastl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 12.02.16 schrieb Tobias Wolf: > For one thing, once my apt module pull request #2944 gets merged > you can use « --check --diff » to see the list of packages to be > upgraded. Nice to know, thanks! Johannes -BEGIN PGP SIGNATURE- Version: G

[ansible-project] Re: Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?

2016-02-17 Thread Johannes Kastl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, as I got no responses, I'll keep the full quote. No one provisioning FreeBSD machines anymore? Or is this working for everybody else, but not for me? Thanks, Johannes On 10.02.16 Johannes Kastl wrote: > Hi everyone, > >

[ansible-project] Using the version of a package that has been installed

2016-02-18 Thread Johannes Kastl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, say, we have a package, that different systems have in different versions. Depending on the version, that has been installed in the playbook previously, I would like to deploy a different version of the config files. I think this is poss

[ansible-project] Debugging an "unreachable" error when connecting to openwrt

2016-03-03 Thread Johannes Kastl
Hi all, I want to manage a machine running openwrt with ansible. First I got stuck just connecting to the machine, and I do not find the error: > ansible -m setup 192.168.11.1 > 192.168.11.1 | UNREACHABLE! => { > "changed": false, > "msg": "SSH Error: data could not be sent to the remote

Re: [ansible-project] Debugging an "unreachable" error when connecting to openwrt

2016-03-04 Thread Johannes Kastl
Hi, Am 03.03.16 schrieb Johannes Kastl: > I want to manage a machine running openwrt with ansible. First I got > stuck just connecting to the machine, and I do not find the error: [...] > Funny enough, using the raw module to call date kinda works: This seems to be related to dropb

[ansible-project] Need help with conditionals and a dict (?) or variable...

2016-03-06 Thread Johannes Kastl
Hi everyone, I need help getting a role to run. Especially the part where one host has a list of users defined, and the other host has not. In the host_vars for hostA I have this: # ssh_users: - foo - bar # The role main.yml contains: # - name

Re: [ansible-project] Need help with conditionals and a dict (?) or variable...

2016-03-06 Thread Johannes Kastl
you mean. Do you mean that my ssh_users is a list and not a dict? Dict being somewhere along the lines of: ssh_users - user1: foo - user2: bar Using 'default{()}' returns a dict, not a list, is that what you meant? > On Sun, Mar 6, 2016 at 8:23 AM, Johannes K

Re: [ansible-project] Skip reading bash profile

2016-03-06 Thread Johannes Kastl
Hi Anton, Am 04.03.16 schrieb Anton Balashov: > Is there a simple way for ansible to skip profile reading or use "/bin/bash > -i"? I am no expert on this, but what good should you prohibiting interactive logins do? Especially if you can workaround them in such an easy way? Interested, Johannes

Re: [ansible-project] Need help with conditionals and a dict (?) or variable...

2016-03-06 Thread Johannes Kastl
I'll answer myself... Am 06.03.16 schrieb Johannes Kastl: > How to run this task is ssh_users is not defined in the hostvars? > > when: "{{ ssh_users|default([X]) }} == X" For the next one searching (may be me if I forget how I did it...): - name: T

Re: [ansible-project] Group variables conditional based on OS distribution release

2016-03-07 Thread Johannes Kastl
Hi Darren, Am 07.03.16 schrieb Darren S.: > I'm still finding myself stumped on this. See my answer below. > On Mon, Feb 29, 2016 at 10:29 PM, Brian Coca wrote: >> >> yes, you need to gather facts before that variable is available, you might >> want to use |default filter to avoid the error >

Re: [ansible-project] Need help with conditionals and a dict (?) or variable...

2016-03-07 Thread Johannes Kastl
Hi Brian, Am 07.03.16 schrieb Brian Coca: >> - name: This runs if there is something ssh_users >> copy: >> src='...' >> dest='...' >> with_items: "{{ ssh_users|default([1]) }}" >> when: ssh_users is defined >> >> > > ​remove the when: it executes PER item, in the d

Re: [ansible-project] adhoc command to check all installed packets and their versions

2016-03-07 Thread Johannes Kastl
Am 07.03.16 schrieb Dimitar Ivanov: > locally I'm using "yum list installed > packs.txt" Why not use that call? ansible -m command -a "yum list installed" (I tested locally with -a "rpm -qa", which worked) Johannes -- You received this message because you are subscribed to the Google Group

Re: [ansible-project] installation failure on rhel 7.1: failed dependency: python-jinja2

2016-03-07 Thread Johannes Kastl
Am 07.03.16 schrieb Shili Yang: > Hi, > > I am trying to install Ansible on a RHEL 7.1 VM, and hitting the (last) > outstanding dependency: > > -bash-4.2# rpm -Uvh ./rpm-build/ansible-*.noarch.rpm > error: Failed dependencies: > python-jinja2 is needed by > ansible-2.0.0.2-0.git2016011

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

2016-03-09 Thread Johannes Kastl
Hi all, I think I am not the only one who is being confused by how tags on roles work: - roles: - { role: xyz, tags: 'whatever'} This does *not* call only the parts of the role that are tagged 'whatever', instead all tasks in this role are being tagged whatever and are being called. Is there

[ansible-project] Strange behaviour with a wrong conditional

2016-03-09 Thread Johannes Kastl
Evening everybody, I just noticed something strange: My playbook contains: -- vars: lxc_version: 2.0 -- In the role, that is being called in the playbook, I had the following: -- - name: debug debug: msg="When lxc_version is 1.0" when: lxc_ve

Re: [ansible-project] sudo permissions with apt module

2016-03-19 Thread Johannes Kastl
Am 19.03.16 schrieb Brian Coca: > ansible is not using those commands and will not work with restricted sudo > in that way, it needs full sudo to accomplish these tasks. Most of the work > of the apt module is using the apt-python API. So either change your permissions on the system or use the she

Re: [ansible-project] how to replace windows style line endings with linux in the replace task?

2016-03-20 Thread Johannes Kastl
Hi, Am 16.03.16 schrieb Vikram Kone: > I tried this, but doesnt seem to work > > - name: Fix line endings from CRLF to LF > local_action: replace dest={{my_dir}}/conf/{{item}} regexp='\r\n' > replace='\n' > On a unix machine (Linux, BSD, ...) I would use dos2unix or similar... Johannes --

Re: [ansible-project] Playbook issue

2016-03-24 Thread Johannes Kastl
Am 24.03.16 schrieb harold.lari...@climate.com: > *I am running a playbook that is included as part of another playbook but I > keep getting an error, can I get some help debugging it. Here is the job:* > It shows the error in the line handlers and I've tried to move it around > some to make su

Re: [ansible-project] Reading a value from a file in the host_vars folder

2016-03-24 Thread Johannes Kastl
Reply to self... Am 24.03.16 schrieb Johannes Kastl: > is it possible to read a value from a file located in the host_vars > folder, if this is not the host the play should run on? Yes, *if* the host new-host is added to the inventory before trying to get its variables. - debug: var=ho

[ansible-project] Reading a value from a file in the host_vars folder

2016-03-24 Thread Johannes Kastl
Hi all, is it possible to read a value from a file located in the host_vars folder, if this is not the host the play should run on? I am trying to convert a script creating a lxc container on host foo to an ansible playbook. But instead of calling the role with lots of variables (container name,

[ansible-project] Adding a value to a host_vars file from an ansible play

2016-03-24 Thread Johannes Kastl
Hi again, next question: Bootstrapping a new server, creating a user, setting a random password. Works like a charm. But is it possible to save the generated password in the corresponding host_vars file for the new server? Johannes -- You received this message because you are subscribed to th

Re: [ansible-project] Adding a value to a host_vars file from an ansible play

2016-03-24 Thread Johannes Kastl
Hi Nigel, Am 24.03.16 schrieb Nigel Metheringham: > I have a slightly different approach to this. I have a relatively generic > pooldata action plugin. This is used in a p Thanks for the answer. I am always interested in new things to learn, so if you drop me a line if you put the script on gith

Re: [ansible-project] Best way to manage hosts with Ansible (secutiry)

2016-03-27 Thread Johannes Kastl
Am 23.03.16 schrieb Vamberto Junior: > So in your opinion what is the best way ? I am by far not an expert on ansible security. But after reading lots and lots of docs I went for the following: - Use SSH keys with passphrase - Store passphrase in ssh-agent if needed, and delete them afterwards

Re: [ansible-project] Variable woes

2016-03-28 Thread Johannes Kastl
Am 28.03.16 schrieb Nick Walke: > Let me know if you have any suggestions. Without seeing the definition in your vars.yml people have to guess. Can you provide this file? Or the relevant definition for newrelic? Johannes -- You received this message because you are subscribed to the Google G

Re: [ansible-project] ERROR! Specified hosts options do not match any hosts

2016-03-29 Thread Johannes Kastl
Am 27.03.16 schrieb Jatin Ganhotra: > This is my first take at Ansible and I can't figure out what I am doing > wrong. I have 1 vagrant VM host with a static private IP provided for > testing purposes on my personal Mac. You mean you have a mac as controller host and a VM provided by Vagrant as

Re: [ansible-project] strange issue when using variable in shell module

2016-03-29 Thread Johannes Kastl
Am 29.03.16 schrieb Cai Elvis: > thanks for your quick replay, unfortunately, it works the same like before. >>> my playbook: >>> - role: vas >>> username: a...@eapac.abc.se Shouldn't this be like this: - role: vas vars: - username: foobar Johannes -- You received this messa

Re: [ansible-project] Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?

2016-03-29 Thread Johannes Kastl
Am 10.02.16 schrieb Johannes Kastl: > Question: > Is this a (known) regression with ansible 2.0 or earlier? All the > articles are a little bit old, maybe this has changed in the meantime? I opened issue 15191: https://github.com/ansible/ansible/issues/15191 Johannes -- You rece

Re: [ansible-project] Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?

2016-03-29 Thread Johannes Kastl
Am 29.03.16 schrieb Johannes Kastl: > Am 10.02.16 schrieb Johannes Kastl: > >> Question: >> Is this a (known) regression with ansible 2.0 or earlier? All the >> articles are a little bit old, maybe this has changed in the meantime? > > I opened issue 15191: > h

Correct quoting of arguments for raw module (was: [ansible-project] Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?)

2016-03-29 Thread Johannes Kastl
Am 29.03.16 schrieb Johannes Kastl: >> I opened issue 15191: >> https://github.com/ansible/ansible/issues/15191 > > ...and I closed the issue, as I found the problem: > > The quoted string has to be quoted again, otherwise the controller's > shell will ea

Re: [ansible-project] Ansible 2 upgrade broke roles directory lookup

2016-03-30 Thread Johannes Kastl
Am 28.03.16 schrieb Alastair Brayne: > My `sites.yml` looks like: > > - include: roles/ec2/tasks/load_ec2_group_foo.yml > > - hosts: foo > roles: > - common > - java Any reason why you are not using that like your other roles? - hosts: foo roles: - common - java - ec2

Re: [ansible-project] Re: Ansible Vault

2016-03-30 Thread Johannes Kastl
Am 30.03.16 schrieb Arbab Nazar: > just create the all directory inside the /etc/ansible/group_vars/ > and move the azureservers.yml vault.yml windows.yml winservers.yml > inside it. That complete contradicts the 'one file per group' scheme that is the basis for the group_vars folder. Just cop

Re: [ansible-project] Re: Ansible Vault

2016-03-31 Thread Johannes Kastl
Am 31.03.16 schrieb Brian Coca: > You can have multiple files on a group named dir. Of course, but I thought the files the OP mentioned were for different groups... Johannes -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe fr

[ansible-project] Re: Correct quoting of arguments for raw module

2016-03-31 Thread Johannes Kastl
On 31.03.16 at 01:04 Uditha Desilva wrote: > Quoting the "=" seems to do the trick at least in my trivial test: > > $ ansible -v -m raw -a 'env -i ABC\=blah /usr/bin/printenv' localhost > Using /etc/ansible/ansible.cfg as config file > localhost | SUCCESS | rc=0 >> > ABC=blah Interesting, I did n

[ansible-project] Re: Correct quoting of arguments for raw module

2016-04-01 Thread Johannes Kastl
On 31.03.16 01:04 Uditha Desilva wrote: > Quoting the "=" seems to do the trick at least in my trivial test: I can confirm that quoting the equal sign works. Thanks for testing! Johannes -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

Re: [ansible-project] HELP: Problem with 'become' and pbrun

2016-04-02 Thread Johannes Kastl
On 01.04.16 19:43 phillip.corch...@gmail.com wrote: > HELP - I really need to figure this out, as ansible will be mostly useless > to me unless I can reliably use it with pbrun > > $ ansible all -i myhosts -o -m shell -a 'uptime' -b --become-method pbrun It seems your pbrun executable is not f

Re: [ansible-project] Checking the return-code before continuing

2016-04-06 Thread Johannes Kastl
On 03.04.16 15:55 Herbie van Dalsen wrote: > #Supply the userid with a passwd > # > ansible gby-linux -a "echo abc123 l passwd davidl --stdin" Before you go down this road any longer, please consider using a playbook with your passwords stored in ansible-vault. In

Re: [ansible-project] AnsibleError: unable to process as utf-8

2016-04-06 Thread Johannes Kastl
On 05.04.16 13:03 Gidhin Joy wrote: > Came across this strange error while transferring a file (binary response > file) through template module. Any help on this please.. How should ansible change values in a binary file? Template module is for files, where placeholders should be replaced by var

Re: [ansible-project] Ansbile fails to connect while ssh works

2016-04-09 Thread Johannes Kastl
On 09.04.16 02:00 Jack Minardi wrote: > <192.168.2.3> ESTABLISH CONNECTION FOR USER: pi on PORT 22 TO 192.168.2.3 What happens if you use the raw module? Maybe python on the raspi got messed up: ansible - -m raw -a 'date' -u pi --ask-pass Johannes -- You received this message because you

Re: [ansible-project] Newbie: Need best practice advice on ansible used as configuration manager.

2016-04-09 Thread Johannes Kastl
On 08.04.16 19:22 Anthony P V wrote: > Similarly for templates too. Where do I store the templates for > fileserver.example.com? In your situation I would avoid having separate configuration files as much as possible. I would go for a template for e.g. smb.conf, that fits all hosts. I would gues

Re: [ansible-project] Ansible task always run

2016-04-09 Thread Johannes Kastl
On 08.04.16 06:32 G Joe wrote: > I'm looking for a way to always run a task at the end of script, even if > tasks before that were failed. Is there any option such as always_run > etc. I am not an expert, but IMHO this would mean setting "ignore_errors: true" on all tasks before the one tha

Re: [ansible-project] rpmbuild of ansible tarball results in error: line 9: Illegal char '$' in: Version: $VERSION

2016-04-09 Thread Johannes Kastl
On 08.04.16 12:38 Paul Davies wrote: > I have tried to build an RPM using rpmbuild -ta for both files > and both result in the error: line 9: Illegal char '$' in: Version: > $VERSION Looks like the macros ($VERSION) do not get filled in. Do you need to run automake or configure or similar in

Re: [ansible-project] rpmbuild of ansible tarball results in error: line 9: Illegal char '$' in: Version: $VERSION

2016-04-09 Thread Johannes Kastl
On 09.04.16 19:55 Johannes Kastl wrote: > Is there no rpm of the version you would like to have? I built a version of ansible for CentOS_7 on the opensuse buildservice, if you want to give it a try: http://download.opensuse.org/repositories/home:/ojkastl_buildservice:/CentOS_Zeug/CentO

Re: [ansible-project] Ansbile fails to connect while ssh works

2016-04-11 Thread Johannes Kastl
On 11.04.16 01:39 Jack Minardi wrote: > That seems to have worked, see the verbose output > here: http://pastebin.com/p352vFvt Can you log into your raspi and issue the following commands: which python which python2 which python2.7 dpkg -l|grep python and see what is returned? I guess either th

Re: [ansible-project] template not expanded after upgrading from 1.7 to 2.0.1.0

2016-04-11 Thread Johannes Kastl
On 11.04.16 11:22 seb.st...@gmail.com wrote: > The template in question sits in a sub directory called check_mk, and I > call it like this: > > ansible-playbook check_mk/gen_check_mk_config.yml Does calling the playbook with ansible-playbook -vvv check_mk/... return any more info what goes wr

[ansible-project] Delete files from directory: delete all files except some special ones?

2016-04-12 Thread Johannes Kastl
Hi all, excuse the subject, I'll try to explain: I can tell ansible to delete all files from a certain directory, at least I guess I can... But can I tell it to exclude certain files? I know I could use the synchronize module, which seems to be rsync in disguise. But it seems a bit ugly, to kee

Re: [ansible-project] Ansbile fails to connect while ssh works

2016-04-12 Thread Johannes Kastl
On 12.04.16 18:30 Jack Minardi wrote: > pi@raspberry:~ $ which python > > /usr/bin/python So it is installed. But maybe the PATH does not get set right? Ansible uses a non-interactive shell, so the PATH could vary between your user login via ssh and ansible's login. Look in the archives, ther

[ansible-project] Appending a variable's value to a list

2016-04-13 Thread Johannes Kastl
Hi everyone, how to add the value of a variable to a list? ### [...] vars: ansible_user: whatever somelist: - root - "{{ ansible_user }}" tasks: - name: "Print complete list" debug: msg="{{ somelist }}" - name: "Print variable ansible

Re: [ansible-project] Ansible when statements NOT WORKING when checking the ansible_os_family fact

2016-04-15 Thread Johannes Kastl
On 15.04.16 18:54 vmar...@gigware.com wrote: > - role: windows_packages > tags: windows_packages > when: ansible_os_family == "Windows" I guess you just need to use "include" instead of "role:", then the when-statement should work... Johannes -- You received this message becaus

Re: [ansible-project] Variable "role" in play is undefined

2016-04-22 Thread Johannes Kastl
On 22.04.16 16:00 Jeff Hardy wrote: > I have a static inventory setup with the hope of applying different roles > to different hosts, but am finding that this playbook is not achieving what > I would like: > > - hosts: "{{target}}" > pre_tasks: > - debug: var=role > roles: > - "{{rol

Re: [ansible-project] Re: Create exception for service on a host

2016-04-22 Thread Johannes Kastl
On 22.04.16 16:42 Pogan wrote: > I forgot to mention that idea is to do this through host variable file, and > not through playbook itself. > Set a variable called bar for this host foo in the host_vars/foo file and only execute the task, when this variable is not set: - hosts: mailservers tas

Re: [ansible-project] Utilizing timestamps within filenames

2016-04-22 Thread Johannes Kastl
On 21.04.16 17:45 Joe Louthan wrote: > Is there any chance that Ansible would be able to pick up on backticks or > is there a better way? Apart form the other answers, I avoid using backticks and use the $(date ...) syntax instead (a leading dollar sign and brackets instead of backticks). Have yo

Re: [ansible-project] Single quotes in Ansible shell module

2016-04-24 Thread Johannes Kastl
On 23.04.16 23:18 Kai Stian Olstad wrote: > This is not tested, but should work: > > ansible 'host1' -m shell -a "for database in \$(psql -l | grep '^ db' | > awk '{print \$1}'); do psql -c \"\dx \$database\"; done" When I read the OP I was not sure, if the problem are the quotes or the backsla

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Johannes Kastl
On 25.04.16 04:12 Chad Sheets wrote: > I can confirm ssh'ing into Remote-Computer and running only `sudo -H -S -n > -u root /bin/sh -c` returns the "sudo: a password is required" message. What happens when you enter your password at the prompt you get when manually calling the command? Does it w

Re: [ansible-project] block in file with loop

2016-04-25 Thread Johannes Kastl
On 25.04.16 11:24 bala krishna wrote: > I was trying to create service configuration file using above playbook but > it's been failing. Can someone guide me on this Care to tell us the exact error? "failing" can mean lots of things. Does "ansible-playbook --syntax-check yourplaybook.yml" bring

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Johannes Kastl
On 25.04.16 19:21 Chad Sheets wrote: > > My playbook was structured as follows: > I'm a little bit confused by your playbook. To me as an unexperienced user it looks like two playbooks put into the same file. Also you are mixing tasks with roles, I have no idea if this is expected to work. What

Re: [ansible-project] Is apt-get really idempotent? How does it work?

2016-04-27 Thread Johannes Kastl
On 26.04.16 17:45 Robert Glenn wrote: > My understanding would be the latter: that running the same playbook on the > original servers would leave them unchanged. This would be consistent with > the notion of idempotency, but might not be the desired 'outcome'.. >From https://docs.ansible.com/a

Re: [ansible-project] user.state

2016-04-27 Thread Johannes Kastl
On 27.04.16 17:17 Jameson wrote: > - name: list users > shell: ls /home | grep -v domain & ls /home/domain Aren't you missing a second ampersand here? Johannes -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] struggling with include files

2016-04-28 Thread Johannes Kastl
On 28.04.16 14:48 Brian Coca wrote: > directories: > - directory: "/opt/test" > - directory: "/etc" > - directory: "/xyz" I wonder that this works, with having the same 'key' called directory three times. I am not an expert but I would have guessed this should c

Re: [ansible-project] Can you override location for "cp" folder on remote hosts?

2016-04-28 Thread Johannes Kastl
On 28.04.16 20:46 Andreas Olsson wrote: > On tor, 2016-04-28 at 08:54 -0700, johhue wrote: > >> Is there a way to overrride where this "cp" directory goes? > > Put something like this in your ansible.cfg. > > [ssh_connection] > control_path = /path/to/new_cp/ansible-ssh-%%h-%%p-%%r > >

[ansible-project] Possible bug: Using file to create directories recursively does not ensure owner/group

2016-05-01 Thread Johannes Kastl
Hi all, using this snipped creates the directories foo, bar and xyz with the correct owner. - name: Create directories file: dest=/foo/bar/xyz owner=0 group=0 mode=0755 state=directory recurse=yes If a directory does exist prior to running the playbook, this directory is not touched and owner/

Re: [ansible-project] When condition

2016-05-03 Thread Johannes Kastl
On 29.04.16 12:08 'Suresh Uppu' via Ansible Project wrote: > - name: installing python setuptools > become: yes > become_method: sudo > yum: name=python-setuptools state=latest > when: ansible_os_family == "RedHat" > zypper: name=python-setuptools state=latest >

Re: [ansible-project] Using playbook to start, stop or restart a service

2016-05-03 Thread Johannes Kastl
On 01.05.16 22:49 Rick O'Shea wrote: > As near as we can tell this is the only way to automate a playbook to > start, stop, restart, enable, disable or status a service is to pass a > variable on the command line: > > ansible-playbook foo-service.yml -e state=started > > Is this best practice?

Re: [ansible-project] Multiple vars in with_nested problem

2016-05-03 Thread Johannes Kastl
On 02.05.16 20:35 Patrick Laimbock wrote: > with_nested: > - "{{ user_exists.results }}" > - "{{ mc_templates }}" Please correct me if I am mistaken, I am no expert on this. Maybe Brian can chime in. I think you are creating a list here, which has two list elements. And with_nest

Re: [ansible-project] synchronize between two remote servers: you can pull but you cannot push?

2016-05-03 Thread Johannes Kastl
On 02.05.16 16:29 Joe Louthan wrote: > I guess what I am asking is how do you rsync pushing from one remote server > to another (as oppose to pulling which I can successfully do). I would call rsync via shell/command rather than use the synchronize module. Johannes -- You received this mess

Re: [ansible-project] dictionary key as variable

2016-05-03 Thread Johannes Kastl
On 30.04.16 08:36 serkan wrote: > Thanks Matt, it works. > > On Friday, April 29, 2016 at 1:28:39 PM UTC+2, Matt Martz wrote: >> >> You cannot nest {{ }}, instead you want: >> >> {{ file[version] }} >> You might want to rename your variable (file) so it does not have the same name as a existing m

Re: [ansible-project] help with Jinja2 for loops using keys value

2016-05-03 Thread Johannes Kastl
On 28.04.16 01:04 Eric Marquez wrote: > --- > > VLAN: > > ID: 12 > I am not sure if it would be better to use lists rather than dicts (if your syntax is a dict, no expert). You have two entries called VLAN. I would use something like this: vlan_list: - id12 - id: 12 - name: "Tes

Re: [ansible-project] Ansible command to get the ethtool information

2016-05-03 Thread Johannes Kastl
On 26.04.16 01:50 Mahendra wrote: > ansible root# ansible all -m shell -a "/sbin/ethtool eth4" -s >> > I am trying to get the nic (eth0) info using ansible .. Maybe your nic is not called eth0 on all hosts? You use eth4 later on, so on some hosts this would cause trouble. Also, does ansib

Re: [ansible-project] mysql_user doesen't translate variables

2016-05-03 Thread Johannes Kastl
On 28.04.16 10:15 Florian Lüttgens wrote: > - name: Create MySQL Database User > mysql_user: name={{ item.value.projekt | lower }}_{{ item.key }}_{{ > stage }} password={{ item.value.password }} host=localhost login_host={{ > ansible.fqdn }} priv=*.*:ALL state=present > with_dict

Re: [ansible-project] Understanding group vars

2016-05-03 Thread Johannes Kastl
On 28.04.16 17:44 Shua Talansky wrote: > ├── prod > │ ├── selenium_hub > │ │ └── vars.yml > I get variables that are defined under prod website - what am I doing wrong? I thought host-specific variables are in a directory called host_vars (or host_vars/foobar for the host foobar), while gr

Re: [ansible-project] No config file found; using defaults

2016-05-03 Thread Johannes Kastl
On 21.04.16 17:09 skinnedknuckles wrote: > *No config file found; using defaults* AFAIK this means there is no ansible.cfg, which is not an error, just an information > *ERROR! Syntax Error while loading YAML* In your mail the yaml file had no line breaks, maybe there a windows unix linebreak i

Re: [ansible-project] Dynamic Group Var Name

2016-05-03 Thread Johannes Kastl
On 26.04.16 23:22 Chanaka Samarajeewa wrote: > with_dict: "rdsusers{{ env }}" > > FAILED! => {"failed": true, "msg": "ERROR! with_dict expects a dict"} Maybe because your rdsusers{{ env }} is a list and not a dict? Does with_items work in your case? Johannes -- You received this message beca

Re: [ansible-project] custom facts with non-root account

2016-05-03 Thread Johannes Kastl
On 18.04.16 16:44 Uwe Bartels wrote: > I'd like to gather information via facts, because the "PLAY RECAP" shows > "changed=xx", but I'm only collecting information and don't change, when > everything is fine. Apart from calling setup, like Matt suggested, one idead is to use changed_when to des

Re: [ansible-project] map extract not working?

2016-05-03 Thread Johannes Kastl
On 26.04.16 03:56 Arthur Tsang wrote: > An exception occurred during task execution. To see the full traceback, use > -vvv. The error was: TemplateRuntimeError: no filter named 'extract' I would say your syntax is wrong. Apparently ansible does not know your filter called extract. Johannes --

Re: [ansible-project] Escalation Prompt Timeout?

2016-05-03 Thread Johannes Kastl
On 26.04.16 19:52 Tennis Smith wrote: > I'm getting "Timeout (12s) waiting for privilege escalation prompt" > errors. Can the escalation timeout value be changed somewhere? Each time I have seen this error, waiting for minutes would not have solved the issue, as there should not be a prompt at

Re: [ansible-project] Settings for ansible_shell_type in inventory file not work

2016-05-03 Thread Johannes Kastl
On 21.04.16 11:02 WD Wang wrote: > $ ansible -i dev -m synchronize -a "src=node_modules/ ^^^ Is this just a typo in your mail? Before you use '... -i hosts ...', maybe this leads to your error? Johannes -- You received this message because you are subscribed to the Google Grou

[ansible-project] Register variables in tasks that use with_items?

2016-05-03 Thread Johannes Kastl
Hi all, say I want to create a file for two users. I create a list containing the users and create a task with a loop using with_items: userlist: - foo - bar To avoid trouble I want to check if the target folder exists and fail if it does not. How to get this working? - name: "Check if fol

[ansible-project] What's the state on roles and with_items?

2016-05-03 Thread Johannes Kastl
Hi all, apparently roles allowed using with_items some time ago: https://github.com/ansible/ansible/issues/12623 https://github.com/ansible/ansible-examples/blob/master/language_features/roletest2.yml I read 2.1 will bring this feature back, but I only found examples using includes. https://docs

Re: [ansible-project] Restart network interfaces

2016-05-05 Thread Johannes Kastl
On 05.05.16 15:52 Carl Wainwright wrote: > The starting IP is 10.157.5.100, and the changed IP is 10.157.6.100. Maybe you can get some tricks from here: https://dmsimard.com/2016/03/15/changing-the-ssh-port-with-ansible This is about changing the ssh port via ansible, but the problem is similar

Re: [ansible-project] Can Ansible pause on errors, allowing user to intervene, then proceed?

2016-05-06 Thread Johannes Kastl
On 05.05.16 23:36 Neil Hooey wrote: > When initially trying to get an elaborate playbook to work, it's very > costly to repeat the process when a single task fails. > Are using `retry` files the right way to do this, or is there another way? --start-at-task https://docs.ansible.com/ansible/pla

Re: [ansible-project] urgent, please help: any way to get ansible to work over an unstable connection?

2016-05-06 Thread Johannes Kastl
On 05.05.16 08:21 nrser wrote: > i can hold an ssh terminal open with the server no problem... what's going > on here? is ansible creating a new connection for every task? can i make it > just hold one connection open and use that? can i make it retry a few times > if it can't connect? Just an

Re: [ansible-project] Obscure error message in Unicode-related jinja2 template fail

2016-05-06 Thread Johannes Kastl
On 15.04.16 22:57 Alan Orth wrote: > [WARNING]: Failure when attempting to use callback plugin > (): > 'ascii' codec can't > decode byte 0xc2 in position 9200: ordinal not in range(128) > > I spent quite a bit of time trying to figure out what character was at > position 9200, until I noticed

Re: [ansible-project] Line appending failing

2016-05-06 Thread Johannes Kastl
On 05.05.16 19:29 amritha sanath wrote: > - name: copy datadog agent configuration file > lineinfile: dest=/etc/dd-agent/datadog.conf regexp="^dogstreams: " > line="dogstreams: > /root/ddmonitor/pattern.txt:/opt/datadog-agent/agent/checks/libs/parsers.py:parse_web" What happens if you use a d

Re: [ansible-project] Apt packages

2016-05-06 Thread Johannes Kastl
On 06.05.16 10:56 deor...@miranetworks.net wrote: > Hi, > > Is it possible to pass list of packages with --extra-vars that needs to be > installed with apt? I don't want to update the playbook everytime with list > of package. Currently I can pass one package and it installed fine. Use somethin

Re: [ansible-project] Apt packages

2016-05-06 Thread Johannes Kastl
On 06.05.16 11:13 deor...@miranetworks.net wrote: > Tried that and does not work. > > Apt sees it as "apt-get install [foo,bar]" instead of "apt-get install foo > bar" Damn, I get the list thing wrong each time.. https://docs.ansible.com/ansible/YAMLSyntax.html fruits: ['Apple', 'Orange', 'Stra

Re: [ansible-project] multiple elements from list

2016-05-06 Thread Johannes Kastl
On 06.05.16 13:12 deor...@miranetworks.net wrote: > Hi, > > It is possible to select all the elements instead of specify one element? > > Working: > debug: msg="{{packages.results[0].stdout_lines}}" > > I've tried: > debug: msg="{{packages.results[].stdout_lines}}" - It returns 'list object >

Re: [ansible-project] /etc not writable

2016-05-06 Thread Johannes Kastl
On 06.05.16 14:46 Sanjay Kumar wrote: > Hi, > > I am not able copy to remote host, getting not writable error, my playbook > is here. >copy: src=/home/sanjay/messages dest=/etc I am not sure if the copy module is as picky as rsync in regard to trailing slashes. ...dest=/etc/ Maybe us

Re: [ansible-project] get_service_mgr_facts error

2016-05-08 Thread Johannes Kastl
On 08.05.16 17:58 Francisco Reyes wrote: > \"/tmp/ansible_qm7eFt/ansible_modlib.zip/ansible/module_utils/facts.py\", > line 357, in get_service_mgr_facts\r\nKeyError: 'distribution'\r\n", "msg": > "MODULE FAILURE", "parsed": false} Does a FreeBSD machine provide a 'distribution' variable in its

Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Johannes Kastl
On 08.05.16 21:37 Kacper Patro wrote: > Hi Tim, > > I had similar issue with VirtualBox repo. In my case, removing line > *repo_gpgcheck=1* from repo file (i.e. el-passenger.repo) helped. DONT! You lose all security provided by gpg signatures of the packages. (Sorry for the yelling... ;-)) I w

Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Johannes Kastl
On 09.05.16 17:29 Tim Griffin wrote: > Ah, okay. Good point, Johannes. > > And, on RHEL, turning of the GPG check wouldn't be a good plan anyways! On CentOS-machines I use this snippet to install the epel-release package and import the rpm-key: - name: CentOS - install epel-release yum: name=e

Re: [ansible-project] how to generate an iterable on with_items with the attributes of a group's members ??

2016-05-13 Thread Johannes Kastl
On 13.05.16 21:35 Alejandro Comisario wrote: > with_items: > > - groups['haproxy'] > > - hostvars.groups.haproxy['ansible_fqdn'] I think I read that joining two lists (thats what they are) is done using a plus sign: with_items: groups['haproxy'] + groups['foobar'] In your case you

Re: [ansible-project] chown failed

2016-05-13 Thread Johannes Kastl
On 13.05.16 17:45 MangusB rother wrote: > name: Test > hosts: "{{GLB_ansible_tower_machine}}" > remote_user: "{{GLB_remote_user}}" > become: yes > become_user: "{{GLB_remote_user}}" Normally you want to elevate your rights to root, so this should be "become_user: root". Now you elevate to

Re: [ansible-project] How do I continue a handler task on failure?

2016-05-13 Thread Johannes Kastl
On 12.05.16 15:55 Gilberto Valentin wrote: > register: result > failed_when: "'Can't drop database' in result.stdout" Do not use a sinqle quote in there. Then your conditional could make sense. I do not know if it works, though. Johannes -- You received this message b

Re: [ansible-project] Template replacement

2016-05-13 Thread Johannes Kastl
On 13.05.16 03:43 Pushparaj BS wrote: > How can tell Ansible ignore extra changes on the file from webserver > deployment persoective, but still get changes from template if anything extra > added in ansible source Do not use the template module, as it changes the whole file. If you just have

Re: [ansible-project] Install SW across different distributions

2016-05-13 Thread Johannes Kastl
On 18.04.16 17:02 Riccardo Murri wrote: > Are there better / more clever solutions out there? Or is such a list > of corresponding packages already available and maintained? I manually created groups after OS, so I have one group centos which contains all the centos machines. One with freebsd an

Re: [ansible-project] Re: group_vars values overriden for repeating servers

2016-05-13 Thread Johannes Kastl
On 12.05.16 22:39 Dejay Clayton wrote: > How are you invoking the playbook? Just because a host is in two groups, > doesn't mean it will execute the logic for both groups. The problem is that the list called firewallports gets overwritten by whatever vars file is processed last. For example,

Re: [ansible-project] All host unreachable

2016-05-14 Thread Johannes Kastl
On 13.05.16 23:27 Max León wrote: >> ControlPath=/home/mleon/.ansible/cp/ansible-ssh-%h-%p-%r admin '/bin/sh -c What happens if you add this to your ansible.cfg? [ssh_connection] control_path = %(directory)s/%%C Maybe your control_path gets to long (being set to ansible-ssh-%h-%p-%r) and thus

Re: [ansible-project] Need help with Ansible Notify module: Handlers are not invoked even if template target file changes

2016-05-14 Thread Johannes Kastl
On 13.05.16 23:34 Srikanth Vavilapalli wrote: > Could any one help me with this issue and how I can troubleshoot what is > going wrong here? Plz let me know if you need more details. Go to your target host, move the file to monitoring-channel-1_ceilometer_proxy_config.TEST and rerun your playboo

Re: [ansible-project] Re: Return variables on task includes not working anymore

2016-05-14 Thread Johannes Kastl
On 12.05.16 22:07 Dejay Clayton wrote: > Are you intending "root_list" and "tmp_list" to be expanded into "{{ > root_list }}" and "{{ tmp_list }}" (by nature of the substitution into > "list"?) If I understood him correct he wants to store the results in a variable, whose name is not fixed but r

  1   2   3   4   >