Skip to content

Instantly share code, notes, and snippets.

@rvdh
Created May 4, 2016 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rvdh/9e945bde1ff51a59c555c9dfe6585e4a to your computer and use it in GitHub Desktop.
Save rvdh/9e945bde1ff51a59c555c9dfe6585e4a to your computer and use it in GitHub Desktop.
---
- hosts: all
become: true
gather_facts: false
tasks:
- name: check which policy.xml exist
stat:
path: "{{ item }}/policy.xml"
with_items:
- /etc/ImageMagick
- /etc/ImageMagick-6
- /etc/ImageMagick-7
- /usr/local/etc/ImageMagick
- /usr/local/etc/ImageMagick-6
- /usr/local/etc/ImageMagick-7
register: policy_xml
- name: for every policy.xml that exists ensure lines are in the config
lineinfile:
dest: "{{ item.0.item }}/policy.xml"
insertbefore: "</policymap>"
line: "{{ item.1 }}"
with_nested:
- "{{ policy_xml.results }}"
- [' <policy domain="coder" rights="none" pattern="EPHEMERAL" />',
' <policy domain="coder" rights="none" pattern="URL" />',
' <policy domain="coder" rights="none" pattern="HTTPS" />',
' <policy domain="coder" rights="none" pattern="MVG" />',
' <policy domain="coder" rights="none" pattern="MSL" />',
]
when: item.0.stat.exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment