Re: [ansible-project] ios_command multiple commands

2019-01-04 Thread Veera Kumar
Hi, You can give list of commands and all the outputs will register in mentioned variable name. And instead output.stdout[0] just give output.stdout. But the problem is variable I.e output.stdout will only contain outputs only. Means issued command will not be there. Try with blockinfile module

[ansible-project] Re: finding first host meeting a condition

2019-01-04 Thread rjwagner . dba
Nevermind; figured this out. Was actually pretty simple. I declared a variable as an empty string, iterated over the hosts w/ hostvars, updated the variable with the item, and used when: (variable | length > 0 ) and (ps_output | length > 0). Including the variable in the when: test was

[ansible-project] ios_command multiple commands

2019-01-04 Thread Eduardo Nunes Pereira
- name: Network Getting Started First Playbook connection: network_cli gather_facts: false hosts: lab tasks: - name: run multiple commands on remote nodes ios_command: commands: - show run register: output - name: save output copy: content: "{{ output.stdout[0] }}" dest: "/etc/ansible/backup/{{

Re: [ansible-project] AnsibleUndefinedVariable: 'dict object' has no attribute

2019-01-04 Thread Hugo Gonzalez
template: {% for host in groups['all'] %} {{ hostvars[host]['ansible_facts']['ssh_host_key_ecdsa_public'] }} {% endfor %} This template also works for me, and the keys are different. So you might want to try it: {% for host in groups['all'] %} {{

Re: [ansible-project] synchronize between two remote servers

2019-01-04 Thread John Harmon
On Friday, January 4, 2019 at 11:34:13 AM UTC-7, Kai Stian Olstad wrote: > > On Friday, 4 January 2019 19:04:38 CET John Harmon wrote: > > I have found other docs on this, but can't seem to "fix" my issue with > what > > I am finding. Consider the following playbook: > > > > - hosts:

Re: [ansible-project] synchronize between two remote servers

2019-01-04 Thread Kai Stian Olstad
On Friday, 4 January 2019 19:04:38 CET John Harmon wrote: > I have found other docs on this, but can't seem to "fix" my issue with what > I am finding. Consider the following playbook: > > - hosts: mybackup > gather_facts: false > vars: > one_week:

Re: [ansible-project] AnsibleUndefinedVariable: 'dict object' has no attribute

2019-01-04 Thread Hugo Gonzalez
Hello Freddie On 1/3/19 5:23 PM, Freddie Eisa wrote: What version are you running? The linux host is centos7.6 Ansible is 2.5.1, managed hosts are two Centos 7.6 cloud servers in my tests. I tried the following: - gather facts (automatic) - locally render the template *on the controlling

[ansible-project] synchronize between two remote servers

2019-01-04 Thread John Harmon
I have found other docs on this, but can't seem to "fix" my issue with what I am finding. Consider the following playbook: - hosts: mybackup gather_facts: false vars: one_week: "/devbackup/nonprod_images/one_week_old" two_week: "/devbackup/nonprod_images/two_week_old" tasks:

[ansible-project] Consolidated configuration file handling?

2019-01-04 Thread Robert Rapplean
I've been digging through the documentation and have run into a wall in terms of Ansible's ability to manage the contents of configuration files. This might have something to do with search engine results returning articles on how to configure Ansible itself, so I figured I'd ask. What I

Re: [ansible-project] Ansible Lookup Issue

2019-01-04 Thread Freddie Eisa
Thanks that worked > On Jan 4, 2019, at 9:29 AM, Kai Stian Olstad > wrote: > > On Friday, 4 January 2019 16:32:37 CET Freddie Eisa wrote: >> Hello, >> >> Im running the following >> >> set_fact: >> >>host: "{{ lookup('nios', 'record:host', filter={'name': '{{ >> ansible_facts.fqdn

Re: [ansible-project] Ansible Lookup Issue

2019-01-04 Thread Kai Stian Olstad
On Friday, 4 January 2019 16:32:37 CET Freddie Eisa wrote: > Hello, > > Im running the following > > set_fact: > > host: "{{ lookup('nios', 'record:host', filter={'name': '{{ > ansible_facts.fqdn }}' }, provider=nios_provider) }}" > > > Im trying to pass the ansible_facts.fqdn as the

[ansible-project] Re: Rebooting a Cisco ASA device

2019-01-04 Thread Sahar
Thanks. My ansible version is: 2.7.4. This command let me proceed. Is this a normal output? TASK [wait_for] skipping: [Fw4Script-01.tor.bellnhs.int] ok:

[ansible-project] Ansible Lookup Issue

2019-01-04 Thread Freddie Eisa
Hello, Im running the following set_fact: host: "{{ lookup('nios', 'record:host', filter={'name': '{{ ansible_facts.fqdn }}' }, provider=nios_provider) }}" Im trying to pass the ansible_facts.fqdn as the name. If i use a static host it works. Thanks Freddie -- You received

[ansible-project] finding first host meeting a condition

2019-01-04 Thread rjwagner . dba
Hey all- I need to find the first host in the inventory running a particular process. I can query the hosts to look for the process using a shell pipeline and register the output in a variable (call it ps_output). But I'm stuck on how to iterate over the hosts, examining the value of

[ansible-project] Re: rolling tasks for multiple clusters?

2019-01-04 Thread Doug OLeary
Well, that's not the answer I was looking for! :) Thanks for the reply. In case it's not clear, I'm very new to ansible and thought my need for ansible tower was a couple of months if not a year or more away. In the meantime, I'll look into those tools. I use pssh for remote parallel

Re: [ansible-project] Re: Dynamic Inventory using Active Directory / LDAP

2019-01-04 Thread Balz Aschwanden
Hey Sam I never tried to import ants directly. Depending on your use case, it might be easier to 1) call it using subprocess or 2) copy the inventory file and adapt it to your needs. Regards, Balz On 4 Jan

[ansible-project] Pyinstaller doesn't import ansible library (Python API v2 of Ansible)

2019-01-04 Thread Kawther Arfaoui
Hello all, I'm trying to execute a binary file generated by Pyinstaller , but I have got this error: *Traceback (most recent call last): File "kubernetes_deployer/cm2_deploy_ansible.py", line 32, in File

[ansible-project] Re: Dynamic Inventory using Active Directory / LDAP

2019-01-04 Thread Samer Odeh
Hi, Thanks for sharing, I spent sometime trying to make it work ... but I am getting an error about Python module: # python Python 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>

Re: [ansible-project] Re: Rebooting a Cisco ASA device

2019-01-04 Thread Veera Kumar
Please refer below link as well, https://gdykeman.github.io/2018/06/26/ios-upgrades/ On Fri, Jan 4, 2019 at 1:25 PM Ganesh Nalawade wrote: > Try adding "meta: reset_connection" after wait_for task and before check > version task. > Also, which Ansible version are you using? > > Regards, >

[ansible-project] Re: Ansible and Huawei

2019-01-04 Thread Ganesh Nalawade
The error you are seeing is coming from ncclient library. Are you able to connect to the device using a sample python script that uses ncclinet library? Reference python script: https://github.com/ncclient/ncclient/blob/master/examples/nc01.py Regards, Ganesh On Thursday, 3 January 2019