chore(wazuh): add minor precautions to automate

This commit is contained in:
Michele Cereda
2024-05-28 21:41:35 +02:00
parent 6b7e7f1819
commit ad665cb334
2 changed files with 39 additions and 6 deletions

View File

@@ -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]
<!--
References
Reference
═╬═Time══
-->
<!-- Knowledge base -->
@@ -681,6 +701,7 @@ See [Integrate with AWS SSM].
[slurp]: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/slurp_module.html
<!-- Others -->
[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/

View File

@@ -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.<br>
> 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 <https://github.com/awslabs/amazon-ecr-credential-helper/issues/207>.
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]
<!--
References
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
[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
<!-- Others -->