Sponsored Content
Top Forums Shell Programming and Scripting Copying a text file from my Ubuntu Windows Sub System to a remote instance through SSH Post 303027641 by Suhaba on Thursday 20th of December 2018 07:55:46 PM
Old 12-20-2018
Copying a text file from my Ubuntu Windows Sub System to a remote instance through SSH

*Following questions involves use of YAML, BASH, SSH and Software called Ansible*

I am trying to learn how to use a Linux environment (in my case a Ubuntu Windows Sub System) to copy a text file from my files to a remote instance (in this case Amazon Web Services) by connecting via SSH.

I have set up directories and files in Ubuntu like so:

hosts > my_hosts
playbook.yml
roles>my-role>files>test.txt
roles>my-role>tasks>main.yml

(hosts, playbook.yml, roles are all directories in home; hope the way I have shown it makes it clear)

The test.txt file contains a simple statement saying "Hello, World"; and this is what I want to send of to my remote instance.

The contents of the YAML files are as follows:

main.yml :
---
- name: Copy a file to the remote host
copy:
src: test.txt
dest: /tmp/test.txt

playbook.yml :
---
- hosts: my_hosts
roles:
- my-role

I am able to connect to the Amazon Web Services Remote Instances using a command in the following format:

sudo ssh -i ansible_instance_d**_****.pem "ubuntu@ec2-**-***-**-***.compute-1.amazonaws.com"
(ignore quotation marks)

I assume I now need to somehow add something in the text file my_hosts that will allow me to connect to the remote instance; and subsequently copy the text file.

In order to then run the process is use:

ansible-playbook -i hosts playbook.yml

But i don't know what to put in the my_hosts file or whether everything else i have done is correct.

I've tried my best to explain what I am trying to do, please ask any more questions to help clarify.


Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying files from laptop to remote server using SSH

Hello, I'm sorry if this sounds like a very simple question, but I'm having some difficulty with it being a complete newbie to UNIx. I use Windows, and always have, but need some UNIX access for work, picking up files from our group space, etc. Basically, I'm using Cygwin and can SSH into the... (3 Replies)
Discussion started by: patwa
3 Replies

2. UNIX for Dummies Questions & Answers

Copying files from a remote server to local system with cygwin

Hi. I'm sorry if I get on people's nerves asking this, but I don't really understand how to do this and unfortunately don't have the time to work through it step by step in books, etc. At University, we have a unix server that hosts our files. we each have a login and password to access it. I... (3 Replies)
Discussion started by: patwa
3 Replies

3. Shell Programming and Scripting

ssh text into file on remote server

Hello, I have about 90 servers that I need to update snmp configs. I am trying to write a script that will echo 4 new lines of text into the snmpd.conf file. I have tested it locally and it works when the server ssh into itself but when I try to run the script to ssh into a remote server it logs... (5 Replies)
Discussion started by: mr_dthomas
5 Replies

4. Shell Programming and Scripting

Append Text To Remote Servers File Via SSH

Gentleman & Ladies, Please make me feel like and novice and explain why this is not working? I am attempting to ssh to a remote server via ssh and keys. I want to inject a file on the remote server with text. I am not achieving this. I would like to echo/inject the text on the remote... (1 Reply)
Discussion started by: abacus
1 Replies

5. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

6. Shell Programming and Scripting

Running remote system shell script and c binary file from windows machine using java

Hi, I have an shell script program in a remote linux machine which will do some specific monitoring functionality. Also, have some C executables in that machine. From a windows machine, I want to run the shell script program (If possible using java). I tried with SSH for this. but, in... (1 Reply)
Discussion started by: ram.sj
1 Replies

7. UNIX for Dummies Questions & Answers

Copying text from Windows to AIX - missing text?

Hi All, I'm hoping this is an easy question, but I'm having a weird problem trying to simply copy and paste text from MS Windows (XP) Notepad and then pasting into vi or vim in AIX. When I type "oslevel" I get "5.3.0.0". The problem is that once the text is pasted, there are sections of text... (2 Replies)
Discussion started by: PlainInverted
2 Replies

8. UNIX for Dummies Questions & Answers

Copying from remote SunOS to local Windows 7 computer

