Skip to content

Instantly share code, notes, and snippets.

@ajakk
Created July 29, 2022 21:13
Show Gist options
  • Save ajakk/17b39e7bacab0afba0e3d72e60000bfe to your computer and use it in GitHub Desktop.
Save ajakk/17b39e7bacab0afba0e3d72e60000bfe to your computer and use it in GitHub Desktop.
Update Gentoo repository if older than a time
- name: register repository timestamp
shell: date -ud "$(cat /var/db/repos/gentoo/metadata/timestamp.chk)" +%s
register: repo_timestamp
changed_when: false
- name: update repository
# Only run when the repo's timestamp is from more than an hour ago
when: (((ansible_date_time['epoch'] | int) - (repo_timestamp['stdout'] | int)) > 3600)
portage:
sync: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment