[ansible-project] Ansible running command in two hosts and compare the outputs in one playbook

2019-01-28 Thread Ansible Krazy
Ask Question -1 I've one playbook which runs on 2,3 hosts. I want to compare output of a command run on host 1 with output of command run on host 2 Something like below - hosts: 1,2,3 tasks: - name: Check file in tmp shell: ls -ltrh

[ansible-project] Access same variable with different value from multiple json files

2019-01-28 Thread Coding
I have multiple json files look like this: temp/file-a.json: { “x”: 5”, “y”: “name1”, } tmp/file-b.jsob: { “x”: “10”, “y”: “name2”, } tmp/file-c.json: { “x”: “7”, “y”: “name3”, } ... and more All json files are on the same server where I place my playbook. My

Re: [ansible-project] Running yum updates with ansible

2019-01-28 Thread Jonathan Lozada De La Matta
what version of ansible are you using? On Mon, Jan 28, 2019 at 6:02 PM 'Chris Bidwell - NOAA Federal' via Ansible Project wrote: > Hey all, > > So I've done a lot of yum updates with ansible and several times I get > issues where partial updates are run and it says it's been completed, >

[ansible-project] Running yum updates with ansible

2019-01-28 Thread 'Chris Bidwell - NOAA Federal' via Ansible Project
Hey all, So I've done a lot of yum updates with ansible and several times I get issues where partial updates are run and it says it's been completed, however, I reboot and I'm in a kernel panic because the new kernel didn't update properly so I have to revert to the previous kernel and remove the

[ansible-project] How ansible works? without an agent on target device

2019-01-28 Thread Ethashamuddin Mohammed
Without an agent on target host, Ansible is able to perform tasks like for example: adding a user(`-m user`). [Here](https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html) are the list of all modules To understand this, I read this

Re: [ansible-project] set_fact with default value of type string

2019-01-28 Thread John Harmon
On Monday, January 28, 2019 at 3:02:15 PM UTC-7, Kai Stian Olstad wrote: > > On 28.01.2019 22:41, John Harmon wrote: > > I know I can define the variable previous to this, but I am wondering > > if I > > can combine setting a variable with a default value within set_fact. > > If > >

Re: [ansible-project] set_fact with default value of type string

2019-01-28 Thread Kai Stian Olstad
On 28.01.2019 22:41, John Harmon wrote: I know I can define the variable previous to this, but I am wondering if I can combine setting a variable with a default value within set_fact. If possible, I wonder if my syntax is wrong (likely)? I can't seem to find much documentation on this. If

Re: [ansible-project] Boot signal from a remote Pi

2019-01-28 Thread Pshem Kowalczyk
Hi, One way of doing it would be to use ansible in 'pull' mode in one of the boot scripts (like rc.local). kind regards Pshem On Sun, 27 Jan 2019 at 03:00, Sergio Fernández wrote: > Hi there! > > I would like to know the best way to perform this: > > I will be using the Vault (from

Re: [ansible-project] Ansible parse variables with special characters

2019-01-28 Thread Eric Dunn
I had ame issue. Try escaping dollar sign X : '\${name} --loglevel = \${loglevel}, --type=\${type}' Thank you, Eric Dunn Senior DevOPS Support Engineer IPConfigure, Inc t: 877-207-1112 ext. 104 e: eric.d...@ipconfigure.com www.ipconfigure.com The content of this email is confidential and

[ansible-project] set_fact with default value of type string

2019-01-28 Thread John Harmon
I know I can define the variable previous to this, but I am wondering if I can combine setting a variable with a default value within set_fact. If possible, I wonder if my syntax is wrong (likely)? I can't seem to find much documentation on this. If you have a link to this answer in the

Re: [ansible-project] with_items stat too verbose

2019-01-28 Thread 'Felix Fontein' via Ansible Project
Hi, check out the label directive for loop_control: https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#loop-control Cheers, Felix On Mon, 28 Jan 2019 07:54:39 -0800 (PST) rjwagner@gmail.com wrote: > Hey all- > > I'm using stat and with_items to check proper

[ansible-project] Ansible module yum module

2019-01-28 Thread Anand Vamsi
Ansible Team- I'm in situation where i need to remove a package without removing the dependencies using yum module for centos/redhat. I don't see any option in Ansible yum reference page which exclude deps. Only option i see is shell: rpm -e --nodeps Is it possible attain this using yum

Re: [ansible-project] Ansible parse variables with special characters

2019-01-28 Thread Kai Stian Olstad
On 28.01.2019 18:31, pnagaraj7...@gmail.com wrote: I need to pass certain strings with special characters like $ to variables. I was able to parse by providing the values in single quotes or using \ when the string contains a single $ . Ex below x is my variable. X : '${name}' --> this works.

Re: [ansible-project] with_items stat too verbose

2019-01-28 Thread Jonathan Lozada De La Matta
using -v should be enough to show changes but, not the whole output. On Mon, Jan 28, 2019 at 10:54 AM wrote: > Hey all- > > I'm using stat and with_items to check proper ownership of various files. > Is there any way to reduce the volume of output (i.e., eliminate everything > in red, below)? >

[ansible-project] Ansible parse variables with special characters

2019-01-28 Thread pnagaraj7656
I need to pass certain strings with special characters like $ to variables. I was able to parse by providing the values in single quotes or using \ when the string contains a single $ . Ex below x is my variable. X : '${name}' --> this works. But when my variable value is complex containing

Re: [ansible-project] Block & rescue misconception

2019-01-28 Thread Kai Stian Olstad
On 28.01.2019 17:52, sergio.fernan...@exoinvesting.com wrote: instance). But I don't know why the rescue tasks never runs. And the role deploy-api/tasks/main.yml looks like this: --- - block: - name: Create .ssh path for user become: yes file: path: "{{ deploy_path }}/.ssh"

