Passwordless chef client bootstrapping - ruby

I am bit familiar with Chef and its bootstrapping techniques. I am trying to bootstrap my new chef-client/node without passing password
I tried below by generating a ssh key but still failing
knife bootstrap MY_NODE_IP -x SERVER_ADMIN_USERNAME -i PATH_TO_KEY_FILE --sudo --node-name THE_NODE_NAME
On triggering above command on Chef DK getting error as below
WARN: [SSH] PTY requested: stderr will be merged into stdout
WARN: [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user user#mynode>)
ERROR: Train::Transports::SSHFailed: SSH session could not be established
I also tried doing manual installation as per below instruction , but again a failure https://serverfault.com/questions/761167/how-to-manually-set-up-a-chef-node
I created a client manually, but I was unable to create a node in chef server manually. Please suggest
Getting network error as below
Networking Error:
-----------------
Error connecting to https://myserver/organizations/organization/nodes/mynode - Failed to open TCP connection to www.internet:8080 (getaddrinfo: Name or service not known)
Bootstrapping from my chef DK also throws an error
Is there a way to bootstrap linux chef client without using password from a windows chef DK?
Below is my Chef environment
1.Chef Infra Client: 15.14.0
2.Chef Workstation 0.8.7.1
3.Chef-server 12.18.14

Related

How to connect to mongo shell from windows cmd?

This is my first time using Mongodb, It connect normally using the IDE from Mongodb university basics m001 course but when I tried to connect from cmd it won't connect and gives me this error
*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
Error: Authentication failed. :
connect#src/mongo/shell/mongo.js:374:17 #(connect):2:6 exception:
connect failed exiting with code 1
I added the path to my environment & checked the network access from my Atlas and I can connect to it from anywhere
Can anyone help me with this please??

Getting error instalingl wget in RHEL EC2 instance

Getting this message when trying to install wget in RHEL EC2 instance. How to resolve this?
Error: Failed to download metadata for repo 'rhui-client-config-server-8': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://rhui3.ap-south-1.aws.ce.redhat.com/pulp/mirror/protected/rhui-client-config/rhel/server/8/x86_64/os [Connection timed out after 30000 milliseconds]
If you set up SSH for the EC2 instance, try and SSH into the machine, and try
curl -I https://www.google.com
and if it times out, you perhaps can't connect to the internet.
You need to check if the relevant Security Group has an outbound rule allowing connections to the internet:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html?icmpid=docs_ec2_console#security-group-rules
There are a few useful hints in https://access.redhat.com/discussions/4656371 as well, if the issue is related to your subscription.

How to configure the knife plugin for Chef on an Ubuntu 14.04 VM Instance using GCP

I'm getting this error when trying to configure the knife plugin for Chef in an Ubuntu 14.04 instance on Google Cloud Platform. Any ideas on how to fix this?
FATAL: Cannot find subcommand for: 'osc_user configure -i'
There are 2 VMs - one is the chef-server and the other the chef-workstation, both are the same OS.
Source :- https://cloud.google.com/solutions/google-compute-engine-management-puppet-chef-salt-ansible-appendix#getting-started-with-chef-on-compute-engine
Chef-server VM IP - https://35.227.106.170/
Chef-workstation VM IP - https://35.231.42.82/
Here is the console log:
anjalithomas_mec#chef-workstation:~/.chef$ knife configure -i # server: https://[server's external IP address]:443, cookbook_path = ~/chef-repo
Please enter the chef server URL: [https://chef-workstation.c.chef-gcp-195115.internal/organizations/myorg] https://35.227.80.216
Please enter a name for the new user: [anjalithomas_mec] any
Please enter the existing admin name: [admin]
Please enter the location of the existing admin's private key: [/etc/chef-server/admin.pem]
Overwrite /home/anjalithomas_mec/.chef/credentials?? (Y/N) Y
Creating initial API user...
Please enter a password for the new user:
WARNING: IF YOU ARE USING CHEF SERVER 12+, PLEASE FOLLOW THE INSTRUCTIONS
UNDER knife user create --help.
You only passed a single argument to knife user create.
For backwards compatibility, when only a single argument is passed,
knife user create assumes you want Open Source 11 Server user creation.
knife user create for Open Source 11 Server is being deprecated.
Open Source 11 Server user commands now live under the knife osc_user namespace.
For backwards compatibility, we will forward this request to knife osc_user create.
If you are using an Open Source 11 Server, please use that command to avoid this warning.
NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed
in Chef 15 which will be released April 2019.
FATAL: Cannot find subcommand for: 'osc_user configure -i'
Looks like it's an open issue with no fix yet:
chef client - error during Knife configure -i #4814
https://github.com/chef/chef/issues/4814

Why am I getting a connectionTimeout error while trying to update my chef node?

I keep getting this error on the Chef tutorial while trying to update my node. Its very strange because I was able to bootstrap in and ssh in using the same credentials. I have also confirmed that my security for inbound ports for 80, 20 and 443 were open. For the life of me I can't understand why it's holding up here. I am using MacOSX and terminal with an AWS virtual.
WARNING: Failed to connect to 172.31.46.107 -- Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
knife ssh 'name:node1-centos' 'sudo chef-client' --ssh-user centos --identity-file /Users/gavindevops/.ssh/GavinChefKeyPair.pem --attribute ipaddress
SSH uses port 22. Was that a typo in the question or in the security group?
Okay so turns out even if you're using key based authentication, scroll down to the user name and password instructions part of the tutorial because it tells you to use "cloud.public_hostname" in place of "ipaddress" if you are using a service like AWS.

How to Install Knife on the Linux machine,?

I have installed Chef server on One Physical Linux node successfully,
Now i am trying to install chef-client on the other Linux VM,
Unfortunately i am getting below error.
ERROR: Your private key could not be loaded from /etc/chef/webui.pem
Check your configuration file and ensure that your private key is readable
so copied the webui.pem from chef server to Linux Client
tried to execute knife client List
ERROR: Failed to authenticate to http://xxx.xxx.xxx.xxx:4000 as admin with key /etc/chef/webui.pem
Response: Failed to authenticate. Ensure that your client key is valid.
To use knife you need to be logged in as an admin user. Either copy down the servers admin.pem key or better still create a new admin user and use its key.
Another thing to fix is make sure the node_name used to login matches the key you're using. (The error message suggests you're using "admin"):
node_name 'myuser'
client_key '/home/me/.chef/keys/myuser.pem'

Resources