Skip to content

Instantly share code, notes, and snippets.

@agramajo
Last active September 22, 2021 11:28
Show Gist options
  • Save agramajo/360648a6d3e5d2fa02f4 to your computer and use it in GitHub Desktop.
Save agramajo/360648a6d3e5d2fa02f4 to your computer and use it in GitHub Desktop.
update openssl with ansible
---
- hosts: all
gather_facts: false
user: root
vars:
openssl_packages:
- openssl
- libssl1.0.0
openssl_services:
- nginx
- apache2
- lighttpd
- php5-fpm
- postfix
tasks:
- name: openssl lastest version
apt: pkg={{item}} state=latest update_cache=yes
register: openssl_updated
with_items: openssl_packages
- name: test running services
command: "service {{item}} status | grep -i running"
register: openssl_services
with_items: openssl_services
when: openssl_updated.changed
ignore_errors: true
- name: restart services
service: name={{item.item}} state=restarted
with_items: openssl_services.results
when: openssl_updated.changed and item.rc == 0
# - debug: var=item
# with_items: openssl_services.results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment