[ansible-project] Getting Runtime error “obj must be a list of dicts or a nested dict” using with_items

2019-08-16 Thread Mohtashim S


I need to search a string "TicketID" in .db files under a directory. If 
found my playbook should fail.


Below is my playbook for the same, however I'm getting runtime error "using 
with_items"

Output:

> TASK [Search for Number] 
> *
>  
> fatal: [45.72.65.99]: FAILED! => {"msg": "obj must be a list of dicts or a 
> nested dict"}


Below is my ansible playbook's task:


   - name: find multiple .db files under a given location
 find:
   paths: "{{ BASEPATH }}"
   patterns: "*.db"
   recurse: yes
 register: files_matched

   - name: "Search for Number
 command: "grep -i {{ TicketID }} {{ item.path }}"
 register: command_result
 failed_when: command_result.rc == 0
 with_items:
  - "{{ files_matched.files }}"



I tried using loop instead of with_items as below but that too did not work


   - name: "Search for Number
 command: "grep -i {{ TicketID }} {{ item.1.path }}"
 register: command_result
 failed_when: command_result.rc == 0
 loop: "{{ files_matched.results | subelements('files') }}"



Output:

> TASK [Search for Number] 
> *
> fatal: [45.72.65.99]: FAILED! => {"msg": "obj must be a list of dicts or a 
> nested dict"}


I also tried using json_query  like below but I still get error:


   - name: "Search for Number"
 command: "grep -i {{ TicketID }} {{ item }}"
 register: command_result
 failed_when: command_result.rc == 0
 loop: "{{ files_matched.files|json_query('[].path') }}"



Output:

> TASK [Search for Number] 
> *
> fatal: [45.72.65.99]: FAILED! => {"msg": "Invalid data passed to 'loop', 
> it requires a list, got this instead: . Hint: If you passed a list/dict of 
> just one element, try adding wantlist=True to your lookup invocation or use 
> q/query instead of lookup."}


I would like to understand why is this playbook failing and how I can fix 
it.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6b0c5faa-b14a-43a5-9030-4425ea3ebf37%40googlegroups.com.


Re: [ansible-project] Re: Test to see if the Drives exist

2019-08-16 Thread Kai Stian Olstad

On 16.08.2019 23:54, Doug Clark wrote:
This is an Ansible issue/request, hence why I am on this forum asking 
for

help.


You asked for a suggestion and I gave you one, up to you if you take the 
advise or not.


The reality is that you haven't gotten a reply and asking about which 
Windows/power shell commands(aka not Ansible) you can run to find label, 
drive letter and partition.


That's why I suggested you might have better luck in a Windows 
list/forum/community that actually knows this stuff.


--
Kai Stian Olstad

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/985d2180bf27e252919c5c617b4762c2%40olstad.com.


Re: [ansible-project] Re: Test to see if the Drives exist

2019-08-16 Thread Doug Clark
This is an Ansible issue/request, hence why I am on this forum asking for 
help.

On Friday, August 16, 2019 at 10:11:14 AM UTC-6, Kai Stian Olstad wrote:
>
> On 16.08.2019 18:05, Doug Clark wrote: 
> > Any suggestions? 
>
> Since this a Ansible list and not how do I do something in Windows list 
> you might have better luck in a Windows list/forum/community. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a812dee9-ac98-4e75-af9d-3029079c76e2%40googlegroups.com.


Re: [ansible-project] Ansible iterate from file and populate template

2019-08-16 Thread Angel Rengifo Cancino
That's exactly what I'm looking for: how he solved his issue. 
Unfortunately, he only wanted to solve his problem, but he didn't care 
about others having the same problem

El viernes, 14 de junio de 2019, 12:11:26 (UTC-5), Kai Stian Olstad 
escribió:
>
> On 14.06.2019 11:51, Nicola Contu wrote: 
> > I found the way to loop and get variables. 
>
> It's a common courtesy to also provide the solution. 
>
> Think about the next person that has the same challenge as you only to 
> find your post that basically only say solved it. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aa2d616a-862f-47d1-a537-d66888707d26%40googlegroups.com.


[ansible-project] Re: Module yum and package?

2019-08-16 Thread Mike Eggleston
I’m trying a test. I have:

tasks:
  - name: update packages 
package:
  name: ‘*’
  state: latest

And executed as: 
ansible-playbook -u root -k —limit host yum.yml

and get:
fatal: [host]: FAIKED! => {“msg”: “module (yum) is missing interpreter line”}

Mike

> On Aug 16, 2019, at 14:06, Mike Eggleston  wrote:
> 
> Yum says it will do a wild card on the update (equivalent to “yum update”). 
> Will the module “package” also do a wildcard?
> 
> Mike

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E3A3ED1F-D726-427A-849D-84D912F0104C%40gmail.com.


[ansible-project] best practices re ansible-playbook inventories and group_vars

2019-08-16 Thread Jim Robinson
Folks,

I'd like to get some feedback from the experts here about the proper way to 
lay out inventory group_vars.

When ansible was set up in my organization the developer decided to split 
inventory into two groups, devqa and prod.

So when we run a playbook we point to one or the other inventory:

ansible-playbook -i ../devqa_inventory/ -limit $hosts playbook/xyz.yml

ansible-playbook -i ../prod_inventory/ -limit $hosts playbook/xyz.yml

Within each inventory are

top level files that associate hosts with groups:
devqa_inventory/aws.yml:
[aws]:
- host1
- host2
- host3

a group_vars directory
devqa_inventory/group_vars/aws.yml:


a host_vars directory
devqa_inventory/host_vars/host1.yml:

devqa_inventory/host_vars/host2.yml:

devqa_inventory/host_vars/host3.yml:


When we make changes to the playbooks we test them against the devqa 
inventory hosts and once we're satisfied they work we apply them to the 
prod hosts.  This seems fine.

When we need to make changes to group_vars we develop them in devqa and run 
them against devqa hosts, and when we're satisfied they are correct we 
manually copy the appropriate changes from devqa inventory to prod 
inventory.  This strikes me as problematic and potentially error prone.

I'm not sure I understand exactly why the original developer (who has since 
departed) laid this out in this fashion, and I wanted to ask this group 
whether or not it seemed reasonable.  If you think it is problematic, how 
would you have advised group_vars be handled with ansible-playbook?  Woulod 
have have gone with one big inventory that held everything?

How would you handle the distinction between dev and prod for 
testing/development and release?

A simple example of one group_vars variable that I could see needing to be 
different between dev and prod would be an AWS region value.  For example 
say that your development region is us-east-1 and your production region is 
us-west-1.  Under the scheme we're using right now that'd be one variable 
you needed to make sure didn't get copied over.  But how should it be laid 
out if you had one big inventory?  At the host_vars level?  A jinja2 
expression that switched on something that defined dev vs. prod (e.g., at 
the host_vars define 'type: dev' or 'type: prod'?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c1f147f1-7398-4747-95c8-aa5f2344ec38%40googlegroups.com.


[ansible-project] Module yum and package?

2019-08-16 Thread Mike Eggleston
Yum says it will do a wild card on the update (equivalent to “yum update”). 
Will the module “package” also do a wildcard?

Mike

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0B2CA4F7-80E9-42C0-8CA9-6B2DD34B016B%40gmail.com.


[ansible-project] Re: "PUTTING" or http PUT interacting with JFrog Artifactory

2019-08-16 Thread GM
Oh - yes.

Here is the scenario:

I have a JFrog Artifactory server, and I want to use Ansible to upoload/PUT 
files into the repos that I have in Artifactory. - attempting to use the 
uri module:

I posted what I had below - I am missing something I am sure.

Am I going about this the wrong way? Thanks for any help you can offer. 
It's appreciated.

---
- name: "download artifact"
  hosts: all
  tasks:
  - uri:
  uri: http://10.10.10.170:8081/artifactory/generic-local-repo/
  user: gmillard
  password: x
  method: PUT
  src: FilesArchive.tar.gz



ansible-playbook -vv attemptul.yml
ansible-playbook 2.5.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
[u'/home/gmillard/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.15 (default, May  9 2018, 11:32:33) [GCC 7.3.1 
20180130 (Red Hat 7.3.1-2)]
Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: attemptul.yml 

1 plays in attemptul.yml

PLAY [download artifact] 
***

TASK [Gathering Facts] 
*
task path: /home/gmillard/myplatform/OtherStuff/attemptul.yml:2
ok: [fedoracontrol]
META: ran handlers

TASK [uri] 
*
task path: /home/gmillard/myplatform/OtherStuff/attemptul.yml:5
An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: AttributeError: 'NoneType' object has no attribute 
'find'
fatal: [fedoracontrol]: FAILED! => {"changed": false, "content": "", "msg": 
"Status code was -1 and not [200]: An unknown error occurred: 'NoneType' 
object has no attribute 'find'", "redirected": false, "status": -1, "url": 
null}
to retry, use: --limit 
@/home/gmillard/myplatform/OtherStuff/attemptul.retry

PLAY RECAP 
*
fedoracontrol  : ok=1changed=0unreachable=0failed=1


Glen
On Friday, August 16, 2019 at 8:08:54 AM UTC-4, GM wrote:
>
> Hey everyone - if I was going to use an Ansible module to push or PUT a 
> file into say JFrog Artfactory, using an API key, which of the Ansible 
> modules would be best? I have looked at the uri module and the net_put but 
> those do not seem to have the functionality that I would need.
>
> I see get_url but that seems to be for the direction from the destination 
> to the source.
>
> Can anyone shed some light? Which module would be best for this job? I 
> have never had to do this before and I'm a little lost.
>
> Thanks - Glen
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8665fe17-e844-4125-8d54-035ea8ff0e32%40googlegroups.com.


[ansible-project] Re: Test to see if the Drives exist

2019-08-16 Thread Doug Clark
Any suggestions?  
TIA!

On Wednesday, August 14, 2019 at 2:06:53 PM UTC-6, Doug Clark wrote:
>
> Hello,
> I am new to Ansible and looking for some assistance.  I want to be able to 
> run the Ansible script for changes and or additions without rebuilding the 
> server. In my Ansible script I am using the below snippet to configure the 
> 2 additional drives that I have added to the server.  Any suggestions on 
> how to test first that the drives exist with the correct labels, drive 
> letters, and partition styles so Ansible will not run that portion again if 
> it is already configured?  
>
> - name: Partition and format drive1
>   win_shell: Get-Disk | Where number -eq '1' | Initialize-Disk 
> -PartitionStyle GPT -PassThru | New-Partition -UseMaximumSize -DriveLetter E 
> | Format-Volume -FileSystem NTFS -NewFileSystemLabel "Data" -Confirm:$false
>
> - name: Partition and format drive2
>   win_shell: Get-Disk | Where number -eq '2' | Initialize-Disk 
> -PartitionStyle GPT -PassThru | New-Partition -UseMaximumSize -DriveLetter F 
> | Format-Volume -FileSystem NTFS -NewFileSystemLabel "DocVault" 
> -Confirm:$false
>
>
> TIA!
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e103ff8-d5b3-4411-9df1-d352d6b540a7%40googlegroups.com.


Re: [ansible-project] "PUTTING" or http PUT interacting with JFrog Artifactory

2019-08-16 Thread Zolvaring
To put or post a file to an API I would usually use the uri module. Are you
able to explain more what it seems to be missing or post an example? Thanks

On Fri, Aug 16, 2019, 5:08 AM GM  wrote:

> Hey everyone - if I was going to use an Ansible module to push or PUT a
> file into say JFrog Artfactory, using an API key, which of the Ansible
> modules would be best? I have looked at the uri module and the net_put but
> those do not seem to have the functionality that I would need.
>
> I see get_url but that seems to be for the direction from the destination
> to the source.
>
> Can anyone shed some light? Which module would be best for this job? I
> have never had to do this before and I'm a little lost.
>
> Thanks - Glen
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a3fe4bd4-cf3f-4789-9c89-4fd55d2b36eb%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKEXu85uXz%3D323DAJDCXe2FFfwCm2%2Bk19F1eaamnW8xFRKM4Mg%40mail.gmail.com.


Re: [ansible-project] What is the best way to manage machines that aren't defined as hosts?

2019-08-16 Thread Mike Eggleston
Create a local, temporary file of the new hosts and environment variable 
ANSIBLE_INVENTORY?

Mike

> On Aug 16, 2019, at 00:34, Zolvaring  wrote:
> 
> I'm not sure I understand fully, but none of the hosts you are configuring 
> need Ansible to be installed for you make changes remotely. Instead of 
> defining your hosts in a CSV, define your hosts as part of Ansible inventory 
> and your tasks will loop through them naturally. You can also group hosts as 
> you had mentioned, and run task or assign vars to specific groups, just as 
> you had in your example. To execute a play only on remote esxi servers one 
> way is:
> 
> - name: configure esxi hosts
>   hosts: esxi-hosts
>   roles:
>  - your roles here
> 
> If I run this play and have 5 esxi hosts in my inventory group, then this 
> will run all roles or tasks each time for each of those 5 servers in parallel
> 
> Making use of group_vars files and host_vars files can change the play vars 
> based on the group.
> 
> 
>> On Thu, Aug 15, 2019, 9:15 PM Kurt Robinson  wrote:
>> I intend to Ansible to run deployment configuration on a number of Dell ESXi 
>> hosts in VMware using VMware and OpenManage modules.
>> 
>> In my past ansible training, my playbooks have always run from hosts that I 
>> have defined in an inventory file. The machines I wish to configure don't 
>> have ansible installed so they will be managed from the localhost node.
>> 
>> My question is, what is the best practice in running configuration tasks on 
>> these machines that aren't actual hosts within ansible?
>> 
>> Currently, I am thinking of creating a csv file which will contain the host 
>> information, then loop through each host and run my tasks to run on each 
>> host using read_csv.
>> 
>> 
>> 
>> pseudo:
>> 
>> - name: Read csv and send to task
>>   csv_read: csvname.csv
>>   task:
>> - taskname 
>>   passvar:
>> - csv.hostname
>> 
>> 
>> 
>> - name : Run task
>>   loop: name in csv.hostnames
>> do: something
>> 
>> 
>> 
>> To me this seems like I am under-engineering the solution a bit. Is there a 
>> better way I can do this?
>> 
>> Would I be able to add the list of hosts that I want to configure to an 
>> inventory file, then reference a group for which I will run my 
>> configurations on?
>> 
>> E.g.
>> 
>> inventory
>> 
>> [management]
>> 10.0.0.1
>> 10.0.0.2
>> 
>> [database]
>> 10.1.0.1
>> 10.1.0.2
>> 
>> __
>> 
>> - name: Set DNS on hosts
>>   vmware_module:
>> hostname: '{{ management group }}'
>> dns: 1.2.3.4
>> 
>> 
>> 
>> Thanks for taking the time.
>> 
>> 
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/2c702252-eae3-461e-842f-989e80d88537%40googlegroups.com.
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAKEXu85Ga7EadHRB%3DyP8hCQqy7S%2BTqCKmkCp%2BTj5CV10LpL5Ew%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/93B6A099-DFB3-464D-858C-D64FA5C2ADC8%40gmail.com.


Re: [ansible-project] [question] run logstash shell script in ansible playbooks

2019-08-16 Thread Dick Visser
>
>
>
> The playbook was successful, and in fact, logstash seems to be running on
> the target server, but logstash shut down a few seconds after running the
> playbook.
>


You seem to be using ansible to run a shell script, and it ran OK as far as
ansible is involved.
The error must be somewhere in your shell script.


Dick

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMsu7YjT660i2F33wHBddnKygD3NziVJiGFcOxjkwHuEg%40mail.gmail.com.


Re: [ansible-project] SSH to Oracle SBC

2019-08-16 Thread suriravi2002 .
Hi Brain,

I tried exploring on usage of raw module but unable to use it . Can you
give me a sample code for the same pls .

Regards,
Suresh.R.V

On Tue, 13 Aug, 2019, 11:44 PM Brian Coca,  wrote:

> Ansible requires a shell and python (or other interpreters) on the
> target machine to be usable, the `ping` module verifies these.
>
> From what i googled sbc is a 'appliance', at best you might be able to
> use the `raw` module to execute commands, or you might need specific
> modules designed for this appliance.
>
> --
> 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 from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CACVha7c02FtCnhTod0-6ywxUsnuDD1-hdj36LbkP_fLxS%2BnJWQ%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAN6QjOUCyTJ2baye68jK2fK9RhS8Mn_oRG4hcac9kn7KDT_5gw%40mail.gmail.com.


[ansible-project] "PUTTING" or http PUT interacting with JFrog Artifactory

2019-08-16 Thread GM
Hey everyone - if I was going to use an Ansible module to push or PUT a 
file into say JFrog Artfactory, using an API key, which of the Ansible 
modules would be best? I have looked at the uri module and the net_put but 
those do not seem to have the functionality that I would need.

I see get_url but that seems to be for the direction from the destination 
to the source.

Can anyone shed some light? Which module would be best for this job? I have 
never had to do this before and I'm a little lost.

Thanks - Glen

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a3fe4bd4-cf3f-4789-9c89-4fd55d2b36eb%40googlegroups.com.


[ansible-project] Re: Confused newbie - ERROR! the field 'hosts' is required but was not set

2019-08-16 Thread GM
Thanks much my friend - that fixed things - for now. It's got some other 
weirdness going on but I think it's an infrastructure issue.

Glen

On Thursday, August 15, 2019 at 9:46:46 PM UTC-4, Zolvaring wrote:
>
> In regards to your second question (sorry I missed it), the module looks 
> okay except you need to indent the module out one more indentation space:
> - name:
>   hosts:
>   tasks:
> - get_url:
> url:
>
> The only other thing that looks immediately wrong to me is your 
> destination parameter -- I don't think "$PWD" will work in this case 
> ansible won't resolve the command as you execute it. If you are trying to 
> put it in the current working directory of the ansible executor you can try 
> "./" or specify the directory with set_fact or a variable.
>   
>
> On Thursday, August 15, 2019 at 6:23:05 PM UTC-7, GM wrote:
>>
>> Hi there - first I will post my response from when I run my playbook:
>>
>> ansible-playbook -vv glen.yml
>>
>> ansible-playbook 2.5.2
>>   config file = /etc/ansible/ansible.cfg
>>   configured module search path = 
>> [u'/home/gmillard/.ansible/plugins/modules', 
>> u'/usr/share/ansible/plugins/modules']
>>   ansible python module location = 
>> /usr/lib/python2.7/site-packages/ansible
>>   executable location = /usr/bin/ansible-playbook
>>   python version = 2.7.15 (default, May  9 2018, 11:32:33) [GCC 7.3.1 
>> 20180130 (Red Hat 7.3.1-2)]
>> Using /etc/ansible/ansible.cfg as config file
>>
>> PLAYBOOK: glen.yml 
>> ***
>> 2 plays in glen.yml
>>
>> PLAY [all] 
>> ***
>>
>> TASK [Gathering Facts] 
>> ***
>> task path: /home/gmillard/myplatform/OtherStuff/glen.yml:2
>> ok: [fedoracontrol]
>> META: ran handlers
>> META: ran handlers
>> META: ran handlers
>> ERROR! the field 'hosts' is required but was not set
>>
>> Now, I'll post the playbook itself:
>> ---
>> - hosts: all
>> - name: "download artifactory"
>>   tasks:
>>   - get_url:
>>   url: 
>> http://10.10.10.170:8081/artifactory/generic-local-repo/FilesArchive.tar.gz
>>   headers:  
>> "X-JFrog-Art-Api:x"
>>   dest: $PWD
>>   mode: 0644
>>
>> Two things:
>> 1. Why am I getting the *ERROR! the field 'hosts' is required but was 
>> not set - * I'm thinking that my formatting/indentations are incorrect.
>> 2. I'm attempting to grab an artifact from JFrog Artifactory - using the 
>> get_url module - am I using it correctly?  
>>
>> Any and all help is appreciated. Thanks in advance.
>>
>> G
>>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/516f2f4b-fa9e-49c8-8417-6e44816479e1%40googlegroups.com.


Re: [ansible-project] [question] run logstash shell script in ansible playbooks

2019-08-16 Thread seungdols
@Brian Coca, Thank you for your advice on how to ask questions.

To test, I configured the following:

start_logstash.sh 

#!/bin/bash


LOG_NAME="access-to-kafka"
cd ~/logstash/current
bin/logstash -f ../conf/${LOG_NAME}.conf --path.data=../data/${LOG_NAME} --
path.logs=../logs/${LOG_NAME} --node.name=`hostname`-${LOG_NAME} -w 4 &


and simple playbook 

---

- hosts: "{{ host }}"
  vars:
ansible_ssh_private_key_file: ~/.ssh/ansible_key
ansible_connection: ssh
  tasks:
 - name: start_logstash
   shell: nohup /home/seungdols/logstash/start_logstash.sh

 
ansible-playbook 2.7.8
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
[u'/home/seungdols/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-11)]
Using /etc/ansible/ansible.cfg as config file
/home/seungdols/apps/ansible-playbooks/utils/hosts did not meet host_list 
requirements, check plugin documentation if this is unexpected
/home/seungdols/apps/ansible-playbooks/utils/hosts did not meet script 
requirements, check plugin documentation if this is unexpected
Parsed /home/seungdols/apps/ansible-playbooks/utils/hosts inventory source 
with ini plugin

PLAYBOOK: start_logstash.yml 

1 plays in start_logstash.yml

PLAY [api] 
**

TASK [Gathering Facts] 
**
task path: /home/seungdols/apps/ansible-playbooks/utils/start_logstash.yml:3
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'IdentityFile="/home/seungdols/.ssh/ansible_key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/seungdols/.ansible/cp/0d4fdbff82 seungdols-api '/bin/sh 
-c '"'"'echo ~ && sleep 0'"'"''
 (0, '/home/seungdols\n', '')
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'IdentityFile="/home/seungdols/.ssh/ansible_key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/seungdols/.ansible/cp/0d4fdbff82 seungdols-api '/bin/sh 
-c '"'"'( umask 77 && mkdir -p "` echo 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374 `" 
&& echo ansible-tmp-1565952550.92-260296961209374="` echo 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374 `" ) 
&& sleep 0'"'"''
 (0, 
'ansible-tmp-1565952550.92-260296961209374=/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374\n',
 
'')
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
 PUT 
/home/seungdols/.ansible/tmp/ansible-local-73672SO1_TS/tmp_gUqcu TO 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374/AnsiballZ_setup.py
 SSH: EXEC sftp -b - -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'IdentityFile="/home/seungdols/.ssh/ansible_key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/seungdols/.ansible/cp/0d4fdbff82 '[seungdols-api]'
 (0, 'sftp> put 
/home/seungdols/.ansible/tmp/ansible-local-73672SO1_TS/tmp_gUqcu 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374/AnsiballZ_setup.py\n',
 
'')
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'IdentityFile="/home/seungdols/.ssh/ansible_key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/seungdols/.ansible/cp/0d4fdbff82 seungdols-api '/bin/sh 
-c '"'"'chmod u+x 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374/ 
/home/seungdols/.ansible/tmp/ansible-tmp-1565952550.92-260296961209374/AnsiballZ_setup.py
 
&& sleep 0'"'"''
 (0, '', '')
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'IdentityFile="/home/seungdols/.ssh/ansible_key"' -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/home/seungdols/.ansible/cp/0d4fdbff82 -tt seungdols-api 
'/bin/sh -c '"'"'/usr/bin/python 

Re: [ansible-project] Incorrect Sudo Password - For Ansible Remote Host Jobs

2019-08-16 Thread Stefan Hornburg (Racke)
On 8/16/19 11:19 AM, Kalyan Alamuru wrote:
> I'm running Job through Job Template which have three tasks i.e. Gather Facts 
> on One Local Host(Where Tower is running
> and Job is Initiated from) and two other remote hosts, For which connectivity 
> is working as I've tested in stand alone
> mode.  I've created localadmin credential in tower and user in server and 
> created Private/Public Key Pair and uploaded
> to remote servers and able to connect successfully connect from Tower Host to 
> Remote Servers using local admin. 
> My Remote  Job started through Tower is failing with Incorrect Sudo Password. 
> I can swtich  to root from my localadmin
> user without any issues. But Job is failing with this Error, Do you've any 
> idea why it is failing.
> 
> This is the error message :  SSH: EXEC 
> sshpass -d8 ssh -vvv -C -o ControlMaster=auto
> -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="localadmin"' -o 
> ConnectTimeout=10 -o
> ControlPath=/tmp/awx_212_rfk_vgn0/cp/86ff2d5cd2 -tt 
> consumer-aws-web1.cloud.infra.buzz '/bin/sh -c '"'"'sudo -H -S  -p
> "[sudo via ansible, key=qfprhujkykgyaciifxxcmafrkzbzybiq] password:" -u root 
> /bin/sh -c '"'"'"'"'"'"'"'"'echo
> BECOME-SUCCESS-qfprhujkykgyaciifxxcmafrkzbzybiq ; /usr/bin/python
> /home/localadmin/.ansible/tmp/ansible-tmp-1565945826.64-195516655885658/AnsiballZ_setup.py'"'"'"'"'"'"'"'"'
>  && sleep 0'"'"''
> 56
>  Escalation failed
> 57
>  fatal: [consumer-aws-web1.cloud.infra.buzz]: FAILED! => {
> 58
>      "msg": "Incorrect sudo password"
> 
> This Jobs are initiated through Tower Console.  
> 
> Thanks in advance

Sorry, but this mailing list is only for Ansible, not for Tower or AWX. Please 
contact Tower support.

Regards
Racke

> 
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0cd5bb9a-c669-4e49-a49b-82a08b766576%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d16bd145-b284-cc8a-72a2-73556d3d558c%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Incorrect Sudo Password - For Ansible Remote Host Jobs

2019-08-16 Thread Kai Stian Olstad

On 16.08.2019 11:19, Kalyan Alamuru wrote:

I'm running Job through Job Template which have three tasks i.e. Gather
Facts on One Local Host(Where Tower is running and Job is Initiated 
from)


This is the list for Ansible not Tower, please contact Redhat support 
for help with Tower.



--
Kai Stian Olstad

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fac827ab84c58cc3df2cbf4024540e67%40olstad.com.


[ansible-project] Incorrect Sudo Password - For Ansible Remote Host Jobs

2019-08-16 Thread Kalyan Alamuru
I'm running Job through Job Template which have three tasks i.e. Gather 
Facts on One Local Host(Where Tower is running and Job is Initiated from) 
and two other remote hosts, For which connectivity is working as I've 
tested in stand alone mode.  I've created localadmin credential in tower 
and user in server and created Private/Public Key Pair and uploaded to 
remote servers and able to connect successfully connect from Tower Host to 
Remote Servers using local admin. 
My Remote  Job started through Tower is failing with Incorrect Sudo 
Password. I can swtich  to root from my localadmin user without any issues. 
But Job is failing with this Error, Do you've any idea why it is failing.

This is the error message :  SSH: EXEC 
sshpass -d8 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o 
StrictHostKeyChecking=no -o 'User="localadmin"' -o ConnectTimeout=10 -o 
ControlPath=/tmp/awx_212_rfk_vgn0/cp/86ff2d5cd2 -tt 
consumer-aws-web1.cloud.infra.buzz '/bin/sh -c '"'"'sudo -H -S  -p "[sudo 
via ansible, key=qfprhujkykgyaciifxxcmafrkzbzybiq] password:" -u root 
/bin/sh -c '"'"'"'"'"'"'"'"'echo 
BECOME-SUCCESS-qfprhujkykgyaciifxxcmafrkzbzybiq ; /usr/bin/python 
/home/localadmin/.ansible/tmp/ansible-tmp-1565945826.64-195516655885658/AnsiballZ_setup.py'"'"'"'"'"'"'"'"'
 
&& sleep 0'"'"''
56
 Escalation failed
57
 fatal: [consumer-aws-web1.cloud.infra.buzz]: FAILED! => {
58
 "msg": "Incorrect sudo password"

This Jobs are initiated through Tower Console.  

Thanks in advance

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0cd5bb9a-c669-4e49-a49b-82a08b766576%40googlegroups.com.