diff --git a/knowledge base/ansible.md b/knowledge base/ansible.md index 1811200..67b9c3d 100644 --- a/knowledge base/ansible.md +++ b/knowledge base/ansible.md @@ -7,6 +7,7 @@ 1. [Loops](#loops) 1. [Roles](#roles) 1. [Get roles](#get-roles) + 1. [Assign roles](#assign-roles) 1. [Role dependencies](#role-dependencies) 1. [Output formatting](#output-formatting) 1. [Create custom filter plugins](#create-custom-filter-plugins) @@ -270,6 +271,23 @@ ansible-galaxy install 'git+https://github.com/namespace/role.git,commit-hash' ansible-galaxy install -r 'requirements.yml' ``` +### Assign roles + +In playbooks: + +```yaml +--- +- hosts: all + roles: + - web_server + - geerlingguy.postgresql + - role: /custom/path/to/role + vars: + var1: value1 + tags: example + message: some message +``` + ### Role dependencies Set them up in `role/meta/main.yml`: @@ -652,11 +670,13 @@ See [Integrate with AWS SSM]. - [Merging two dictionaries by key in Ansible] - [Creating your own Ansible filter plugins] - [Why Ansible and Python fork break on macOS High Sierra+ and how to solve] -- [Ansible: Set variable to file content] +- [Ansible: set variable to file content] - [How can I hide skipped tasks output in Ansible] +- [Ansible roles: basics, creating & using] @@ -681,6 +701,7 @@ See [Integrate with AWS SSM]. [slurp]: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/slurp_module.html +[ansible roles: basics, creating & using]: https://spacelift.io/blog/ansible-roles [ansible: set variable to file content]: https://stackoverflow.com/questions/24003880/ansible-set-variable-to-file-content [check if a list contains an item in ansible]: https://stackoverflow.com/questions/28080145/check-if-a-list-contains-an-item-in-ansible/28084746 [creating your own ansible filter plugins]: https://www.dasblinkenlichten.com/creating-ansible-filter-plugins/ diff --git a/knowledge base/cloud computing/aws/ecr.md b/knowledge base/cloud computing/aws/ecr.md index 47f03ac..e598348 100644 --- a/knowledge base/cloud computing/aws/ecr.md +++ b/knowledge base/cloud computing/aws/ecr.md @@ -2,6 +2,8 @@ 1. [TL;DR](#tldr) 1. [Pull through cache feature](#pull-through-cache-feature) +1. [Troubleshooting](#troubleshooting) + 1. [Docker pull errors with `no basic auth credentials`](#docker-pull-errors-with-no-basic-auth-credentials) 1. [Further readings](#further-readings) 1. [Sources](#sources) @@ -70,6 +72,18 @@ aws ecr describe-repositories --repository-names 'docker-tools/image-builder' \ > **Note:** when requesting an image for the first time using the pull through cache, the ECR creates a new repository for that image.
> This might™ introduce a small latency and be cause of pull failures. Pulling that (not-yet)cached image from an interactive shell session worked flawlessly. +## Troubleshooting + +### Docker pull errors with `no basic auth credentials` + +Refer . + +Context: trying to pull an image on an EC2 instance that is using the amazon-ecr-credential-helper to login. + +1. Check the user's `~/.ecr/log/ecr-login.log` file to get detailed information. +1. Check the user's `~/.docker/config.json` file has a correct PAT. +1. Check the instance's role has permissions to pull images. + ## Further readings - [Amazon Web Services] @@ -82,10 +96,10 @@ aws ecr describe-repositories --repository-names 'docker-tools/image-builder' \ - [CLI subcommand reference] - [amazon web services]: README.md [cli]: cli.md @@ -95,5 +109,3 @@ aws ecr describe-repositories --repository-names 'docker-tools/image-builder' \ [cli subcommand reference]: https://docs.aws.amazon.com/cli/latest/reference/ecr/ [creating a lifecycle policy preview]: https://docs.aws.amazon.com/AmazonECR/latest/userguide/lpp_creation.html [using pull through cache rules]: https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache.html - -