General info: https://developer.1password.com/docs/cli
Release Versions: https://app-updates.agilebits.com/product_history/CLI2
OP_VERSION="v2.13.1"
# Download and Install
curl -sSfo op.zip https://cache.agilebits.com/dist/1P/op2/pkg/${OP_VERSION}/op_linux_amd64_${OP_VERSION}.zip
sudo unzip -od /usr/local/bin/ op.zip
rm op.zip
# Add correct permissions
sudo groupadd onepassword-cli
sudo chown root:onepassword-cli /usr/local/bin/op
sudo chmod g+s /usr/local/bin/op
Find Secret Key: https://support.1password.com/secret-key
OP_ACCOUNT_ADDRESS="https://XXXXXX.1password.com/"
OP_ACCOUNT_EMAIL="USERNAME@DOMAIN.com"
OP_ACCOUNT_SECRET_KEY="A3-..."
OP_ACCOUNT_SHORTHAND="my_account"
op account add \
--shorthand "${OP_ACCOUNT_SHORTHAND}" \
--address "${OP_ACCOUNT_ADDRESS}" \
--email "${OP_ACCOUNT_EMAIL}" \
--secret-key "${OP_ACCOUNT_SECRET_KEY}"
OP_ACCOUNT_PASSWORD="<YOUR PASSWORD>"
eval $(printf "${OP_ACCOUNT_PASSWORD}\n" | op signin --account ${OP_ACCOUNT_SHORTHAND})
More info: https://developer.1password.com/docs/cli/get-started#usage
# List all vault secrets
op items list
# Get some login password
op item get "My Secret Something" --fields password
# Take a template file, add credentials, and make config file
op inject -i config.yml.tpl -o config.yml
op signout --account ${OP_ACCOUNT_SHORTHAND}