[ansible-project] Ansible 2.3.1 adding 'rounds=65600' to password in /etc/shadow

2017-06-22 Thread Johannes Kastl
Hi everyone, I just ran into a timeout when executing my unchanged playbook against my raspi (raspi2 with debian), that I had not run on this host since ansible 2.2 at least. It seems ansible (or the python hash library or whoever) is adding a rounds=656000 to the password in /etc/shadow, which

Re: [ansible-project] How to iterate over hash of arrays

2017-02-13 Thread Johannes Kastl
On 11.02.17 16:14 Dhaval Joshi wrote: > Hello, > > I have below strucure. > > vars: > locations: > - parent_location: A > child_location: > - a1 > - a2 > - a3 > - parent_location: B >child_location: > - b1 > - b2 > - b3 > - parent_location: C >

Re: [ansible-project] Using variable in JSON

2017-02-13 Thread Johannes Kastl
On 11.02.17 20:10 Alok Ranjan wrote: > I have a command where I am passing JSON as an argument but their > is something going wrong. It's easier for people to help if you show actual error messages, playbook snippets and such. Johannes -- You received this message because you are subscribed

Re: [ansible-project] Software Management Cross Distribution

2017-02-13 Thread Johannes Kastl
On 12.02.17 23:39 J wrote: > has any one generated a "Master" module to install software ? > I want to have a software installed in a mixed environment > (Ubuntu Arch FreeBSD ... ) > and I would prefer not having to copy paste for a role-$DISTRO > configuration, if anyone has already solved my

Re: [ansible-project] cross-role notifications

2017-02-12 Thread Johannes Kastl
On 12.02.17 18:47 Michael Ströder wrote: > But then a role has to know the handler names in the other role > which somewhats contradicts the concept of modular design. AFAIK the role design is built so you could reuse roles in more than one place. E.g. create a role that just installs nginx, and

Re: [ansible-project] How to control access with sudo and FreeIPA

2017-02-10 Thread Johannes Kastl
On 10.02.17 04:33 Brian Coca wrote: > Ansible itself does not have this built in, though there are many > ways to enforce this using other tools to execute it. Out of interest, which are those? Johannes -- You received this message because you are subscribed to the Google Groups "Ansible

Re: [ansible-project] Provision Issue with simultaneous request

2017-02-09 Thread Johannes Kastl
On 08.02.17 08:29 Gautam Banerjee wrote: > Hi, > > I am provisioning multiple applications with one request through > docker with ansible. It runs fine with one request. When I am > giving two simultaneous request the ansible processing is quitting > suddenly and looks like a timeout. Can you

Re: [ansible-project] Re: Output Failed even if command gets executed successfully

2017-02-09 Thread Johannes Kastl
On 09.02.17 19:36 DHAVAL JAISWAL wrote: > I want to use the failed_when in following ad-hoc command to ignore > the error. Is there any other alternative can be handle in ad hoc > command. > > /usr/bin/ansible node1 -a "grep 'value1' /tmp/test.log" As nobody came up with a solution, I would

Re: [ansible-project] Without sudo, is it possible to manage multiple become users with distinct passwords?

2017-02-09 Thread Johannes Kastl
On 08.02.17 05:10 ednoto...@gmail.com wrote: > - hosts: localhost > tasks: > - command: whoami > register: who_is_user1 > become: true > become_user: user1 I think you could set a become_password at this point. become_password: foobar Instead of using cleartext it might be better

Re: [ansible-project] How to create an unprivileged user and intialize its GPG config?

2017-02-09 Thread Johannes Kastl
On 09.02.17 18:07 Gabriel Birke wrote: > - name: Import public key > shell: gpg --import /home/{{ backup_user}}/some_public_key.asc > chdir: /home/{{ backup_user}}/ > become: yes > become_user: "{{ backup_user }}" Instead of becoming this user, can you already log in as this user at this

Re: [ansible-project] How to select hosts based on the last connection time?

2017-02-09 Thread Johannes Kastl
On 09.02.17 14:00 Cev Ing wrote: > Background: I have a playbook and I use it on my hosts. Then I > change it. The change affects about half of the hosts. But the > change was erroneous. Next I correct the playbook. And now I would > like to run the playbook on those hosts changed by the last

Re: [ansible-project] Infrastructure inventories and custom software

2017-02-08 Thread Johannes Kastl
On 09.02.17 07:26 Sonny Heer wrote: > Hi all, > > Assume a production/staging/dev multistage environment project > using ansible best practices layout. Another custom project A in a > separate git repo. Is this "custom project" another ansible project? Then linking the files could be an

Re: [ansible-project] Ansible and CVS integration

2017-02-08 Thread Johannes Kastl
On 06.02.17 16:41 vu001 wrote: > I've created set of templates which I use to deploy some > application config files (between 20-30 files, depends on > environment) to all my servers (about 100 servers). OK. > So after I deploy that config file, I would like to commit it to > CVS. I'm sorry,

