Skip to content

Instantly share code, notes, and snippets.

@williampsena
Last active December 19, 2018 11:47
Show Gist options
  • Save williampsena/fb5b1823f6766a15ac7ea69f80b71836 to your computer and use it in GitHub Desktop.
Save williampsena/fb5b1823f6766a15ac7ea69f80b71836 to your computer and use it in GitHub Desktop.
---
- hosts: home
vars:
host_port: 80
expose_port: 9000
portainer_endpoint: "http://localhost:{{ host_port }}/api"
tasks:
- name: Ensure portainer container is running
docker_container:
name: portainer_docker
image: portainer/portainer
recreate: yes
ports:
- "{{ host_port }}:{{ expose_port }}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- name: Configure admin user password
uri:
url: "{{ portainer_endpoint }}/users/admin/init"
method: POST
return_content: yes
body_format: json
body: { "Username": "admin", "Password": "no"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment