Skip to content
Snippets Groups Projects
site_docker.yml 877 B
Newer Older
#!/usr/bin/env ansible-playbook
---

- name: DOCKER CONTAINERS PROVISIONING
  hosts: localhost
  connection: local
  tags: always
  tasks:
    - name: Create docker containers from inventory
      docker_container:
        name: "{{ item }}"
        image: registry.ubicast.net/docker/debian-systemd:latest
        privileged: true
        command: /lib/systemd/systemd
        state: started
        volumes:
          - /sys/fs/cgroup:/sys/fs/cgroup:ro
        tmpfs:
          - /tmp
          - /run
      with_inventory_hostnames:
        - all:!localhost

    - name: add host to inventory
      add_host:
        name: "{{ item }}"
        ansible_host: "{{ item }}"
        ansible_connection: docker
        ansible_python_interpreter: /usr/bin/python3
        in_docker: true
      with_inventory_hostnames:
        - all:!localhost

- import_playbook: site.yml

...