[ansible-project] Strategies for testing if network range available

2017-07-12 Thread Josef Fortier
My goal is to fail early and warn if storage network not set up (and set up mounts if it is set up). I've an approach that seems to work OK, but was wondering if there is a preferred/better path set_fact: has_storage_lan: '{{ ansible_all_ipv4_addresses|join()|match("10.0.20.") }}' This

Re: [ansible-project] Why can I debug this variable syntax but not set_fact the same variable syntax?

2017-07-12 Thread burns498
Kai - Thank you very much. Everything you mentioned was exactly right. Helped me learn a thing or two about proper syntax...and reminding me not to code too late into the evening. haha. Final Playbook: --- - name: Target Host hosts: "{{ target }}" tasks: - name: Register foo command:

[ansible-project] when: inventory_hostname != play_hosts[-1] not working

2017-07-12 Thread chrono
Hello, I'm trying to get a role to run on all hosts except the last. I thought this would work: - { role: wait, timeout: 300, tags: ['wait'], when: inventory_hostname != > play_hosts[-1] } ...but I get a YAML syntax error. Is there a way to do this? Best, - C -- You received this

Re: [ansible-project] "/bin/sh" isn\'t allowed to be executed

2017-07-12 Thread Rod Oliver
I think I've figured out what is causing the issue. I don't know what to do solve the issue. Sudosh has been configured to only allow certain commands via remote shell. On a test system running more or less the same setup I can configure sudosh (/etc/sudosh.conf) to allow all commands. I don't

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-12 Thread Gareth Hasson
Actually no, the playbook is running as the ansible user so cannot read those directories Thanks On Wed, Jul 12, 2017 at 2:26 PM, Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 12. juli 2017 20:11, Anfield wrote: > >> How would I get around this issue on the localhost? I

Re: [ansible-project] "/bin/sh" isn\'t allowed to be executed

2017-07-12 Thread Rod Oliver
Hi Brian, The command and output is below. The thing that I find odd is that, to the best of my knowledge, ansible uses the ssh client config of user by default. The same user that runs ansible (root in this case) gets the correct username (not root) and SSH key from ~/.ssh/config and is able to

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-12 Thread Kai Stian Olstad
On 12. juli 2017 20:11, Anfield wrote: How would I get around this issue on the localhost? I tried adding become_user: root and that didnt work either It must be something with your setup. Does this command work for the same user you are running ansible-playbook with? sudo cat

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-12 Thread Dick Davies
Copy the public keys into the playbook directory. On 12 July 2017 at 19:11, Anfield wrote: > How would I get around this issue on the localhost? I tried adding > become_user: root and that didnt work either > >> > -- You received this message because you are subscribed

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-12 Thread Anfield
How would I get around this issue on the localhost? I tried adding become_user: root and that didnt work either > -- 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

Re: [ansible-project] Ansible fails to execute a playbook when the value for 'hosts' is defined somewhere in inventory

2017-07-12 Thread Brian Coca
No, inventory vars are always flattened to the host, 'all' is a way to assign a variable to all hosts, but it is still 'host level'. Use vars/vars_files or extra_vars instead. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project"

Re: [ansible-project] "/bin/sh" isn\'t allowed to be executed

2017-07-12 Thread Brian Coca
It would help if you show the commands attempted and the full error, even using -vvv to make the output verbose. - Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails

Re: [ansible-project] Schedule Playbook with crontab

2017-07-12 Thread Brian Coca
bin/ansible is for Adhoc tasks, you want bin/ansible-playbook is for executing playbooks this makes no sense: /usr/bin/ansible /home/ansibleuser/ansible/playbooks/ansible-playbook device_bak_2.yml I think you want: /usr/bin/ansible-playbook /home/ansibleuser/ansible/playbooks/device_bak_2.yml

[ansible-project] Schedule Playbook with crontab

2017-07-12 Thread Phil F
Hi, I am attempting to schedule a playbook to run every night to backup Cisco network device configs using crontab. The playbook is a simple ios_command task executing show run on the Cisco Devices. The playbook works fine when I run it manually and I have got to the point where crontab is

[ansible-project] need help on multipath

2017-07-12 Thread rakesh boinapally
we usually perform lot of multipath tasks in our company. On a server if i want to configure multipath for disk aliases multipath -ll|egrep "dm-|size"|sed -e 's/\]/ /g'|sed -e 'N' -e 's/\n/ /'|awk '{print $6,$2}'|sed -e 's/\[size=//g'|sed -e 's/(//g'|sed -e 's/)//g'|sed -e 's/\.0G/G/'|sort

Re: [ansible-project] Why can I debug this variable syntax but not set_fact the same variable syntax?

2017-07-12 Thread Kai Stian Olstad
On 12. juli 2017 06:36, burns...@umn.edu wrote: Why does this syntax work for debug but not set_fact? How can I actually use the debug output on the other host? Pure luck that the debug work and you yaml syntax is wrong of set_fact. *Playbook:* --- - name: Target Host hosts: "{{ target

[ansible-project] Re: Ansible syslogs to user.notice on the managed machine - can I change this?

2017-07-12 Thread Ed Greenberg
This is how I solved the problem in rsyslog.conf: if $pri-text == 'user.notice' and $msg contains 'ansible' then { /var/log/ansible.log stop } I put this pretty close to the top of the rsyslog.conf, above GLOBAL DIRECTIVES. -- You received this message because you are subscribed to

Re: [ansible-project] Ansible ACI Modules

2017-07-12 Thread Rod Oliver
Hi Dag, Sorry about the late response. I was wondering how well used they are, how stable and reliable the modules are considered to be. The background is that my organisation is looking for a solution to migrate ACI provisioning and I'd like to advocate Ansible as a possibility but would like

Re: [ansible-project] What are fire and forget tasks ?

2017-07-12 Thread Philippe Eveque
this is the maximum allocated run time set for the task in your example: - run the simulated long running task for a max of 45 s (in the case of long running task, you do not want it to run for ever) - poll status every 5 second (so every 5 seconds there is to check the status like whether the

Re: [ansible-project] Ansible fails to execute a playbook when the value for 'hosts' is defined somewhere in inventory

2017-07-12 Thread ishan jain
So is there no way to define something like 'global' variables along with the inventory ? I thought the implicit 'all' group can be treated like global variables. On Tuesday, 11 July 2017 19:27:06 UTC+2, Brian Coca wrote: > > The 'hostList1' inventory variable is not available until AFTER the

[ansible-project] "/bin/sh" isn\'t allowed to be executed

2017-07-12 Thread Rod Oliver
I'm trying to run commands against a remote host and even a simple ad hoc ping fails, with the error '"/bin/sh" isn\'t allowed to be executed'. The error message changes to '/bin/bash' when I add "executable = /bin/bash" in ansible.cfg. Adding the -b switch makes no difference. When looging in

Re: [ansible-project] What are fire and forget tasks ?

2017-07-12 Thread Luvpreet Singh
Thanks Philippe, "Poll - 0" means that never check the status as the connection will be broken. What does "async - 1" means ? Can you explain this example to me ? - name: simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec command: /bin/sleep 15 async: 45