Can someone please help me with copying from remote computer to local computer? I have Winscp installed but for some reason i can seem to get into the server using winscp. I am currently logged on to the server, so its not a case of remote host unavailable. I really am not sure if the syntax... (2 Replies)
Discussion started by: dollypee
2 Replies

9. Red Hat

Disable copying secure key's to remote system

Hi, We all know as we can connect remote system through ssh without entering username and password by copy the public key to remote host using ssh-copy-id. But my query is to i want to restrict the user as do not implement this feature.Whenever he is trying to login, he has to enter his/her... (1 Reply)
Discussion started by: mastansaheb
1 Replies

10. IP Networking

Unable to SSH from Windows client to Ubuntu Server

I'm trying to setup a small home network environment as a pet project. These are physical machines nothing virtual. Any help or ideas is greatly appreciated. I can ping between both machines and I have Samba established and can read/write different shares. When I try to SSH from Windows 8.1... (10 Replies)
Discussion started by: lombardi4851
10 Replies
Test::CPAN::Meta::YAML(3pm)				User Contributed Perl Documentation			       Test::CPAN::Meta::YAML(3pm)

NAME
Test::CPAN::Meta::YAML - Validate a META.yml file within a CPAN distribution. SYNOPSIS
There are two forms this module can be used. The first is a standalone test of your distribution's META.yml file: use Test::More; eval "use Test::CPAN::Meta::YAML"; plan skip_all => "Test::CPAN::Meta::YAML required for testing META.yml" if $@; meta_yaml_ok(); Note that you may provide an optional label/comment/message/etc to the function, or one will be created automatically. The second form allows you to test other META.yml files, or specify a specific version you wish to test against: use Test::More test => 6; use Test::CPAN::Meta::YAML; # specify a file and specification version meta_spec_ok('META.yml','1.3',$msg); # specify the specification version to validate the local META.yml meta_spec_ok(undef,'1.3',$msg); # specify a file, where the specification version is deduced # from the file itself meta_spec_ok('META.yml',undef,$msg); Note that this form requires you to specify the number of tests you will be running in your test script. Also note that each 'meta_spec_ok' is actually 2 tests under the hood. DESCRIPTION
This module was written to ensure that a META.yml file, provided with a standard distribution uploaded to CPAN, meets the specifications that slowly being introduced to module uploads, via the use of ExtUtils::MakeMaker, Module::Build and Module::Install. See CPAN::Meta for further details of the CPAN Meta Specification. ABSTRACT
A test module to validate a META.yml file. FUNCTIONS
o meta_yaml_ok([$msg]) Basic META.yml wrapper around meta_spec_ok. o meta_spec_ok($file, $version [,$msg]) Validates the named file against the given specification version. Both $file and $version can be undefined. TESTING META FILES
There are currently 3 distributions to test META files: Test-CPAN-Meta Test-CPAN-Meta-JSON Test-CPAN-Meta-YAML All three have slightly different requirements and are intended to be used in slightly different environments. Test-CPAN-Meta-YAML requires a YAML parser, and currently looks for the YAML or YAML::Syck modules. This is the original variant of the 3 and was intended to provide a more complete YAML validation of a META.yml. Test-CPAN-Meta requires the Parse::CPAN::Meta module, which is now part of Perl Core as of perl-5.10.1. This version is intended to be used by those only wishing to rely on core modules to test their META.yml files. Test-CPAN-Meta-JSON is the most recent addition to the family, and is specifically aimed at those distributions that use a META.json Meta file. The distribution requires the JSON module to parse the Meta file. BUGS, PATCHES &; FIXES There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties that are not explained within the POD documentation, please send an email to barbie@cpan.org or submit a bug to the RT system (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-YAML). However, it would help greatly if you are able to pinpoint problems or even supply a patch. Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me. SEE ALSO
Test::YAML::Valid AUTHOR
Barbie, <barbie@cpan.org> for Miss Barbell Productions, <http://www.missbarbell.co.uk> COPYRIGHT AND LICENSE
Copyright (C) 2007-2012 Barbie for Miss Barbell Productions This module is free software; you can redistribute it and/or modify it under the Artistic Licence v2. perl v5.14.2 2012-04-19 Test::CPAN::Meta::YAML(3pm)
All times are GMT -4. The time now is 09:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy