I am trying to start Chrome on Windows remotely, my task is:
- name: start chrome
win_shell: start chrome
The task is successful but when I check on the machine, I can not see Chrome started.
Can anyone help on what am I missing?
Complete logs for the task:
task path: /home/ansible/wind/main.yml:5
Using module file /usr/lib/python3/dist-packages/ansible/modules/windows/win_shell.ps1
Pipelining is enabled.
<192.168.19.1> ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO 192.168.19.1
EXEC (via pipeline wrapper)
changed: [192.168.19.1] => {
"changed": true,
"cmd": "start chrome",
"delta": "0:00:00.466209",
"end": "2021-05-27 04:13:23.400844",
"rc": 0,
"start": "2021-05-27 04:13:22.934634",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
META: ran handlers
META: ran handlers
Related
I want to install the new cluster on 3 machines.
I ran this command:
ansible-playbook -i inventory/local/hosts.ini --become --become-user=root cluster.yml
but the installation failed:
TASK [remove-node/pre-remove : remove-node | List nodes] *********************************************************************************************************************************************************
fatal: [node1 -> node1]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/kubectl", "--kubeconfig", "/etc/kubernetes/admin.conf", "get", "nodes", "-o", "go-template={{ range .items }}{{ .metadata.name }}{{ "\n" }}{{ end }}"], "delta": "0:00:00.057781", "end": "2022-03-16 21:27:20.296592", "msg": "non-zero return code", "rc": 1, "start": "2022-03-16 21:27:20.238811", "stderr": "error: stat /etc/kubernetes/admin.conf: no such file or directory", "stderr_lines": ["error: stat /etc/kubernetes/admin.conf: no such file or directory"], "stdout": "", "stdout_lines": []}
Why the installation step tried to remove and why /etc/kubernetes/admin.conf has not been created?
Please assist.
There could be a couple of ways how can you solve your problem. First look at this github issue. Probably you can manually copy the missing file and it should work:
I solved it myself.
I copied the /etc/kubernetes/admin.conf and /etc/kubernetes/ssl/ca.* to the new node and now the scale playbook works. Maybe this is not the right way, but it worked...
The another way is to use wait for module on Ansible. You can find example of usage in this thread.
To another solution I will recommend to read this similar problem:
cluster_initialized.txt created on first fail and ansible never runs kubeadm init again. just delete that file on fail, fix the problem and run again.
I just want to SSH into my compute instances using a profile in the new Windows Terminal app.
This worked for me:
"commandline": "cmd.exe /k \"C:/Users/**YOUR_USER**/AppData/Local/Google/Cloud SDK/cloud_env.bat\"".
Remember about escaping backslash.
Easiest and neat way to do this by running Linux WSL 2 like Ubuntu, install gcloud sdk, then setup gcloud by running gcloud init and use below config in Windows Terminal:
{
"guid": "{d8567bf5-f802-498a-899a-efedc99a2aa8}",
"hidden": false,
"name": "Google Cloud Shell",
"commandline": "wsl -d Ubuntu-20.04 gcloud beta cloud-shell ssh",
"fontFace": "Cascadia Code PL",
"useAcrylic": true,
"acrylicOpacity": 0.6,
"backgroundImage": "C:\\Users\\USERNAME\\.terminal\\.gshell-icon.png",
"icon": "C:\\Users\\USERNAME\\.terminal\\.gcloud-icon.png",
"backgroundImageStretchMode": "none",
"backgroundImageAlignment": "center",
"backgroundImageOpacity": 0.5,
"tabColor": "#1a73e8",
}
Note: In the command:
wsl -d WSL-NAME gcloud beta cloud-shell ssh, you can use any wsl
like (kali-linux, alpine, openSUSE-Leap-15.2, etc. just make sure you
install and setup gcloud sdk)
Nvm, I found out you can add a commandline argument to the profiles section. For anybody else trying to figure this out:
{
"guid": "{*add_a_guid*}",
"name": "Google Cloud Shell",
"commandline": "ssh -i *path_to_ssh_key* *username*#*ip_address*",
"icon": "C:\\Program Files (x86)\\Google\\Cloud SDK\\cloud_platform_logo.ico",
"hidden": false
}
You can generate a guid in PowerShell using this command:
[guid]::NewGuid()
It worked for me:
{
"guid": "{c79dfc7a-3346-4dd3-b6c0-c0107e319a95}",
"hidden": false,
"name": "Google Cloud",
"commandline": "powershell.exe -NoExit -ExecutionPolicy Bypass -File \"%USERPROFILE%\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\PowerShell\\GoogleCloud\\BootstrapCloudToolsForPowerShell.ps1\"",
"icon": "%USERPROFILE%\\AppData\\Local\\Google\\Cloud SDK\\cloud_platform_logo.ico"
}
You can try this, work for me: First at all, add "C:\Program Files (x86)\Google\Cloud SDK" to windows path, then add to Windows Terminal JSON file this:
For cmd:
{
"guid": "{9f8bb872-db3d-4398-9571-a983a22ff18e}",
"hidden": false,
"icon": "C:/Program Files (x86)/Google/Cloud SDK/supercloud-16x16.ico",
"name": "Google Cloud SDK Shell",
"startingDirectory": "C:/Program Files (x86)/Google/Cloud SDK",
"commandline": "cmd.exe /k cloud_env.bat"
},
For powershell:
{
"guid": "{9f8bb872-db3d-4398-9571-a983a22ff18e}",
"hidden": false,
"icon": "C:/Program Files (x86)/Google/Cloud SDK/supercloud-16x16.ico",
"name": "Google Cloud SDK Shell",
"startingDirectory": "C:/Program Files (x86)/Google/Cloud SDK",
"commandline": "powershell.exe -NoExit -ExecutionPolicy Bypass C:/cloud_env.bat"
},
i have recently transitioned on to a project to re-architect our entire enterprise protractor code base. we use node v8.13, protractor v4.0.14, and grunt-protractor-runner v5. i would be open to debugging in vscode or chrome.
here is how i am configuring...
vscode launch.json
{
"type": "node",
"request": "launch",
"name": "Pro Debug",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"args": ["${workspaceRoot}/ConvertedJSFiles/tests/config/conf.js"],
}
grunt.js
default: {
options: {
keepAlive: true,
debug: true
}
},
exampleTest.ts
it( '2#Click in Sign in to your account', async function () {
browser.pause();
debugger;
await commonMethods.beforeAll();
landingPage.logIn();
expect( browser.getCurrentUrl() ).toContain( 'login' );
} );
when attempting to debug in chrome, i execute with the command 'grunt'. the test seems to fail at the point where i have entered the 'debugger' statement. i am not positive, but i think this error is caused by protractor as protractor is what spawns a node process.
>> (node:13476) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
>> Debugger listening on ws://127.0.0.1:9229/ff1f9827-a76b-4400-9d0e-b0cec6912508
>> For help see https://nodejs.org/en/docs/inspector
>> (node:13477) [DEP0068] DeprecationWarning: `node debug` is deprecated. Please use `node inspect` instead.
>> Port 9229 is already in use. Please specify another port to debug.
when attempting to debug with vscode i receive the following error. i think this might be due to vscode executing the conf.js without having started protractor.
[16:57:06] E/runner - Unable to start a WebDriver session.
logger.js:170
[16:57:06] E/launcher - Error: UnsupportedOperationError: unknown command: Cannot call non W3C standard command while in W3C mode
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'US8525RT.local', ip: 'fe80:0:0:0:cdc:1e02:9f9f:9858%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.4', java.version: '1.8.0_241'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/Users/jayce.tan/Code/ui-automation-ts/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
any help would be much appreciated. thanks!
Try like this
Note: if you are using outfolder for builded ts file to js, correct the path.
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor", // path the protractor node modules.
"args": [
"${workspaceRoot}/build/config/config.js" // path to compiled protractor configuration file.
],
"preLaunchTask": null,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/build/**/*.js" ]
}
]
}
After that set breakpoints in the visual studio code and debug the program.
If you still have issues with W3C just disable it
Proractor
config.js
Note: adapt it to your needs this is just example how to disable w3c
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
w3c: false,
args: [] // args if required.
}
}
I'm attempting to debug a vscode extension in Windows using WSL. It appears as though the prelaunchtask is using the cmd.exe arguments, which causes the prelaunchtask to fail with bash.
Executing task: npm run watch <
/bin/bash: /d: No such file or directory The terminal process
terminated with exit code: 127
Terminal will be reused by tasks, press any key to close it.
Any thoughts how I might force the debug terminal to properly issue the bash arguments?
You can achieve this by manually specifying the shell executable and arguments used by the Extension launch configuration. Assuming you are starting with the example extension, you can edit the task for the "npm: watch" script in .vscode/tasks.json, forcing it to launch WSL with no additional arguments.
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
},
// Force this to use WSL with no additional arguments
"options": {
"shell": {
"executable": "C:\\WINDOWS\\System32\\wsl.exe"
},
"args": []
}
}
I'm trying to run a one script file in mesos in background by using nohup command trying, but unfortunately the problem is the script executing successfully but the same scripts spanning as multiple jobs and running all jobs in background.
How can I handle the jobs with out spanning multi jobs, restrict a single jobs after scaling the application in marathon.
**marathon_sample.json**
{
"id": "/dps/sample",
"cmd": "nohup sh /tmp/marathon_test/marathon_sample.sh & >> /tmp/marathon_test/marathon_test.log",
"cpus": 0.1,
"mem": 512,
"disk": 1,
"instances": 0,
"container": null,
"constraints": [
[
"hostname",
"LIKE",
"(lltws0gbeot.sdi.corp.bankofamerica.com)"
]
],
"portDefinitions": [
{
"port": 0,
"protocol": "tcp",
"name": null,
"labels": null
}
]
}
**marathon_sample.sh**
#! /bin/sh
while [ true ] ;
do
echo 'Hello Marathon test application'
sleep 5 ;
done
Can any one help me to run "marathon_sample.sh" in mesos as a background job.
What's the point of running nohup in Marathon? Marathon (resp. Mesos) is supposed to be the "init system" responsible for keeping your job alive and running. You should simplify the command to:
"cmd": "sh /tmp/marathon_test/marathon_sample.sh",
Logs from stdout and stderr are automatically being stored into task's workdir. There's no point to write out of your workdir.