Re: [ansible-project] Multiple commands output in a single file

2021-05-31 Thread The Vandyy Vines
I think you can test once with with_items: "{{ print_output.stdout }} On Tue, 1 Jun 2021 at 8:12 AM, Djay wadhwa wrote: > Hi Pushp, > > Script worked but desired outcome not achieved. still getting output of > only 1st command ( show ip name-servers) in the file. > > - name: Check Ip routes >

Re: [ansible-project] Multiple commands output in a single file

2021-05-31 Thread Djay wadhwa
Hi Pushp, Script worked but desired outcome not achieved. still getting output of only 1st command ( show ip name-servers) in the file. - name: Check Ip routes hosts: routers gather_facts: false connection: local vars: cli: username: "{{ hdn_user_rw }}" password: "{{ h

Re: [ansible-project] Multiple commands output in a single file

2021-05-31 Thread Rajthecomputerguy
There is a indentation error in your playbook - name: save output to a file lineinfile: create: yes line: "{{item}}" path: /opt/ansible/dev/Dheeraj/verf/adnan/Log/{{ inventory_hostname }}.txt with_items: "{{ print_output.stdout[1] }}" On Tue, Jun 1, 2021 a

Re: [ansible-project] Multiple commands output in a single file

2021-05-31 Thread Djay wadhwa
Hi Pushpraj, I am getting the error below if i try to run this with lineinfile as per suggestion. Please see my playbook as attached. Appreciate your help --- - name: Routers data hosts: routers gather_facts: false connection: local vars: cli: username: "{{ hdn_user_rw }}"

Re: [ansible-project] How To Get Hostname, OS and Version From Ansible Facts In A List Format?

2021-05-31 Thread Stefan Hornburg (Racke)
On 31.05.21 15:33, 'Marcus Hayhurst' via Ansible Project wrote: > Hello everyone, > > I'm attempting to get a list of information of all my machines to send > in an email: > > *Hostname - OS (and) Version * > > so essentially: > > *{{ ansible_hostname }} - {{ ansible_distribution }} {{ > ansibl

Re: [ansible-project] Multiple commands output in a single file

2021-05-31 Thread Rajthecomputerguy
Can you try this Use this to write several strings into a file: - name: save output to a file lineinfile: create: yes line: "{{item}}" path: ./output/{{ inventory_hostname }}.txt with_items: "{{ print_output.stdout[1] }}" On Mon, May 31, 2021 at 11:28 AM Djay wadhwa wrote: > H

Re: [ansible-project] Re: Handling Prompt in Cisco IOS_CONFIG module

2021-05-31 Thread Rajthecomputerguy
Yes, ios_config does not support prompting, Can you disable prompting and re-enable once a task is done? On Mon, May 31, 2021 at 4:55 PM R.B. Kumar wrote: > I got the answer from another forum. It is just a workaround only using > cli_command module > > I read ansible 2.7 dont support prompt in

Re: [ansible-project] How To Get Hostname, OS and Version From Ansible Facts In A List Format?

2021-05-31 Thread Rajthecomputerguy
Can you show me the error message? On Mon, May 31, 2021 at 7:03 PM 'Marcus Hayhurst' via Ansible Project < ansible-project@googlegroups.com> wrote: > Hello everyone, > > I'm attempting to get a list of information of all my machines to send in > an email: > > *Hostname - OS (and) Version * > > so

[ansible-project] How To Get Hostname, OS and Version From Ansible Facts In A List Format?

2021-05-31 Thread 'Marcus Hayhurst' via Ansible Project
Hello everyone, I'm attempting to get a list of information of all my machines to send in an email: *Hostname - OS (and) Version * so essentially: *{{ ansible_hostname }} - {{ ansible_distribution }} {{ ansible_distribution_version }}* I tried something like this but it does not work: - na

[ansible-project] Juniper rule-sets

2021-05-31 Thread Mauricio Tavares
For those who are using the juniper playbooks, is it me or the only way to create/edit rule-sets in ansible is to, for instance, have a template of the relevant session (or the entire config) and replace it as needed? -- You received this message because you are subscribed to the Google Gro

[ansible-project] Re: Handling Prompt in Cisco IOS_CONFIG module

2021-05-31 Thread R.B. Kumar
I got the answer from another forum. It is just a workaround only using cli_command module I read ansible 2.7 dont support prompt in ios_config. We need to user ios_command with loop as below - name: delete_crypto_map cli_command: command: "{{ item }}" prompt: - "Are you sure

[ansible-project] Re: Handling Prompt in Cisco IOS_CONFIG module

2021-05-31 Thread R.B. Kumar
Can anybody have requirement similar to this? I tried with cli_command, ios_command too.. On Monday, May 31, 2021 at 2:15:09 AM UTC+5:30 R.B. Kumar wrote: > Hello All - Using Ansible v2.7 > I am tying to execute Cisco IOS commands that prompts to type Y/N. Looks > like the *Prompt: *is not