Skip to content

Instantly share code, notes, and snippets.

@rhowe
Created November 29, 2020 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhowe/0177584868309347dcb7ae52cf1fe294 to your computer and use it in GitHub Desktop.
Save rhowe/0177584868309347dcb7ae52cf1fe294 to your computer and use it in GitHub Desktop.
Advent of Code 2019 (ansible)
- hosts: localhost
tasks:
- name: Calculate fuel per item
debug: msg="{{ ((item | int) / 3) | int - 2 }}"
loop: "{{ lookup('file', 'input').splitlines() }}"
register: output_things
- name: Calculate total fuel
debug: msg="{{ output_things.results | map(attribute='msg') | map('int') | sum }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment