Created
July 29, 2022 21:13
-
-
Save ajakk/17b39e7bacab0afba0e3d72e60000bfe to your computer and use it in GitHub Desktop.
Update Gentoo repository if older than a time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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