[ansible-project] Re: How to pull code from local machine

2014-07-15 Thread Paul Tötterman
stderr: fatal: '/home/username/myproject/.git' does not appear to be a git repository fatal: Could not read from remote repository. Have you tried if the actual git command succeeds? git clone file:///home/username/myproject/.git I suspect that it should be: git clone

Re: [ansible-project] Setting dir vs file permissions with file recurse=yes

2014-07-17 Thread Paul Tötterman
I'm really not interested in tool comparisons here, but Puppet has not done the recursive thing either and actually takes the position you have to spec out every file path along the way. I suspect Damien meant: file { '/target': source = 'file:///source', recurse = true, mode =

[ansible-project] Re: Can lineinfile insert text into a line?

2014-07-30 Thread Paul Tötterman
Right now, I'd use 'command' or 'shell' to call sed or awk to accomplish this. But is there a way to massage ansible into doing this? Augeas could probably be used (http://augeas.net/docs/references/lenses/files/pam-aug.html), but I guess there's no ansible module for augeas yet.

[ansible-project] Re: Remove packages

2014-08-06 Thread Paul Tötterman
$ apt-get remove package* From http://docs.ansible.com/apt_module.html: # Remove foo package - apt: name=foo state=absent Cheers, Paul -- You received this message because you are subscribed to the Google Groups Ansible Project group. To unsubscribe from this group and stop receiving

[ansible-project] Re: Remove packages

2014-08-06 Thread Paul Tötterman
$ apt-get remove package* Reading a bit more carefully, if your problem is with the glob, maybe try a playbook like this: --- - hosts: all tasks: - command: dpkg-query -f '${Package}\n' -W 'package*' register: query - apt: name={{item}} state=absent with_items:

Re: [ansible-project] Re: Reconnect after the user is added

