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
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 =
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.
$ 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
$ 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:
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
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
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]
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
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
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.
>
> 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
>
> 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
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
--
>
> ((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
>
> 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
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
>
> 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
>
> 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
>
> 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
>
> "{{ '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
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
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
.
>
> 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.
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
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/' #
>
> 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
>
> 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:
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
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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
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
>
> *- 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
>
> 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
>
> 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
>
> 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
>
> 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
>
> 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
50 matches
Mail list logo