[ansible-project] How to incorporate awk command in ansible shell module

2019-08-27 Thread Mohtashim S
Below is my playbook: - name: "Collecting File details" shell: "ls -ltr {{ item }} | awk '{$2=$4=$5=""; print $0}' | tr '\n' '\t' | tr -s " "; with_fileglob: - "{{ playbook_dir }}/tmpfiles/*" I get syntax error due to the awk command as below. ERROR! Syntax Error while

[ansible-project] Re: ansible error 'first argument must be string or compiled pattern'

2019-08-27 Thread Fae Az
found the solution. i should use '#\s+Hostname\=' in quotes -- 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+unsubscr...@googlegroups.com. To v

[ansible-project] Cannot use the pexpect module with Keybase pgp and multiple ':' characters

2019-08-27 Thread Andrew Graham
I'm wondering why the pexpect module is failing in this circumstance, perhaps my regex is not right, but the double ':' may be messing with things as well and I'm not sure how to approach handling it. if I run- keybase pgp encrypt -m 'secret' | keybase pgp decrypt Then this prompt may occ

Re: [ansible-project] list seen as unicode, not sure why or how to correct

2019-08-27 Thread Nicholas Britton
That provides me this: TASK [debug number on array after unuiqe] *** ok: [localhost] => { "msg": "'\"10\"'" } how do i clean that up to onl

Re: [ansible-project] Ansible Windows Custom Modules

2019-08-27 Thread Jordan Borean
> > 1. Is it allowed (as per the GNU license) to also customize the existing > Windows Modules or only add new ones? > Please note I am not an IP lawyer so I recommend you talk to your company's legal team if you actually want legal advice. Of course, any community member can make changes to t

Re: [ansible-project] list seen as unicode, not sure why or how to correct

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 22:32, Nicholas Britton wrote: > And this error when the next uri call attempts to use it, notice, how at > the end i puts the list in unicode format, and the url does not know how to > interpret that. > TASK [list sessions for 886000428027 - ams] > ***

Re: [ansible-project] Can I run plays in parallel?

2019-08-27 Thread Jonathan Lozada De La Matta
Right. Just mentioning an option. On Tue, Aug 27, 2019 at 4:37 PM Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 27.08.2019 22:33, Jonathan Lozada De La Matta wrote: > > you can run multiple plays in one playbook. For example: > > > > hosts: localhost > > roles: > >- create_v

Re: [ansible-project] Can I run plays in parallel?

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 22:33, Jonathan Lozada De La Matta wrote: > you can run multiple plays in one playbook. For example: > > hosts: localhost > roles: >- create_vm > > hosts: vm_created > roles: >- configure_vm > > this also assumes you are using add_host in the first play. Nick is asking for

Re: [ansible-project] Can I run plays in parallel?

2019-08-27 Thread Jonathan Lozada De La Matta
you can run multiple plays in one playbook. For example: hosts: localhost roles: - create_vm hosts: vm_created roles: - configure_vm this also assumes you are using add_host in the first play. On Tue, Aug 27, 2019 at 4:26 PM Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 2

[ansible-project] list seen as unicode, not sure why or how to correct

2019-08-27 Thread Nicholas Britton
I am building a list with output stored from a uri call: - name: Get hostgroup info uri: url: "{{baseurl}}views/host-groups?$query=hostGroup.storageDeviceId%20eq%20'{{ui}}'%20and%20hostGroup.hostGroupName%20in%20[{{vmc02}}]" method: get validate_certs: no headers:

Re: [ansible-project] Can I run plays in parallel?

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 22:21, Nick Kakouros wrote: > Is there a way to say to ansible to run all plays in parallel? I could find > workaround in bash, but I would like to know if this is possible in ansible. It's not possible in Ansible, so you would need to run multiple ansible-playbook in bash. -- Ka

[ansible-project] Re: Best practice: Ansible default filename extension for its files

2019-08-27 Thread Gilson Soares [GM]
Thanks Kai for your thoughts. On Tuesday, August 27, 2019 at 3:17:56 PM UTC-3, Gilson Soares [GM] wrote: > > I'm new using Ansible but I'd like to start using best practices. > > I know that Ansible uses YAML syntax files, not "Ansible format". > Looking thru the docs, there are several documents

[ansible-project] Can I run plays in parallel?

2019-08-27 Thread Nick Kakouros
I have 10 files with a play each. In total these plays provision 4 hosts. I have written a function in bash that takes as an argument the host I want to provision and calls ansible with all 10 playbooks and a `-l`(limit) parameter for only the host I provided. I can pass multiple hosts too. So,

Re: [ansible-project] Registering value from JSON output

2019-08-27 Thread Vladimir Botka
On Tue, 27 Aug 2019 12:44:15 -0700 (PDT) Cade Lambert wrote: > [...] > "output": { > "json": { > "results": [ > { > "name": "item1" > "id": "26" > } > { > "name": "item2"

Re: [ansible-project] Support for installing Ansible on Windows

2019-08-27 Thread Jordan Borean
No plans, it will work but in the odd case it doesn’t you won’t get any help from GitHub unless you ca replicate it on an actual Linux platform. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receivin

Re: [ansible-project] Registering value from JSON output

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 21:44, Cade Lambert wrote: > I'm trying to register the value of a JSON object only when another JSON > object is equal to a certain value, but I just can't figure out how I'd do > that. > > For example, this is my JSON output which is registered in the variable > results_var: > > "

[ansible-project] Re: Search for string in stdout for failed_when

2019-08-27 Thread JP-OKC
Thanks Kai, That worked. On Tuesday, August 27, 2019 at 2:10:20 PM UTC-5, JP-OKC wrote: > > how can I pull a string from the stdout and use it for failed_when?I > run a command on a switch and then I want to match a string w/in that > output to determine if it failed or not. > > Here's wha

[ansible-project] Registering value from JSON output

2019-08-27 Thread Cade Lambert
I'm trying to register the value of a JSON object only when another JSON object is equal to a certain value, but I just can't figure out how I'd do that. For example, this is my JSON output which is registered in the variable results_var: "output": { "json": { "results": [

Re: [ansible-project] Support for installing Ansible on Windows

2019-08-27 Thread 'John Thompson' via Ansible Project
Thanks for the reply Jonathan. Much appreciated. Is there an official answer out there publicly, or someone who can confirm in the product group? J On Mon, Aug 26, 2019, 13:57 Jonathan Lozada De La Matta wrote: > someone else can answer officially but, as far as I know there is no plan > to s

Re: [ansible-project] Search for string in stdout for failed_when

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 21:10, JP-OKC wrote: > how can I pull a string from the stdout and use it for failed_when?I > run a command on a switch and then I want to match a string w/in that > output to determine if it failed or not. > > Here's what the playbook looks like: > > --- > - name: Check the ssh

[ansible-project] Search for string in stdout for failed_when

2019-08-27 Thread JP-OKC
how can I pull a string from the stdout and use it for failed_when?I run a command on a switch and then I want to match a string w/in that output to determine if it failed or not. Here's what the playbook looks like: --- - name: Check the ssh keypair on a Nexus 9k hosts: all gather_fact

Re: [ansible-project] Best practice: Ansible default filename extension for its files

2019-08-27 Thread Kai Stian Olstad
On 27.08.2019 20:17, Gilson Soares [GM] wrote: > I'm new using Ansible but I'd like to start using best practices. IMHO it's no best practice to fit all, it all comes down to what's best for you. > I know that Ansible uses YAML syntax files, not "Ansible format". Well, that's not entirely corre

[ansible-project] Best practice: Ansible default filename extension for its files

2019-08-27 Thread Gilson Soares [GM]
I'm new using Ansible but I'd like to start using best practices. I know that Ansible uses YAML syntax files, not "Ansible format". Looking thru the docs, there are several documents using interchangeably YML and YAML. For example: using ansible_playbook , *must* include the extension. What a

[ansible-project] Re: Rolling out latest Virtualbox via ansible?

2019-08-27 Thread Knut Karevoll
What you are looking for is the set_fact module. This allows you to set a variable in the current context which will allow you to use it in the subsequent tasks in the play. On Tuesday, August 27, 2019 at 3:42:28 PM UTC+2, scorp123 wrote: > > I want to roll out the latest Virtualbox onto my Ubun

Re: [ansible-project] when: ansible conditional's based on distribution major version

2019-08-27 Thread Jeffrey Agnitsch
That worked thank you very much! On Tuesday, August 27, 2019 at 10:29:28 AM UTC-5, Michael M wrote: > > Jeffrey, > > Try: > > when: ansible_distribution_major_version == '7' > > On Tue, Aug 27, 2019 at 8:07 AM Jeffrey Agnitsch > > wrote: > > > > I am trying to copy over .rpm files based on t

Re: [ansible-project] Adding a Fact to a dict for Cisco Interf.

2019-08-27 Thread Vladimir Botka
> - set_fact: > cisco_ios: "{{ cisco_ios.interfaces|combine(interfaces) }}" Errata: - set_fact: cisco_ios: "{{ cisco_ios|combine({'interfaces': interfaces}) }}" -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To un

Re: [ansible-project] when: ansible conditional's based on distribution major version

2019-08-27 Thread Michael Mullay
Jeffrey, Try: when: ansible_distribution_major_version == '7' On Tue, Aug 27, 2019 at 8:07 AM Jeffrey Agnitsch wrote: > > I am trying to copy over .rpm files based on the major version of the > operating system I believe I am referencing the ansible_facts part > incorrectly does anyone have a

Re: [ansible-project] Adding a Fact to a dict for Cisco Interf.

2019-08-27 Thread Vladimir Botka
On Tue, 27 Aug 2019 07:44:24 -0700 (PDT) Spiro Mitsialis wrote: > I have the following that is not working. > > vars: > cmdb: xkjsdflkjsjdl4d > cisco_ios: >interfaces: > gigabit1/0/1: > name: Gigabit1/0/1 > status: up > gigabit1/0/2:

[ansible-project] when: ansible conditional's based on distribution major version

2019-08-27 Thread Jeffrey Agnitsch
I am trying to copy over .rpm files based on the major version of the operating system I believe I am referencing the ansible_facts part incorrectly does anyone have an example of the right way? tasks: - name: Copy kernel RHEL6 copy: src: /etc/ansible/files/individual_files/te

[ansible-project] Adding a Fact to a dict for Cisco Interf.

2019-08-27 Thread Spiro Mitsialis
I have the following that is not working. vars: cmdb: xkjsdflkjsjdl4d cisco_ios: interfaces: gigabit1/0/1: name: Gigabit1/0/1 status: up gigabit1/0/2: name: Gigabit1/0/2 status: down tasks: - name: Test in loo

[ansible-project] Rolling out latest Virtualbox via ansible?

2019-08-27 Thread scorp123
I want to roll out the latest Virtualbox onto my Ubuntu 18.04 servers via ansible. What I've managed so far is an installer-script that gets copied over to any host in the "virtualbox" hosts group (as per ansible hosts configuration file), then gets remotely executed and does this job. While th

[ansible-project] inventory file for playbooks with only uri calls

2019-08-27 Thread Nicholas Britton
I am working on a set of playbooks for a hitachi storage automation. They utilize a cmrest server, that manages the connection to each storage array. So all of the tasks are ran on the localhost to the same url base, but there is a var in the path that indicates what storage array to run a

[ansible-project] Re: Ansible and Windows Project

2019-08-27 Thread Simon-Pierre Diamond
Anyone has something to say about this subject? Is playing with Powershell and the GPO comes to the same as playing to the registry directly? I need to create policies, and Powershell does not seem to be the answer, as not super versatile for GPOs with the cmdlet. Anyone has more insights on t

[ansible-project] Re: loop through a json object

2019-08-27 Thread Nicholas Britton
I got this figured out. I needed to add a step before, to create a list with all the values , then find the max of it. On Monday, August 26, 2019 at 12:42:47 PM UTC-5, Nicholas Britton wrote: > > Thank you, that has helped alot. > > I was looking at the max option: > > - name: debug - show

[ansible-project] Attaching/detaching storage domains

2019-08-27 Thread harry devine
We have a Red Hat RHV setup that uses NFS for its storage. We are moving to a Red Hat Hyperconverged solution that uses GlusterFS for its storage. We have a Data domain called Migrate that we use to move the VM disks from the NFS storage domain to this NFS migrate domain. What we'd like to do

Re: [ansible-project] Loop with hostvars groups

2019-08-27 Thread Rafael Tomelin
Hi Vinoth, Thanks, your recommendation is work. On Tue, Aug 27, 2019 at 9:10 AM vinoth kumar wrote: > Hi > remove hostvars[host].ansible_hostname and try with > hostvars[host].ansible_facts.hostname if you are doing it from setup module > or gayher_facts > > If it’s not fixed put your playbook

Re: [ansible-project] Loop with hostvars groups

2019-08-27 Thread vinoth kumar
Hi remove hostvars[host].ansible_hostname and try with hostvars[host].ansible_facts.hostname if you are doing it from setup module or gayher_facts If it’s not fixed put your playbook here On Tue, 27 Aug 2019 at 5:36 PM, Rafael Tomelin wrote: > > Hi, > > I have an inventory with groups this conf

[ansible-project] Loop with hostvars groups

2019-08-27 Thread Rafael Tomelin
Hi, I have an inventory with groups this configuration the DB Servers: [db] 192.168.0.1 192.168.0.2 192.168.0.3 I want to do loop the groups and get variable ipaddress in template.j2. My loop is: {% for host in groups['db'] -%} hostall postgres {{ hostvars[host].ansible_hos

[ansible-project] ansible error 'first argument must be string or compiled pattern'

2019-08-27 Thread Fae Az
I have this code in my playbook: - hosts: standby remote_user: root tasks: - name: replace hostname in config replace: path: /opt/agentd.conf regexp: #\s+Hostname\= replace: Hostname={{hname}} backup: yes - name: add database array in files lineinfile: