Skip to content

Instantly share code, notes, and snippets.

@veerendra2
Created February 15, 2023 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veerendra2/19d9bdbb5b10cd36476342843c57c05a to your computer and use it in GitHub Desktop.
Save veerendra2/19d9bdbb5b10cd36476342843c57c05a to your computer and use it in GitHub Desktop.
Enable userns-remap Ansible
- name: Enable userns-remap
hosts: localhost
connection: local
gather_facts: yes
tasks:
- block:
- name: Update userns-remap config
shell: |
cp /etc/docker/daemon.json /etc/docker/daemon.json.backup
jq '. += { "userns-remap" : "default" }' < /etc/docker/daemon.json > /tmp/daemon.json
mv /tmp/daemon.json /etc/docker/daemon.json
rescue:
- name: Create /etc/docker/daemon.json and configure userns-remap
blockinfile:
path: /etc/docker/daemon.json
marker: ""
create: yes
block: |
{
"userns-remap": "default"
}
become: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment