diff --git a/.ansible-lint-ignore b/.ansible-lint-ignore
index 77d4281..02c6d24 100644
--- a/.ansible-lint-ignore
+++ b/.ansible-lint-ignore
@@ -1,2 +1,3 @@
ansible/playbooks/aws.ec2.enable-ssm-agent.yml package-latest
ansible/playbooks/keybase.register-device.yml no-changed-when
+examples/ansible/aws_ec2.yml yaml[comments-indentation]
diff --git a/.editorconfig b/.editorconfig
index 578fdaf..ca0ddc7 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -29,3 +29,7 @@ indent_size = 4
[*.ts]
indent_size = 4
+
+[Makefile]
+indent_style = tab
+tab_width = 4
diff --git a/.lefthook.yml b/.lefthook.yml
index 9c92c91..d95ae7b 100644
--- a/.lefthook.yml
+++ b/.lefthook.yml
@@ -26,8 +26,9 @@ lint:
parallel: true
commands:
ansible: &ansible-lint
- glob: '*ansible*'
- run: .venv/bin/ansible-lint
+ files: find . -type f -path "*ansible*" -not -path "*venv*"
+ glob: '*.{yaml,yml}'
+ run: .venv/bin/ansible-lint {files}
docker: &hadolint
# The official docker image is based on scratch and only takes only one
# input file at a time. I have no clue how to fix that for now so let's
diff --git a/Makefile b/Makefile
index 8f0f908..ad1629b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,12 @@ override venv ?= ${shell git rev-parse --show-toplevel}/.venv
create-venv: override python_version ?= 3.12
create-venv: ${shell which 'python${python_version}'}
@python${python_version} -m 'venv' '${venv}'
- @source '${venv}/bin/activate' && pip --require-virtualenv install -r 'requirements.txt'
+ @${venv}/bin/pip --require-virtualenv install -U -r 'requirements.txt'
recreate-venv:
@rm -r '${venv}'
@${MAKE} create-venv
+
+update-venv: ${venv}/bin/pip
+ @${venv}/bin/pip freeze -l --require-virtualenv | sed 's/==/>=/' \
+ | xargs ${venv}/bin/pip --require-virtualenv install -U
diff --git a/examples/ansible/knockd.yml b/examples/ansible/knockd.yml
index 7922e14..4e10138 100644
--- a/examples/ansible/knockd.yml
+++ b/examples/ansible/knockd.yml
@@ -37,15 +37,15 @@
dest: /etc/knockd.conf
content: |
[options]
- UseSyslog
- Interface = {{ ansible_default_ipv4.alias }}
+ UseSyslog
+ Interface = {{ ansible_default_ipv4.alias }}
[openClose7777]
- sequence = 2222:udp,3333:tcp,4444:udp
- seq_timeout = 15
- tcpflags = syn
- cmd_timeout = 10
- start_command = /usr/bin/firewall-cmd --add-port=7777/tcp --zone=public
- stop_command = /usr/bin/firewall-cmd --remove-port=7777/tcp --zone=public
+ sequence = 2222:udp,3333:tcp,4444:udp
+ seq_timeout = 15
+ tcpflags = syn
+ cmd_timeout = 10
+ start_command = /usr/bin/firewall-cmd --add-port=7777/tcp --zone=public
+ stop_command = /usr/bin/firewall-cmd --remove-port=7777/tcp --zone=public
backup: true
mode: '0600'
diff --git a/examples/ansible/pi.pihole.docker-compose.yaml b/examples/ansible/pi.pihole.docker-compose.yaml
index 0480a83..c27efa2 100644
--- a/examples/ansible/pi.pihole.docker-compose.yaml
+++ b/examples/ansible/pi.pihole.docker-compose.yaml
@@ -99,7 +99,9 @@
minute: 0
hour: 3 # 3 AM
weekday: 0 # Sunday
- job: docker ps -f 'name=pihole' -f 'status=running' -f 'health=healthy' -q | xargs -I{} docker exec {} pihole -g
+ job: >-
+ docker ps -f 'name=pihole' -f 'status=running' -f 'health=healthy' -q
+ | xargs -I{} docker exec {} pihole -g
- name: Create the cron job for automatic backups
tags:
- backup
@@ -119,9 +121,10 @@
- graviton
community.docker.docker_container_exec:
container: pihole
- command: >
+ command: >-
sqlite3 '/etc/pihole/gravity.db'
- "INSERT OR IGNORE INTO adlist (address, enabled, comment) VALUES ('{{ item }}', 1, 'Listed on v.firebog.net');"
+ "INSERT OR IGNORE INTO adlist (address, enabled, comment)
+ VALUES ('{{ item }}', 1, 'Listed on v.firebog.net');"
# on M1 macs execute `export NO_PROXY=*` first
loop: "{{ lookup('ansible.builtin.url', 'https://v.firebog.net/hosts/lists.php?type=tick', wantlist=True) }}"
async: 600
diff --git a/examples/ansible/templating.yml b/examples/ansible/templating.yml
index 4f94cdd..d2c6488 100644
--- a/examples/ansible/templating.yml
+++ b/examples/ansible/templating.yml
@@ -11,6 +11,24 @@
- name: Get back a conditional value.
ansible.builtin.debug:
var: "{{ 'true' if 'test me a lot' is match('test') else 'false' }}"
+ - name: Use the ternary operator.
+ ansible.builtin.debug:
+ msg: >-
+ {{
+ 'test me a lot' is match('test')
+ | ternary(
+ 'what_if_true',
+ 'what_if_false'
+ )
+ }}
+ {{
+ 'test me a lot' is match('test')
+ | ternary(
+ 'what_if_true',
+ 'what_if_false',
+ 'what_if_null'
+ )
+ }}
# Returns ["string"] from ["", "string", 0, false].
- name: Remove empty or false values from a list piping it to 'select()'.
@@ -118,6 +136,19 @@
- "{{ resource_url is search('USERS', ignorecase=true) }}"
- "{{ resource_url is regex('example\\.com/\\w+/foo') }}"
+ - name: Get specific lines from walls of text.
+ ansible.builtin.debug:
+ msg: "{{ previous_task.stdout | regex_findall('Infra Phase complete, .*') }}"
+ - name: Test specific lines from walls of text.
+ ansible.builtin.debug:
+ msg: >-
+ {{
+ (
+ previous_task.stdout
+ | regex_findall('Infra Phase complete, .*')
+ ) is not search('0/')
+ }}"
+
- name: Show off Ansible's loops
hosts: all
tasks:
diff --git a/knowledge base/visual studio code.md b/knowledge base/visual studio code.md
index f0db72d..e4a6fb8 100644
--- a/knowledge base/visual studio code.md
+++ b/knowledge base/visual studio code.md
@@ -11,11 +11,12 @@
1. [_No extensions found_ when running from source](#no-extensions-found-when-running-from-source)
1. [_Type the name and password of a user in the 'Developer Tools' group to allow Developer Tools Access to make changes_ on Mac OS X](#type-the-name-and-password-of-a-user-in-the-developer-tools-group-to-allow-developer-tools-access-to-make-changes-on-mac-os-x)
1. [Further readings](#further-readings)
-1. [Sources](#sources)
+ 1. [Sources](#sources)
## Configuration
-The configuration consists of the application's defaults, overridden by the user settings first and, if existing, by the workspace settings.
+The configuration consists of the application's defaults, overridden by the user settings first and, if existing, by the
+workspace settings.
See the [settings.json] example.
The user configuration is loaded from the `settings.json` file in the user's configuration directory for the application.
@@ -43,16 +44,17 @@ Built-in:
Extensions:
-| Extension | Setting | Default value | Scopes | Location in tree | Description |
-| -------------------------- | --------------------------------------------- | ------------- | --------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| vscode.git (built-in) | `git.autofetch` | `true` | User, Workspace | Extensions > Git | When set to true, commits will automatically be fetched from the default remote of the current Git repository. Setting to `all` will fetch from all remotes. |
-| angelo-breuer.clock | `clock.alignment` | `"Left"` | User, Workspace | Extensions > Status Bar Clock | Alignment of the clock on the status bar. |
-| angelo-breuer.clock | `clock.format` | `"hh:MM"` | User, Workspace | Extensions > Status Bar Clock | Date and time format. See for more options. |
-| yzhang.markdown-all-in-one | `markdown.extension.orderedList.autoRenumber` | `true` | User, Workspace | Extensions > Markdown All In One | Auto fix ordered list markers. |
-| yzhang.markdown-all-in-one | `markdown.extension.orderedList.marker` | `"ordered"` | User, Workspace | Extensions > Markdown All In One | Auto fix ordered list markers. |
-| yzhang.markdown-all-in-one | `markdown.extension.toc.levels` | `"1..6"` | User, Workspace | Extensions > Markdown All In One | Range of levels for the ToC. |
-| yzhang.markdown-all-in-one | `markdown.extension.toc.orderedList` | `false` | User, Workspace | Extensions > Markdown All In One | Use an ordered list in the ToC. |
-| redhat.ansible | `redhat.telemetry.enabled` | `true` | User, Workspace | Extensions > Ansible | Send telemetry to Red Hat servers. |
+| Extension | Setting | Default value | Scopes | Location in tree | Description |
+| -------------------------- | --------------------------------------------- | ------------- | --------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| vscode.git (built-in) | `git.autofetch` | `true` | User, Workspace | Extensions > Git | When set to true, commits will automatically be fetched from the default remote of the current Git repository. Setting to `all` will fetch from all remotes. |
+| angelo-breuer.clock | `clock.alignment` | `"Left"` | User, Workspace | Extensions > Status Bar Clock | Alignment of the clock on the status bar. |
+| angelo-breuer.clock | `clock.format` | `"hh:MM"` | User, Workspace | Extensions > Status Bar Clock | Date and time format. See for more options. |
+| yzhang.markdown-all-in-one | `markdown.extension.orderedList.autoRenumber` | `true` | User, Workspace | Extensions > Markdown All In One | Auto fix ordered list markers. |
+| yzhang.markdown-all-in-one | `markdown.extension.orderedList.marker` | `"ordered"` | User, Workspace | Extensions > Markdown All In One | Auto fix ordered list markers. |
+| yzhang.markdown-all-in-one | `markdown.extension.toc.levels` | `"1..6"` | User, Workspace | Extensions > Markdown All In One | Range of levels for the ToC. |
+| yzhang.markdown-all-in-one | `markdown.extension.toc.orderedList` | `false` | User, Workspace | Extensions > Markdown All In One | Use an ordered list in the ToC. |
+| redhat.ansible | `redhat.telemetry.enabled` | `true` | User, Workspace | Extensions > Ansible > Telemetry | Send telemetry to Red Hat servers. |
+| redhat.ansible | `ansible.validation.lint.enabled` | `true` | User, Workspace | Extensions > Ansible > Validation | USe ansible-lint if found to lint Ansible files. Kinda a nuisance when enabled. |
## Handy keyboard shortcuts
@@ -140,7 +142,7 @@ sudo dscl . append '/Groups/_developer' GroupMembership "$USER"
- [Documentation]
- [Network connections in Visual Studio Code]
-## Sources
+### Sources
- [Using extensions in compiled VSCode]
- [Recommending VSCode extensions within your Open Source projects]
@@ -148,6 +150,7 @@ sudo dscl . append '/Groups/_developer' GroupMembership "$USER"
- [VSCode (and some non-patched Electron applications) doesn't run after Tumbleweed update on Nvidia]
- [Electron applications all crash upon launch]
- [Authorize a non-admin developer in Xcode / Mac OS]
+- [Deep dive on Ansible VScode extension]
[authorize a non-admin developer in xcode / mac os]: https://stackoverflow.com/questions/1837889/authorize-a-non-admin-developer-in-xcode-mac-os#1837935
+[deep dive on ansible vscode extension]: https://www.ansible.com/blog/deep-dive-on-ansible-vscode-extension/
[electron applications all crash upon launch]: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1944468
[recommending vscode extensions within your open source projects]: https://tattoocoder.com/recommending-vscode-extensions-within-your-open-source-projects/
[using extensions in compiled vscode]: https://stackoverflow.com/questions/44057402/using-extensions-in-compiled-vscode#45291490
diff --git a/requirements.txt b/requirements.txt
index 36fac5b..f611a27 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
-ansible==9.4.0
+ansible==9.5.1
+ansible-lint==24.2.2
click==8.1.7
pyinilint==0.17