[ansible-project] Block & rescue misconception

2019-01-28 Thread sergio . fernandez
Hi all, I'm using Ansible 2.5.11, using the EC2 dynamic inventory script. I'm trying to do some tasks over an instance with a role using block and rescue, so if one of the tasks fails, the rescue task runs (removing the instance). But I don't know why the rescue tasks never runs. I'm running

Re: [ansible-project] Create variables in hash

2019-01-28 Thread Rafael Tomelin
Hi, thanks Resolved On Fri, Jan 25, 2019 at 5:23 PM boncalo mihai wrote: > > key: {{ my_key | hash('sha1') }} ... > > Hashing filters > > New in version 1.9. > > To get the sha1 hash of a string: > > {{ 'test1' | hash('sha1') }} > > To get the md5 hash of a string: > > {{ 'test1' | hash('md5')

[ansible-project] with_items stat too verbose

2019-01-28 Thread rjwagner . dba
Hey all- I'm using stat and with_items to check proper ownership of various files. Is there any way to reduce the volume of output (i.e., eliminate everything in red, below)? rowagn@localhost:~/data-platform/oracle/ansible/db12r2$ cat test.yml --- - hosts: localhost tasks: - name: Stat

Re: [ansible-project] Access specific elements using with_items / with_subelememts

2019-01-28 Thread Kai Stian Olstad
On 28.01.2019 16:21, Saranya N wrote: I have a variable file with dictionary under a role like below format : Applformat: - Appname : app-main Parameters: - x : a Y : b Z : c - x : d Y : e - z : f - Appname : app-relay

[ansible-project] Ansible Cisco 5k Port-Profile issues

2019-01-28 Thread Mark Giusti
Hi everyone, I am rather new to network automation so do excuse my lack of knowledge on the subject. I wish to setup a playbook for a cisco nexus 5k that will assign a number of interfaces to a predefined port-profile. Is there anyone who could provide an example of such a playbook or if it is

Re: [ansible-project] Ansible - save config - Small business SG 500

2019-01-28 Thread Dick Visser
Your 'register' statement should be less indented On Mon, 28 Jan 2019 at 16:25, Jean berjonneau wrote: > *Ansible version = 2.7.5* > > > Hello all, > > I am using Ansible to save configurations of all my switches but they are > CISCO small businesses. > > I am curently using a playbook like

[ansible-project] Ansible - save config - Small business SG 500

2019-01-28 Thread Jean berjonneau
*Ansible version = 2.7.5* Hello all, I am using Ansible to save configurations of all my switches but they are CISCO small businesses. I am curently using a playbook like this : --- - hosts: SW-Switches gather_facts: no connection: local vars_prompt: - name: "mgmt_username"

[ansible-project] Access specific elements using with_items / with_subelememts

2019-01-28 Thread Saranya N
I have a variable file with dictionary under a role like below format : Applformat: - Appname : app-main Parameters: - x : a Y : b Z : c - x : d Y : e - z : f - Appname : app-relay Parameters: - x : g Y : h

[ansible-project] Re: ModuleNotFoundError: No module named 'ansible.parsing'

2019-01-28 Thread shenhaowee
在 2019年1月28日星期一 UTC+8下午4:10:51,shenh...@gmail.com写道: > > From what I saw in my environment I got this error when the script wasn't > in my root directory. > > [root@xxx API]# ./my_ansible.py Traceback (most recent call last): > File "./my_ansible.py", line 5, in > from

Re: [ansible-project] Re: getting error while checking which java using ansible

2019-01-28 Thread Karl Auer
Make a list of possible places that a java executable might be, in order of preference, and work through the list checking each location in turn. Or use the shell command I gave you last week to search an entire directory tree for java executables; checking a list of possible candidates will be a

[ansible-project] ModuleNotFoundError: No module named 'ansible.parsing'

2019-01-28 Thread shenhaowee
>From what I saw in my environment I got this error when the script wasn't in my root directory. [root@xxx API]# ./my_ansible.py Traceback (most recent call last): File "./my_ansible.py", line 5, in from ansible.parsing.dataloader import DataLoader File