Re: [ansible-project] Bitten by the command line options

2017-02-08 Thread Johannes Kastl
Hi Brian, On 08.02.17 17:49 Brian Coca wrote: > One final clarification, you CAN override the inventory from the > command line, but not via the specific switches, through > extra-vars > > ansible -e 'ansible_user=xyz' ... I think this bit is missing in the docs. Or rather, many people might

[ansible-project] Solved! (was: How to use set_fact to set a hostvar?)

2017-02-08 Thread Johannes Kastl
On 08.02.17 16:05 Johannes Kastl wrote: > On 08.02.17 15:49 Kai Stian Olstad wrote: > >> Have you tried setting "delegate_facts: true"? It might work on >> set_fact to. > > I haven't, but I will give it a try. I was not sure if this was > applicable to a

Re: [ansible-project] Re: How to use set_fact to set a hostvar?

2017-02-08 Thread Johannes Kastl
Hi Kai, On 08.02.17 15:49 Kai Stian Olstad wrote: > Have you tried setting "delegate_facts: true"? > It might work on set_fact to. I haven't, but I will give it a try. I was not sure if this was applicable to a task not gathering facts, but setting them. I'll try. Thanks for your help!

How to use set_fact to set a hostvar? (was: [ansible-project] When does ansible refresh the variables from the host_vars directory?)

2017-02-08 Thread Johannes Kastl
Hi guys, On 07.02.17 22:19 Johannes Kastl wrote: > Yeah, I just found out, too. But now I have to see how to set a > variable for a host, that can not be reached at this point in time. > Delegate_to with set_fact? I'll try... I can't get the syntax right for setting a hostvar with

Re: [ansible-project] default for undefined dict

