lunes, 12 de agosto de 2024

Unifi set-inform and set-default

How to reset unifi devices in a quickly way...


Connect through ssh:
ssh ubnt@ipaddress


Reset to factory settings:
set-default

Clearing CFG ... [%100] done!

Connection to 10.0.101.5 closed by remote host.

Connection to 10.0.101.5 closed.


Set the UniFi to report to the controller:

set-inform http://ip-of-host:8080/inform

miércoles, 7 de agosto de 2024

Install terraform using brew on MacOS

 Run in the terminal:

brew tap hashicorp/tap

brew install hashicorp/tap/terraform



terraform --version

Terraform v1.9.4

on darwin_amd64


Install awscli with MacPorts on MacOS BigSur

Install the MacPorts package from the website

https://www.macports.org/install.php


For some ports, your system might require installations of Xcode

xcode-select --install

xcode-select: note: install requested for command line developer tools


xcodebuild -license

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.



Then go to the terminal and run:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Install aws cli:
sudo port install py-awscli


After you install it, you have these notes:
py312-awscli has the following notes:

To make the Python 3.12 version of AWS CLI the one that is run when you execute the commands without a version suffix, e.g. 'aws', run:
port select --set awscli py312-awscli

---

If you use a plugin in your ~/.aws/config, it must be installed. For example, Wasabi for S3 uses the awscli_plugin_endpoint plugin. Just install it:
port install py312-awscli-plugin-endpoint

If your plugin is not in MacPorts, you can install it using the
py312-pip port, for example:
pip-3.12 install --user <plugin-name>
py312-docutils has the following notes:

To make the Python 3.12 version of docutils the one that is run when you execute the commands without a version suffix, e.g. 'rst2man', run:
port select --set docutils py312-docutils
python312 has the following notes:

To make this the default Python or Python 3 (i.e., the version run by the 'python' or 'python3' commands), run one or both of:
sudo port select --set python python312
sudo port select --set python3 python312

-----

Exeute these commands
sudo port select --set awscli py312-awscli

Check your environment variables
env | grep PATH
sudo sh -c "echo "/opt/local/bin" > /etc/paths.d/mac-ports"
sudo sed -i '' -e $'1i\\\n/opt/local/bin' /etc/paths
sudo sed -i '' -e $'2i\\\n/opt/local/sbin' /etc/paths
sudo bash -c "echo 'MANPATH=/opt/local/share/man:\$MANPATH' > /etc/manpaths.d/mac-ports"

Create the Key in AWS IAM. After that you will have the access key id and the secret access key. Configure your key with a profile using the awscli. You can omit the profile.

aws configure --profile yourprofile        

AWS Access Key ID [****************111]: 

AWS Secret Access Key [****************1111]: 

Default region name [None]: us-east-1

Default output format [None]: 



Test the awscli
aws --profile yourprofile ec2 describe-vpcs

jueves, 1 de agosto de 2024

Git first steps

 Just quick notes to initiate and manage a git repository.



alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git init

hint: Using 'master' as the name for the initial branch. This default branch name

hint: is subject to change. To configure the initial branch name to use in all

hint: of your new repositories, which will suppress this warning, call:

hint: 

hint: git config --global init.defaultBranch <name>

hint: 

hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and

hint: 'development'. The just-created branch can be renamed via this command:

hint: 

hint: git branch -m <name>


alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git remote add origin https://github.com/alegarciadelrio/kubernetes.git


ajandrogarcia@MacBook-Air-de-Alejandro kubernetes % git branch -M main


alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git pull origin main

remote: Enumerating objects: 4, done.

remote: Counting objects: 100% (4/4), done.

remote: Compressing objects: 100% (4/4), done.

remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)

Unpacking objects: 100% (4/4), 12.76 KiB | 653.00 KiB/s, done.

From https://github.com/alegarciadelrio/kubernetes

 * branch            main       -> FETCH_HEAD

 * [new branch]      main       -> origin/main

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git add .           

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git commit -m 'Add nginx with ingress example'


If it is your first time using git, maybe you need to configure the author.

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git config --global --edit



# Generate access token with this link, then when you pull use the 

https://docs.github.com/es/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git push -u origin main                        

Enumerating objects: 9, done.

Counting objects: 100% (9/9), done.

Delta compression using up to 4 threads

Compressing objects: 100% (8/8), done.

Writing objects: 100% (8/8), 1.24 KiB | 633.00 KiB/s, done.

Total 8 (delta 2), reused 0 (delta 0), pack-reused 0

remote: Resolving deltas: 100% (2/2), done.

To https://github.com/alegarciadelrio/kubernetes.git

   4782499..bcd1bff  main -> main

Branch 'main' set up to track remote branch 'main' from 'origin'.



Maybe another commands:
git checkout -b new-branch
git branch