2015-01-03 Thread Paul Tötterman
Thanks for the hint. Does that mean that Ansible reconnect to remote machine after each play? (Can't test it right now) If you increase the verbosity using -v you'll see that ansible connects for each task. But it's probably easier to group tasks to be executed with a certain user as a

[ansible-project] Re: win_package module

2015-01-20 Thread Paul Tötterman
I'm looking for the win_package module. Could you tell me where is it possible to get or download it ?? It seems abandoned, but https://github.com/ansible/ansible/commit/961ab95b452cb3cd28c071e357a4afa8ead11f79 Cheers, Paul -- You received this message because you are subscribed to the

[ansible-project] Re: what does this mean? ['tag_Environment_%s' % args.environment]

2015-04-25 Thread Paul Tötterman
I'm trying to understand what ['tag_Environment_%s' % args.environment] means. [] is a list literal in Python. [1, 2, 3] can also be written as list(1, 2, 3) % is the string format operator. 'bar: %s' % 'tada' results in the string 'bar: tada' ['tag_Environment_%s' % args.environment]

[ansible-project] Re: replace module help

2015-04-12 Thread Paul Tötterman
replace: dest=/etc/fstab regexp='(\s+)defaults1 2(\s+.*)?$' replace='\1defaults,noatime1 2\1' backup=yes does not match UUID=b203e2c3-5207-41a8-8f18-795b5ec6550f / ext4 defaults1 1 because of '1 1' vs '1 2' Cheers, Paul -- You

[ansible-project] Re: How to pass list of arguments that contains = signs to raw command ?

2015-05-28 Thread Paul Tötterman
raw: docker run {{ container_commands[container_name] }} registry:2.0 raw: Executes a low-down and dirty SSH command, not going through the module subsystem. This is useful and should only be done in two cases. The first case is installing python-simplejson on older (Python 2.4 and

[ansible-project] Re: Docker and Ansible Vault: An insecure match?

2015-07-15 Thread Paul Tötterman
How can I run a playbook using vars encrypted by Vault during a Docker build? Don't How can I do it without exposing a password file? Is there a best practice? Give sensitive information to the docker container as environment values. See e.g.

[ansible-project] Re: Playbooks issue.

2015-10-08 Thread Paul Tötterman
> > Yep, but i've got python2: > https://docs.ansible.com/ansible/faq.html#how-do-i-handle-python-pathing-not-having-a-python-2-x-in-usr-bin-python-on-a-remote-machine Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

Re: [ansible-project] Issue with default value

2015-09-01 Thread Paul Tötterman
> > default("127.0.0.1", true) > Didn't help. > It is not clear on the filter description, but without the second argument > it does not perform a boolean evaluation, but just strict variable > undefinition. That means that an empty string will not trigger the default. > Actually, even if

Re: [ansible-project] Issue with default value

2015-09-01 Thread Paul Tötterman
Sorry to resurrect this old thread. > ansible_eth1["ipv4"]["address"] | default("127.0.0.1") > I tried this and it didn't work. Is it supposed to? Is there some other way of using default that would work? Would it make sense to fix the default filter to work in this case? Cheers, Paul --

Re: [ansible-project] Issue with default value

2015-09-01 Thread Paul Tötterman
> > ((ansible_eth1|default({})["ipv4"]|default({}))["address"] | > default("127.0.0.1") > Ugh. I was expecting something like try: ... except KeyError: ... Is there any chance of fixing default to work with multiple levels without so much typing? I think it would be a rather big usability

[ansible-project] Re: does anyone succeeded to use the git module on windows ?

2015-09-25 Thread Paul Tötterman
> > Does anybody already succeeded to run this module on windows ? Is it even > possible ? > > There is no git module in the windows modules group https://docs.ansible.com/ansible/list_of_windows_modules.html . Apart from the modules listed on that page only script, slurp, raw and setup are

[ansible-project] Handy playbook for running given role

2015-12-11 Thread Paul Tötterman
Hi, This may come in handy at some point: # vim: set ft=yaml: # usage: ansible-playbook -e role=somerole role.yml --- - hosts: all roles: - '{{role}}' However, I wasn't able to figure out how to perform the same trick on multiple roles: # vim: set ft=yaml: # usage: ansible-playbook -e

[ansible-project] Re: ansible check DNS against FQDN

2016-06-06 Thread Paul Tötterman
> > This is not working? Is there a better way to do this? Or please suggest > a fix. > Consider using the dig-lookup: https://docs.ansible.com/ansible/playbooks_lookups.html#the-dns-lookup-dig Cheers, Paul -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] .profile

2016-05-25 Thread Paul Tötterman
> > You call this script instead of dispatcher.sh directly, like > And there's even the script-module: https://docs.ansible.com/ansible/script_module.html Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe

[ansible-project] Re: Finding key in list of dicts in when

2016-05-30 Thread Paul Tötterman
> > But it seems that when statement is too complex. Any ideas how to express > that in a valid way? > I ended up writing a filter that lets me do: when: not ansible_mounts|is_mounted('/srv') Cheers, Paul -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] Finding key in list of dicts in when

2016-05-31 Thread Paul Tötterman
> > "{{ 'ansible' in pkgs.results|default([])|map(attribute='name') }}" > Thank you Daniel, that avoids the heavy-handed approach of a filter plugin. Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

[ansible-project] Finding key in list of dicts in when

2016-05-26 Thread Paul Tötterman
Hi, Related to the recent mount deprecation thread: - command: mount /srv when: "'/srv' not in [x['mount'] for x in ansible_mounts]" But it seems that when statement is too complex. Any ideas how to express that in a valid way? Ideas about how to use mount: state=mounted without touching

[ansible-project] Ansible equivalent for puppet's fqdn_rand()

2016-03-10 Thread Paul Tötterman
Hi, I'd like for cron entries to be run at different minutes based on e.g. hostname (would be nice to be easy to pick the seed). In puppet I would use fqdn_rand(). The best I could find for ansible is https://stackoverflow.com/questions/33379378/idempotence-and-random-variables-in-ansible .

[ansible-project] Re: Ansible task always run

2016-04-08 Thread Paul Tötterman
> > 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. > Yes: https://docs.ansible.com/ansible/playbooks_checkmode.html#running-a-task-in-check-mode . Probably doesn't do what you want.

[ansible-project] Re: Ansible equivalent for puppet's fqdn_rand()

2016-03-22 Thread Paul Tötterman
https://gist.github.com/ptman/9bd8223272e2c0e27b2b Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[ansible-project] Delegating tasks from multiple hosts to one

2016-03-23 Thread Paul Tötterman
Hi, I'm trying to delegate from multiple hosts to one in a play. Basically I'm trying to do something similar to puppet exported resources. - hosts: slaves tasks: - cron: name: '{{ansible_fqdn}}' job: 'rsync {{ansible_fqdn}}:/srv/data /srv/backup/{{ansible_fqdn}}/srv/data/' #

Re: [ansible-project] How to check file system is mounted?

2016-05-23 Thread Paul Tötterman
> > Why not using the "ansible_mounts" fact ? That seems to be an array of hashes. What would be the best way to check, in your experience? Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and

Re: [ansible-project] How to check file system is mounted?

2016-05-23 Thread Paul Tötterman
> > If you can't get this with the ansible_mounts variable for whatever > reason, then what you're doing here should work, except that in order to > do the pipe, you need to use the 'shell' rather than the 'command' module. > Or: command: mount register: m always_run: True changed_when:

[ansible-project] Re: Force to gather fact even if gathering is set to smart

2016-05-01 Thread Paul Tötterman
Hi, > How can I force setup to run on a play even if the Ansible config file is > set to gathering strategy of smart. > Ansible 2.1: * New meta action, `meta: clear_facts` which will remove existing facts for the current host from current memory and facts cache. Cheers, Paul -- You

[ansible-project] Re: lineinfile behavior replace line if found, add line if not found?

2016-04-18 Thread Paul Tötterman
Hi Bob, > The general question: can lineinfile be used to replace a line in a file > if it's found and if it's not found add the line to the file? > I've used it successfully like this, but I didn't template my regexp. Cheers, Paul -- You received this message because you are subscribed

[ansible-project] Re: How to install RHEL on mutiple nodes using ansible

2016-07-27 Thread Paul Tötterman
> > Please help me with the configuration of ansible for setting up servers > with RHEL 7 > Ansible is more for setting up / configuring already installed servers. Use something else (kickstart?) for installing. Cheers, Paul -- You received this message because you are subscribed to the

[ansible-project] Re: Output var values to screen

2016-07-07 Thread Paul Tötterman
> > How do I display the values of my vars to the person running my playbook? > https://docs.ansible.com/ansible/debug_module.html Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

[ansible-project] Re: Encrypting password without using vault

2016-08-02 Thread Paul Tötterman
> > Is there a way to encrypt a password in the hosts file without using a > vault? > What are the problems you are having with vault so that we don't suggest something with the same problems? Cheers, Paul -- You received this message because you are subscribed to the Google Groups

[ansible-project] Re: chaining ssh and lxd connections

2016-06-30 Thread Paul Tötterman
> > I wonder if/how is it possible to chain ssh and lxd connections in order > to manipulate lxd/docker containers on remote physical servers > Are the lxd or docker containers reachable by SSH? Are the addresses routable to your ansible control host? Just use SSH. If not routable, but are

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

2017-01-28 Thread Paul Tötterman
> > Interesting thought. Is this just for your encrypted binary files, or > does this work with encrypted yml files, too? > What encrypted binary files ?-) I only have encrypted YAML files Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible

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

2017-01-28 Thread Paul Tötterman
> > Is there a way to list all files in a repo that are encrypted via > ansible-vault? > grep -rl '$ANSIBLE_VAULT;1.1' Look at the first line of an ansible vault encrypted file and play around a bit with the magic string I also prefer to name my vault files ending in .vault. Cheers, Paul

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

2017-01-16 Thread Paul Tötterman
> > 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 some sort of default value when in check_mode

[ansible-project] Re: Use of fetch -- can we preserve timestamps?

2016-08-22 Thread Paul Tötterman
> > Would it be possible to add an option to PRESERVE the file time stamps > (mtime, ctime)? > You could try opening a feature request ticket on https://github.com/ansible/ansible-modules-core Cheers, Paul -- You received this message because you are subscribed to the Google Groups

[ansible-project] Re: ansible asks for sudo password but local command does not

2016-09-16 Thread Paul Tötterman
> > When i am directly on the target host as user john "sudo yum install htop" > works without asking for a password so i guess NOPASSWD is set for john. I > don't even have a password. I connect via ssh key. > Ansible doesn't do this: ssh john@a-host sudo yum install htop Ansible

[ansible-project] Re: ansible asks for sudo password but local command does not

2016-09-20 Thread Paul Tötterman
> > sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo > BECOME-SUCCESS-mukfdpvotlpobkadiwdhuktbihrwsnnr; LANG=en_US.utf8 > LC_ALL=en_US.utf8 LC_MESSAGES=en_US.utf8 /usr/bin/python > /home/john/.ansible/tmp/ansible-tmp-1474312334.89-150221606981760/setup; rm > -rf

[ansible-project] Re: Linux aliases in shell...

2016-10-25 Thread Paul Tötterman
> > Is there a way to make aliases available in a shell? I tried sourcing a > file with aliases before invoking my alias with no luck > https://linux.die.net/man/1/bash : Aliases are not expanded when the shell is not interactive, unless > the expand_aliases shell option is set using

[ansible-project] Re: Sudo auth fails in the middle of playbook

2016-11-25 Thread Paul Tötterman
> > After running the playbook tally2 counts 14 failed logins for my account, > though the sudo password should've > been correctly entered (since some files do get created as root). > Do you have more that one auth backend in PAM? like pam_unix + pam_ldap? Do those have different passwords? A

[ansible-project] Re: does ansible support ssh signed keys?

2016-10-10 Thread Paul Tötterman
> > ssh supports signed ssh keys by appending '-cert.pub' to private keys . > Can I specify this key to ansible, along with the private key? > Connecting with? Or managing? Or what? What is the ansible-specific thing you are looking for? SSH can be configured to use specific keys using

Re: [ansible-project] Gitter chat/channel for Ansible?

2016-11-29 Thread Paul Tötterman
Hi, There is also Matrix (matrix.org), with clients such as Riot (riot.im, web, android, ios) and a bridge to freenode IRC. Basically, if you only care about IRC@freenode, it works as well as irccloud.com, but for free. Cheers, Paul -- You received this message because you are subscribed to

[ansible-project] Re: I want to to make a basic playbook using the -find module ----- but how do I get the names of the files returned ?

2017-03-07 Thread Paul Tötterman
> > *- but how do I get the names of the files returned ? * > register: https://stackoverflow.com/questions/41565614/ansible-how-to-register-output-from-find-module-and-use-in-other Cheers, Paul -- You received this message because you are subscribed to the Google Groups "Ansible

Re: [ansible-project] uri module and curl

2017-03-01 Thread Paul Tötterman
> > Instead of pause you could use until: so it retries until you get 200. > https://docs.ansible.com/ansible/playbooks_loops.html#do-until-loops Or wait_for: https://docs.ansible.com/ansible/wait_for_module.html Cheers, Paul -- You received this message because you are subscribed to the

Re: [ansible-project] uri module and curl

2017-03-01 Thread Paul Tötterman
> > Can you use wait_for to check if a web server application return status > code 200? > If so how? It's not clear to me after reading the documentation. > I haven't tried, but I thought search_regex: 'HTTP/1.1 200 OK' or something similar Cheers, Paul -- You received this message

Re: [ansible-project] how to make cron module for running ansible playbooks

2017-05-02 Thread Paul Tötterman
> > I was able to see the job by typing "crontab -e".But it is not working.Is > the job which i gave there is in the right way > Have you tried: crontab -l -u root Try changing the user. Which remote_user are you using? Cheers, Paul -- You received this message because you are

[ansible-project] Re: Using lookup plugin to check SHA512 password hash

2017-05-03 Thread Paul Tötterman
> > Now, I want to check if the password hashes from this var file matches the > ones from the /etc/shadow file on a remote server. I know it is possible > to mix Ansible and a bash/python script to get what I want. *I would like > to know if it is possible* to do this using pure Ansible

Re: [ansible-project] Whats your favourite YAML/YML editor

2017-05-03 Thread Paul Tötterman
> > Bash on windows's vi (basically Ubuntu) does yaml syntax highlighting out > of the box, althoughi find it a lot easier to read if you change the text > to black and the background to white. Notepad++ also yaml aware. Sometimes > I use yamllint.com too. Is it easier to read because of the