2017-02-08 Thread Johannes Kastl
On 08.02.17 11:29 adrien nayrat wrote: > instances: > - name: ref > mgservices: > name: test1 > pgservice : {{ instance.mgservices.name | > "AnsibleUndefinedVariable: 'dict object' has no attribute 'mgservices'"} Just a guess: Your problem is not the default, but rather how you

Re: [ansible-project] Parsing and Comparing a text file

2017-02-08 Thread Johannes Kastl
On 08.02.17 07:01 Mona Gopal wrote: > A text file with configuration contents would be given to us by the > product teams. I will have to compare this file against the one on > the remote host , find out the difference, and replace values for > the variables where it doesn't match. How is this

Re: [ansible-project] postgresql_user module help

2017-02-08 Thread Johannes Kastl
On 07.02.17 23:46 Shyam Yenna wrote: > I am getting below error while trying to use module > postgresql_user. I want to create a new user account in postgresql. > but i am unable to create user account with become_user postgres or > commenting that line is Addition to my first mail: As ansible

Re: [ansible-project] postgresql_user module help

2017-02-08 Thread Johannes Kastl
On 07.02.17 23:46 Shyam Yenna wrote: > - name: Configure Database server ami instance > hosts: database > gather_facts: true > become: true > become_method: sudo What happens if you put the become_user statement into this block instead of into the user.yml file?

Re: [ansible-project] Re: when condition on a variable starting with a string value

2017-02-08 Thread Johannes Kastl
On 07.02.17 17:07 fanvalt wrote: > Thanks a lot Marko, I used your syntax: > dual|regex_replace('^SRV(.*)', 'True') Did you try the following? > No need to use regex for pattern searching. You can use search like > this: > > when: name_prefix | search("stage-dbs") from

Re: [ansible-project] When does ansible refresh the variables from the host_vars directory?

2017-02-07 Thread Johannes Kastl
Good Evening Kai, On 07.02.17 22:02 Kai Stian Olstad wrote: > With set_fact the facts is available for all subsequent plays in a > playbook, it only get lost after the playbook is finished. Yeah, I just found out, too. But now I have to see how to set a variable for a host, that can not be

[ansible-project] When does ansible refresh the variables from the host_vars directory?

2017-02-07 Thread Johannes Kastl
Hi all, I have a play that adds a line to a file in the host_vars directory on the host running the play. I have a very sporadic error, that the contents of the file are not being re-read afterwards. I'll explain with a mock-up playbook containing three plays: - hosts: foo gather_facts: true

Re: [ansible-project] SSH to literal IPv6 address

2017-02-07 Thread Johannes Kastl
On 07.02.17 13:13 Dick Visser wrote: >> This should be valid ssh syntax, at least I have some of those in >> my config or known_hosts. > It doesn't work here: Sorry, my mistake, those were not in Hostname declarations. I do not have a ipv6 host handy, so I can't test... Johannes -- You

Re: [ansible-project] SSH fine but keep getting errors running test playbook

2017-02-07 Thread Johannes Kastl
On 06.02.17 21:03 Shiyan Cao wrote: > Does anyone know why I'm getting the error? SSH connection is > working fine. > fatal: [xx]: FAILED! => {"failed": true, "msg": "failed to > resolve remote temporary directory from > ansible-tmp-1486411214.9-201171589973071: `mkdir -p \"` echo >

Re: [ansible-project] Obtain the user specified via '-u' cli option

2017-02-07 Thread Johannes Kastl
On 06.02.17 22:04 Michael Spiegle wrote: > At some point in Ansible 2.0.x, the '{{ansible_user}}' variable > would reflect the argument passed to ansible-playbook '-u'. It > doesn't appear to be doing this any more, and I can't seem to find > a way to obtain the value that was passed into '-u'.

Re: [ansible-project] WHEN CONDITION

2017-02-07 Thread Johannes Kastl
On 06.02.17 20:00 DHAVAL JAISWAL wrote: > Tried below one. However, when condition is not correctly evaluating. Please show the exact error message. Or the exact output, maybe with -v. > tasks: >- name: Get the state of the Test version > shell: alert1=`cat /tmp/test.log | grep -e

Re: [ansible-project] Error while setting lamp infrastrcture.

2017-02-07 Thread Johannes Kastl
On 06.02.17 17:01 Milind Sisodiya wrote: >> ERROR! Syntax Error while loading YAML. >> >> >> The error appears to have been in '/etc/ansible/lamp- > infrastructure/provisioners/aws.yml': line 97, column 8, but may What is in this yml-file? The error can be in line 97, but not necessarily. If

Re: [ansible-project] SSH to literal IPv6 address

2017-02-07 Thread Johannes Kastl
On 07.02.17 12:23 Dick Visser wrote: > Nope that doesn't work, neither in .ss/config nor on the command > line. You need the Port option, or -p on the command line. As a workaround, what happens if you append the port? Host imapsync Hostname [2001:610:148:f00d:20c:29ff:fe14:ccfe]:22 This

Re: [ansible-project] SSH to literal IPv6 address

2017-02-07 Thread Johannes Kastl
On 07.02.17 10:38 Dick Visser wrote: > # Test host > Host imapsync > Hostname 2001:610:148:f00d:20c:29ff:fe14:ccfe > Is there another way of specifying a literal IPv6 address. I thought ssh needed IPv6 addresses in square brackets (to avoid confusion with ports added as suffix)? Host

Re: [ansible-project] Role meta dependencies and overrides

2017-02-07 Thread Johannes Kastl
On 07.02.17 10:03 Mark Olliver wrote: > Now so far so good, however when I include the base role as a > requirement for another playbook it correctly pulls in the meta > dependencies and as expected runs these first. The problem being > when running the role I have group_vars/all set with a

Re: [ansible-project] How to put period between two variables

2017-02-07 Thread Johannes Kastl
On 07.02.17 04:13 Kenton Brede wrote: > "{{ groups + '.' + item.host }}" > > How do I do this? Use the actual join filter: "{{ [ groups, '.', item.host | join] }}" https://docs.ansible.com/ansible/playbooks_filters.html Johannes -- You received this message because you are subscribed to

Re: [ansible-project] playbook do not execute

2017-02-07 Thread Johannes Kastl
On 07.02.17 09:15 Юра Фролов wrote: > Hello, > I have Debian 8.1 and ansible 2.2.1.0. > When I execute playbook I recive that message > *PLAY RECAP > ** > and nothing more. That normally means your hosts is not in the

Re: [ansible-project] Re: How to execute a playbook for a group of hosts with some tasks that have to be executed only once

2017-02-07 Thread Johannes Kastl
Hi, Glad the run_once works for you. On 07.02.17 09:27 'Tom Bartsch' via Ansible Project wrote: > The hints from Mr. Kastl are not suitable for my purpose because > I'm calling the playbook only with the product name and only one > time. But I am not sure you got my approach. You do not need

Re: [ansible-project] How to execute a playbook for a group of hosts with some tasks that have to be executed only once

2017-02-06 Thread Johannes Kastl
On 06.02.17 16:38 'Tom Bartsch' via Ansible Project wrote: > My problem now is that if I call this playbook with "hosts=product" > it will generate each of the group jobs 4 times. So it's 3 times to > much. Two ideas: You can have more than one play in a playbook. ### - hosts:

Re: [ansible-project] Problem connecting to host behind jump server when host set dynamically

2017-02-06 Thread Johannes Kastl
On 06.02.17 15:34 Linus Sunde wrote: > I have two playbooks and a hosts file: > Any ideas why this is happening? Second guess: By adding the hosts via add_hosts you overwrite your definition in the hosts file. And thus none of your options are set anymore. Note that this is just in memory, so

Re: [ansible-project] Problem connecting to host behind jump server when host set dynamically

2017-02-06 Thread Johannes Kastl
On 06.02.17 15:34 Linus Sunde wrote: > debug1: Control socket > \"/home/lsunde/.ansible/cp/ansible-ssh-10.0.0.1-22-lsunde\" does > not exist I am not sure if this is related, but apparently the socket, by which the multiplexing of the ssh connection should work, does not exist. Maybe try this

Re: [ansible-project] Output Failed even if command gets executed successfully

2017-02-06 Thread Johannes Kastl
On 06.02.17 09:27 bablu wrote: > > How to ignore failed command or in case the result set has no output. I > need the output should be success if it won't find anything relevant > mentioned in the condition. failed_when is your friend.

Re: [ansible-project] Difficulty including files with password variables in.

2017-02-05 Thread Johannes Kastl
On 31.01.17 17:02 Jonty Needham wrote: > password: secrets.svn_pass Aren't double curly braces needed here? password: "{{ secrets.svn_pass }}" And: why the secrets prefix? The variable only does not suffice? Johannes -- You received this message because you are subscribed to the

Re: [ansible-project] "become" not working on a handler

2017-02-04 Thread Johannes Kastl
On 02.02.17 18:11 Paul Mackay wrote: > I'm testing on Ubuntu 16.04 with Ansible v2.2.1.0. I have a service > (re)start handler that has "become: yes" but it is reporting: > > Interactive authentication required. Looks like it is asking for a password interactively. Be aware that "I can run the

Re: [ansible-project] Ansible state seems to do nothing

2017-02-04 Thread Johannes Kastl
On 03.02.17 11:03 Jonty Needham wrote: > I'm expecting it to either state that some states have passed or > failed. What have I got wrong? Add -v or -vvv to your ansible-playbook call to see more info. And, I have seen this when the hostname I gave does not match anything in the inventory.

Re: [ansible-project] PostgreSQL 9.5 or Higher installation on Ubuntu 14.04 LTS

2017-01-29 Thread Johannes Kastl
On 29.01.17 16:05 Shyam Yenna wrote: > - name: PostgreSQL | Make sure the dependencies are installed > apt: > name: "{{ item }}" > state: present > update_cache: true > with_items: ['python-psycopg2', 'python-pycurl', 'locales', 'sysstat', >

Re: [ansible-project] Module lxc_container uses wrong path to lxc-create on CentOS

2017-01-28 Thread Johannes Kastl
On 28.01.17 16:37 Johannes Kastl wrote: > Hmm, I should read the error messages more exact. lxc-create > actually is in /bin/lxc-create. Sorry, my fault. One ansible statement did not work the way I wanted and lxc-create did not like the btrfs parameter when not being run on a btrfs... Jo

Re: [ansible-project] Module lxc_container uses wrong path to lxc-create on CentOS

2017-01-28 Thread Johannes Kastl
On 28.01.17 16:35 Johannes Kastl wrote: >> fatal: [xyz]: FAILED! => {"changed": false, "command": "/bin/lxc-create >> --name foobar --quiet --template download --bdev btrfs -- -d centos -r 7 -a >> amd64", "err": "", "

[ansible-project] Module lxc_container uses wrong path to lxc-create on CentOS

2017-01-28 Thread Johannes Kastl
Dear List, is it just on my machine that the lxc_container module uses the wrong path to lxc-create? > fatal: [xyz]: FAILED! => {"changed": false, "command": "/bin/lxc-create > --name foobar --quiet --template download --bdev btrfs -- -d centos -r 7 -a > amd64", "err": "", "failed": true,

Re: [ansible-project] Re: List all ansible-vault encrypted files?

2017-01-28 Thread Johannes Kastl
On 28.01.17 12:32 Paul Tötterman wrote: > What encrypted binary files ?-) I only have encrypted YAML files Nice. ;-) Johannes -- 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

Re: [ansible-project] Re: List all ansible-vault encrypted files?

2017-01-28 Thread Johannes Kastl
On 28.01.17 12:05 Paul Tötterman wrote: > I also prefer to name my vault files ending in .vault. Interesting thought. Is this just for your encrypted binary files, or does this work with encrypted yml files, too? Johannes (is off reading the docs) -- You received this message because you are

Re: [ansible-project] PostgreSQL 9.5 or Higher installation on Ubuntu 14.04 LTS

2017-01-27 Thread Johannes Kastl
On 27.01.17 17:53 Shyam Yenna wrote: > I am trying to install PostgreSQL 9.5 version on Ubuntu 14.04 LTS > using ansible 2.2.1 version playbook tasks. According to my > workflow design add apt key, add apt repository and later install > postgresql packages. But dependencies packages are broken

Re: [ansible-project] Authorize nginx reload without providing become-pass and full sudo privileges

2017-01-27 Thread Johannes Kastl
On 27.01.17 15:42 Jonathan Bouzekri wrote: > I think that it is quite a drawback on Ansible. If you use it for > code shipping, you will have to do some tasks which needs > privileges escalation (reload nginx or something else). And the > people who are doing the delivery are not necessary

Re: [ansible-project] How to define and use the environment (production/development)?

2017-01-27 Thread Johannes Kastl
On 27.01.17 14:46 Cev Ing wrote: > How to get the different SSH keys in the users.yml without > duplicating all the remaining data for each environment? group_vars would be another idea. > But how to know in a playbook in which environment the playbook is > executed? Setting a variable? If you

Re: [ansible-project] Allowed specific commands with NOPASSWD in sudoers file, Ansible complains...

2017-01-27 Thread Johannes Kastl
On 26.01.17 19:11 Jonathan Bouzekri wrote: > Is there any progress on this feature? is it available in the > latest version of ansible? More specifically on the service module > (for example to allow reloading of specific services) As you don't quote what you are talking about I can only assume

Re: [ansible-project] How to manage the crontab entries that were not done by Ansible's cron module

2017-01-27 Thread Johannes Kastl
On 26.01.17 20:46 Manas Shukla wrote: > As I understand the ansible cron module prefixes all the cron jobs > set by it with* #Ansible: Name *and uses this to manage them in the > future. My existing crontabs do not have this tag prefixed. Can I > still update and delete them through Ansible cron

Re: [ansible-project] Authorize nginx reload without providing become-pass and full sudo privileges

2017-01-26 Thread Johannes Kastl
On 26.01.17 17:04 Jonathan Bouzekri wrote: > I want to be able to reload nginx when the configuration change > without having to : > > * give sudo rights on ALL commands to the deploy user > * having to pass a become-pass in the command line You can use ansible-vault to encrypt the host_vars

Re: [ansible-project] Ansible evaulate dynamic varaible name from vars

2017-01-26 Thread Johannes Kastl
On 26.01.17 14:18 Yordan Borisov wrote: > I have vars where I put something like this: > > vars/main.yml > > hello_port: 80 > > world_port: 81 > > > in my ansbile file I load the vars with > vars_files: > - ./vars/main.yml > > and after that I have task with iterate using with_items:

Re: [ansible-project] Newbie needs help re-using a tasklist

2017-01-26 Thread Johannes Kastl
On 26.01.17 08:28 rene via Ansible Project wrote: > As of now, I have a playbook wich is split up into smaller .yml > files. The reason for that is, that we want to "re-use" some of > .yml files in other playbooks so we don't have to rewrite > everything from scratch as we progress. I would try

Re: [ansible-project] lineinfile problem

2017-01-26 Thread Johannes Kastl
On 27.01.17 00:01 mark.to...@dsv.com wrote: > What I would like to do now is walk through the results[] list and > extract the "rc" and "item" values, something along the line of > this: > > - debug: var={{item.rc}} > with_items: > - result.results[*] > > But of course that does

Re: [ansible-project] Tabulator in jinja2 template?

2017-01-26 Thread Johannes Kastl
On 25.01.17 16:52 Бранко Мајић wrote: > Try putting quotes around \t, i.e. {{ "\t" }}. Thanks, that works. Inconsistent, but it works. > It does look a bit too verbose to me, though. You could use cat -A > instead to see things like tabs in a file instead. I agree it makes things harder to

Re: [ansible-project] How to emulate Make semantics?

2017-01-26 Thread Johannes Kastl
On 26.01.17 16:45 Cev Ing wrote: > Maybe I am wrong and stat works, but what does not work is copy. > The error is, that copy has no read permission to read /etc/shadow > in a local action, although I use become. > Without the actual error (and your playbook) it is hard to guess... Johannes --

Re: [ansible-project] How to emulate Make semantics?

2017-01-26 Thread Johannes Kastl
On 26.01.17 16:30 Cev Ing wrote: > Using stat in a local action with become does not seem to work. Why not, what error are you getting? > delegate_to: 127.0.0.1 I am not sure, but I thing I remember there is a difference between "delegate_to: 127.0.0.1" and "delegate_to: localhost". If

Re: [ansible-project] How to emulate Make semantics?

2017-01-26 Thread Johannes Kastl
On 26.01.17 12:24 Cev Ing wrote: > I need to execute a play, which uses file A to generate file B, if B does > not exist or if B exists and is older than A. > > How can I compare file dates in the when condition? Cleanest solution would be to use two stat commands with "register: file_A" and

Re: [ansible-project] Re: Testing for a defined but non empty string

2017-01-26 Thread Johannes Kastl
On 26.01.17 08:50 Michael Shi wrote: > On Friday, 31 January 2014 22:58:17 UTC+11, Stephen Ryan wrote: >> This works perfectly for most situations however we have a number >> of places where we need to unset the variable to stop the command >> on certain hosts. Neither of the following work when

Re: [ansible-project] Ansible variable question.

2017-01-25 Thread Johannes Kastl
On 25.01.17 21:33 'Jason Morgan' via Ansible Project wrote: Change this: mariadb_version: 10.1 into this: mariadb_version: "10.1" > - name: Start MariaDB 10.0 >service: name=mysql enabled=yes state=started >when: mariadb_version == '10.0' > > - name: Start MariaDB 10.1 >service:

Re: [ansible-project] remote access to lxc containers on lxc-host without ssh inside the containers

2017-01-25 Thread Johannes Kastl
On 25.01.17 18:14 'Hadmut Danisch' via Ansible Project wrote: > It is, furthermore, illogical and causes a chicken-egg-problem: Depends on what you define as 'containers'. I have multiple containers running on my hosts, and all have sshd running. Thus I can manage them like normal machines. No

[ansible-project] Tabulator in jinja2 template?

2017-01-25 Thread Johannes Kastl
Dear all, is there a way to add a tabulator to a template in ansible? I mean without actually using a tabulator, so it would be easier to spot while checking the template. The lineinfile module supports {{\t}}, but that throws errors in my tests. I also find nothing on the web, but maybe I'm

Re: [ansible-project] remote access to lxc containers on lxc-host without ssh inside the containers

2017-01-24 Thread Johannes Kastl
On 25.01.17 01:19 Pshem Kowalczyk wrote: > Is there any particular reason you don't want have ssh inside the container > at least initially? You can always disable it after you're done with > initial configuration. +1 for installing ssh in the container. And use the host as a jumphost

Re: [ansible-project] update /etc/cron.allow on multiple nodes diff values

2017-01-24 Thread Johannes Kastl
On 24.01.17 03:30 Kiran Kumar wrote: > x oracle > y db > x prod I assume the x should be the hostname, and the second column should be the line in /etc/hosts.allow? > how can i do it for huge number of nodes ? You put more than one host in the "- hosts:" line? ;-) Seriously, put the x=oracle

Re: [ansible-project] Help with Nested Loops

2017-01-24 Thread Johannes Kastl
On 23.01.17 20:00 Nick Couchman wrote: > I can't quite figure out how, in a playbook, to loop through in > such a way that I'm looking at each of the entries in > ansible_devices (sda, sdb, sdc), then each of the holders entries > there (empty in the above example), then each of the partitions >

Re: [ansible-project] blockinfile - learning pains

2017-01-24 Thread Johannes Kastl
On 23.01.17 18:12 MarkD wrote: > Nothing happens, what am I doing wrong? As my crystal ball is in repair, why don't you show us the complete task and the actual error output? It's hard to guess otherwise... Johannes -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] Setup module command line: permissions denied

2017-01-24 Thread Johannes Kastl
On 23.01.17 20:18 Billie XU wrote: > ansible master -i hosts -m setup This line does not tell ansible to use sudo to get elevated rights, so it is run as the normal user ansible logs in with. Try to add "-b" (if you dont require a sudo password) or "-b -K" to your command. Although I do not

Re: [ansible-project] Re: is with_nested the right approach here?

2017-01-24 Thread Johannes Kastl
On 24.01.17 09:40 raphael.baud...@tessares.net wrote: > with the included cookbook: cookbook is chef, ansible uses playbooks ;-) I think there is an error in your dest, you use double curly braces inside of double curly braces: template: src: templates/{{item[1]}} dest: /etc/{{item[1] |

Re: [ansible-project] Design ideas ansible provision with docker compose

2017-01-23 Thread Johannes Kastl
On 23.01.17 02:24 Sonny Heer wrote: > Thanks for that info. I do see what you mean. I'd like to reuse > existing ansible roles if possible. Assuming I'm only doing basic > things like setting up a yum repo and installing packages on groups > of nodes. Here is the lifecycle of what I'm

Re: [ansible-project] Install nagios to all host with Ansible Playbook

2017-01-22 Thread Johannes Kastl
On 21.01.17 23:57 João Figueia wrote: > Hello guys, I'm new to ansible and I would like to know how it is > possible to install Nagios in all hosts. Why don't you start with the official icinga2 examples? https://github.com/Icinga/icinga2-ansible (There are examples for classic-gui, web-ui,

Re: [ansible-project] Re: Help on ansible tasks

2017-01-21 Thread Johannes Kastl
On 20.01.17 23:38 Shyam Yenna wrote: > I have found my defect. > > Thanks for help and Enjoy coding... Then why don't you tell us what the problem was? The next one looking will be glad... Johannes -- You received this message because you are subscribed to the Google Groups "Ansible

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Johannes Kastl
On 20.01.17 15:50 Stepan Harutyunyan wrote: > Again error > > msg: "{{ array[int(item)]['contactId'] }}" I would say that again the brackets are missing: msg: "{{ array[ [ int(item)] ]['contactId'] }}" Johannes -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] Newlines are escaped when using jinja2 filters in playbook

2017-01-20 Thread Johannes Kastl
On 18.01.17 11:54 Fredrik Rambris wrote: > Is there a way to tell ansible not to escape the newlines in key ? I don't know, I would suggest trying the template module to work around that. Some jinja2-magic with looping through your keylist should work. I also thought there was an escape

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Johannes Kastl
On 20.01.17 15:01 Stepan Harutyunyan wrote: > Thank you Johannes, > > i put msg: "{{array[item]['contactId']}}" > > but i got following error: > > fatal: [10.137.25.64]: FAILED! => {"failed": true, "msg": "the > field 'args' has an invalid value, which appears to include a > variable that is

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Johannes Kastl
On 20.01.17 14:34 Stepan Harutyunyan wrote: > Thank you for your reply, but I can check contactAccount value with my when > condition, I want to take contactId according on contactAccount Sorry, misunderstood your problem. This is wrong syntax, double curly braces are not allowed inside double

Re: [ansible-project] How setup filter of gathering fact work ?

2017-01-20 Thread Johannes Kastl
On 20.01.17 09:07 web.c...@orange.fr wrote: > * tasks:* > *- setup:* > *filter: ansible_eth1 * > > *- debug: var=ansible_eth1.ipv4.address* Maybe gather_subset: "network" can help here, if you just want the ip address. Johannes -- You received this message because you are

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Johannes Kastl
On 20.01.17 13:45 Stepan Harutyunyan wrote: > when: array.{{item}}.contactAccount == > '**someema...@somedomain.com**'* Maybe the find filter does what you are looking for? array.{{item}}.contactaccount.find('someemail') == 1 Untested! This is not in the filter documentation, I found it in

Re: [ansible-project] Issue with Firewall Role

2017-01-20 Thread Johannes Kastl
Hi there, On 10.01.17 22:50 franklovesespre...@gmail.com wrote: > and I'm trying to get the example below working. The rules in > all.yml are picked up fine, but the rules in webservers.yml are not. If I remember well, I had to delete that file to get it working. I put the stuff from that file

Re: [ansible-project] Template Conditionals

2017-01-20 Thread Johannes Kastl
On 19.01.17 19:43 Kai Stian Olstad wrote: >> The foo playbook has templatized config files ... and there's the >> rub. I want the foo playbook to work on s8 and s9, BUT, I want >> different strings to be substituted when the template gets >> processed, depending on whether I am on s8 or s9. Kai

Re: [ansible-project] Re: Getting Error while executing Commands having space in command module and shell module

2017-01-20 Thread Johannes Kastl
On 20.01.17 09:27 sgamp...@criterionnetworks.com wrote: > I tried using complete command "onos-karaf clean" as well but its > not working its giving me same error as you can see > > error message: failed: [192.168.2.129] (item=onos-karaf clean) => > {"cmd": "onos-karaf clean", "failed": true,

Re: [ansible-project] using docker:xenial image in chrismeyersfsu/provision_docker role

2017-01-20 Thread Johannes Kastl
On 19.01.17 20:28 Mathias Aldrin wrote: > I can specify the image ubuntu:xenial but I do not know how to pre load > this image with python 2.7 (requirement for ansible). > Creating the docker containers manually I would create a Dockerfile > defining the pre installed SW. I would guess that

Re: [ansible-project] Variables from csv and loops with random records

2017-01-20 Thread Johannes Kastl
On 19.01.17 11:48 Mátyás Kovács wrote: > Hi! > > Thanks for the advice, I like it. But, I have a syntax error with this: > > --- > - hosts: all > tasks: > - iptables_raw: The indentation is wrong, the dash should be indented as tasks is: - hosts: all tasks: - iptables_raw:

Re: [ansible-project] Variables from csv and loops with random records

2017-01-19 Thread Johannes Kastl
On 19.01.17 11:50 Mátyás Kovács wrote: > In this case, I have to update a lot of file, because there are a > lot of different rule on each servers. If your existing files have valid iptables syntax, then this conversion should be scriptable... Johannes -- You received this message because you

Re: [ansible-project] Re: Getting Error while executing Commands having space in command module and shell module

2017-01-19 Thread Johannes Kastl
On 20.01.17 08:26 sgamp...@criterionnetworks.com wrote: > Hi Johannnes, > > I tried 'alias ok' its giving me output "onos-karaf" thats ok. No, it explains your problem. You can use 'ok' as command as a user, but ansible cannot. It does not know your alias. Use the full name and the task will

[ansible-project] Idempotency: How to determine which user to use when root is no longer allowed?

2017-01-18 Thread Johannes Kastl
Hi there, say I get a new instance somewhere that allows logins as root. I want to run a playbook that configures the machine and no longer allows root logins. And I want it to be idempotent. ;-) Consider this mock-up playbook: - hosts: foobar vars: ansible_user: root

Re: [ansible-project] Re: Getting Error while executing Commands having space in command module and shell module

2017-01-18 Thread Johannes Kastl
On 18.01.17 13:46 sgamp...@criterionnetworks.com wrote: > This 'ok' means 'onos-karaf', When I execute 'ok > clean' in my remote VM which is having onos installed in it. I There is your problem. I guess you have some kind of alias in your VM that lets you use ok without errors. Ansible does not

Re: [ansible-project] Re: Getting Error while executing Commands having space in command module and shell module

2017-01-18 Thread Johannes Kastl
Hi there, On 18.01.17 12:49 sgamp...@criterionnetworks.com wrote: > tasks: - name: running ok clean command: ok clean What kind of command is 'ok'? Is this your actual executable? In your previous examples I assumed it was called 'onos'. > "[Errno 2] No such file or directory", "rc": 2} Your

Re: [ansible-project] Run multiple tasks with different Ansible users for Windows hosts

2017-01-18 Thread Johannes Kastl
On 13.01.17 11:43 davidfof wrote: > ansible-playbook --limit windows -i hosts --extra-vars > "ansible_user=my_username ansible_password=my_password" site.yaml > - include: task_for_other_windows_user.yml vars: ansible_user: > "{{other_windows_user_name}}" ansible_password: >

Re: [ansible-project] Variables from csv and loops with random records

2017-01-18 Thread Johannes Kastl
On 17.01.17 09:42 Mátyás Kovács wrote: > I hope you can help me with this problem. There are 50 different > servers, each of them has different iptables firewall and rules. I > want them to be managed by Ansible. My idea is to create a csv > file, like this: Have a look at

Re: [ansible-project] how to access variables set on target env

2017-01-18 Thread Johannes Kastl
On 18.01.17 09:34 Dick Visser wrote: > You can define environment variables for a task: > http://docs.ansible.com/ansible/playbooks_environment.html > > If that setWLSEnv.sh contains many vars then store all of them in > one ansible var for easy reuse and less clutter. I would suggest setting

Re: [ansible-project] Getting Error while executing Commands having space in command module and shell module

2017-01-18 Thread Johannes Kastl
On 18.01.17 09:17 Dick Visser wrote: > You seem to be specifying a parameter as the command? > As per examples specify the actual command first, and then put the > parameters after that. > Preferably on different lines to make it more readable. Also, as soon as spaces are involved, trying to

Re: [ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-17 Thread Johannes Kastl
On 16.01.17 10:32 Paul Tötterman wrote: >> 1. Set check_mode: no and always run the command task so the >> variable always contains the stdout object. >> 2. Only run the debug task when my_variable.skipped is not >> defined. >> > > 3. only run the debug task when not in check_mode > 4. set

Re: [ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-17 Thread Johannes Kastl
On 15.01.17 19:43 Anthony Bond wrote: > - debug: msg="Here is the output of {{ my_variable.stdout }}" when: > my_variable is defined Thanks, I already had that in mind for the element skipped of my_variable: "2. Only run the debug task when my_variable.skipped is not defined." Johannes --

[ansible-project] How to avoid error when using a registered variable in check mode?

2017-01-15 Thread Johannes Kastl
Hi, I have a playbook that has to use the command module and registers its output in a variable like so: - command: do something here register: my_variable - debug: msg="Here is the output of {{ my_variable.stdout }}" When running this in check_mode, the command task is skipped and the

Re: [ansible-project] How to check status of service running on a remote host via Ansible

2017-01-13 Thread Johannes Kastl
On 12.01.17 20:39 Kishor Ramanan wrote: > I am in need of a ansbile play to check the status of a service in > CENTOS 7 / RHEL > > *Expected output:* > > ● docker.service - Docker Application Container Engine Loaded: > loaded (/usr/lib/systemd/system/docker.service; enabled; vendor > preset:

Re: [ansible-project] Public Key works but not username password

2017-01-13 Thread Johannes Kastl
On 12.01.17 10:35 Worked Whe wrote: > When I copy public key of "Ansible Server" to "Host", simple ping > works fine with Ansible: > Then I remove public key from the "Host" and tried same with > password. You are logging in as root, check your sshd_config for PermitRootLogin. I guess it is set

Re: [ansible-project] Re: SSH via Jumpbox

2017-01-12 Thread Johannes Kastl
On 12.01.17 09:40 Thomas Oliw wrote: I doubt that ansible is capable of handling this kind of jumphost. A 'normal' jumphost that just forwards the connection and the ssh key works outside of ansible and does not require much configuration (mostly setting the hosts up in your ~/.ssh/config). >

  1   2   3   4   >