Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.package
Commits
92d78bf2
Commit
92d78bf2
authored
Sep 14, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: add yum roles which optimise yum task by trying to update package only when defined
parent
fd0c4951
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
playbook/roles/ntp/tasks/main.yml
playbook/roles/ntp/tasks/main.yml
+2
-3
playbook/roles/vm-bootstrap/tasks/sudo.yml
playbook/roles/vm-bootstrap/tasks/sudo.yml
+3
-3
playbook/roles/yum/tasks/main.yml
playbook/roles/yum/tasks/main.yml
+27
-0
No files found.
playbook/roles/ntp/tasks/main.yml
View file @
92d78bf2
---
-
name
:
Install ntp
apt
:
name=ntp state=latest update_cache=yes
apt
:
name=ntp state=latest update_cache=yes
cache_valid_time=86400
when
:
ansible_os_family == "Debian"
-
name
:
Install ntp
yum
:
name=ntp state=latest update_cache=yes
-
include
:
../../yum/tasks/main.yml name=ntp cache_valid_time=86400
when
:
ansible_os_family == "RedHat"
-
name
:
ensure ntp is runing
...
...
playbook/roles/vm-bootstrap/tasks/sudo.yml
View file @
92d78bf2
---
-
name
:
Ensure sudo is installed
apt
:
name=sudo state=latest update_cache=yes cache_valid_time=
36
00
apt
:
name=sudo state=latest update_cache=yes cache_valid_time=
864
00
when
:
ansible_os_family == "Debian"
-
name
:
Ensure sudo is installed (yum)
yum
:
name=sudo state=latest update_cache=yes
-
include
:
../../yum/tasks/main.yml name=sudo cache_valid_time=86400
when
:
ansible_os_family == "RedHat"
-
name
:
Ensure /etc/sudoers.d directory is present
...
...
playbook/roles/yum/tasks/main.yml
0 → 100644
View file @
92d78bf2
---
-
name
:
Check when last checked
stat
:
path=/etc/opt/ansible-yum-latest-{{ name }}
register
:
check_path
changed_when
:
false
-
name
:
Calculate age target
shell
:
echo {{ check_path.stat.mtime|int + cache_valid_time|int }}
register
:
age_target
when
:
check_path.stat.exists ==
true
changed_when
:
false
-
name
:
Install/update package {{ name }}
yum
:
name={{ name }}
state=latest
update_cache=yes
when
:
check_path.stat.exists ==
false
or age_target.stdout|int <= ansible_date_time.epoch|int
-
name
:
Update Cache File
file
:
path=/etc/opt/ansible-yum-latest-{{ name }}
mode=0600
state=touch
when
:
check_path.stat.exists ==
false
or age_target.stdout|int <= ansible_date_time.epoch|int
changed_when
:
false
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment