opsta.docker_machine
Gestionar Docker Machine
Rol de Ansible para gestionar máquinas para Docker Machine.
- Instalar Docker Machine
- Crear Docker Machine en cada host objetivo en el inventario
- Buscar y reemplazar el archivo config.json de Docker Machine para cambiar el directorio donde se almacena
Puedes ver un ejemplo de cómo hacer un playbook, configuración y comandos de muestra aquí: https://github.com/winggundamth/ansible-wing-playbook
Notas
- Este rol ejecutará el comando docker-machine en la máquina local
- El nombre de la máquina objetivo en el archivo de inventario será el nombre de la máquina en
docker-machine ls
- La ruta de almacenamiento predeterminada de Docker Machine estará en
files/docker-machine
del playbook. Puedes cambiarla mediante la variabledocker_machine_storage_path
- Este rol está diseñado para ser un rol condicional, así que en el playbook necesitas configurar la variable para la tarea específica a ejecutar. Puedes ver un ejemplo en la sección Ejemplo de Playbook
- Establece la variable
docker_machine_create
atrue
para ejecutar la creación de Docker Machine - Establece la variable
docker_machine_manage_config
atrue
para buscar y reemplazar el config.json de Docker Machine
- Establece la variable
Requisitos
- Debes poder hacer ssh al host objetivo con una clave ssh
Variables del Rol
# Estas son las variables predeterminadas
docker_machine_create: false
docker_machine_manage_config: false
docker_machine_install_version: 0.7.0
docker_machine_install_url: https://github.com/docker/machine/releases/download/v{{ docker_machine_install_version }}/docker-machine-{{ ansible_system }}-{{ ansible_architecture }}
docker_machine_install_path: /usr/local/bin/docker-machine
docker_machine_install_checksum: md5:bf73bbfee97fad04d3ff20151b1847fa
docker_machine_storage_path: "{{ playbook_dir }}/files/docker-machine"
docker_machine_config_file: "{{ docker_machine_storage_path }}/machines/{{ inventory_hostname }}/config.json"
docker_machine_config_variables:
- { regexp: '"StorePath": "(.*)",$', replace: '"StorePath": "{{ docker_machine_storage_path }}",' }
- { regexp: '"StorePath": "(.*)"$', replace: '"StorePath": "{{ docker_machine_storage_path }}/machines/{{ inventory_hostname }}"' }
- { regexp: '"CertDir": "(.*)",$', replace: '"CertDir": "{{ docker_machine_storage_path }}/certs",' }
- { regexp: '"CaCertPath": "(.*)",$', replace: '"CaCertPath": "{{ docker_machine_storage_path }}/certs/ca.pem",' }
- { regexp: '"CaPrivateKeyPath": "(.*)",$', replace: '"CaPrivateKeyPath": "{{ docker_machine_storage_path }}/certs/ca-key.pem",' }
- { regexp: '"ServerCertPath": "(.*)",$', replace: '"ServerCertPath": "{{ docker_machine_storage_path }}/machines/{{ inventory_hostname }}/server.pem",' }
- { regexp: '"ServerKeyPath": "(.*)",$', replace: '"ServerKeyPath": "{{ docker_machine_storage_path }}/machines/{{ inventory_hostname }}/server-key.pem",' }
- { regexp: '"ClientKeyPath": "(.*)",$', replace: '"ClientKeyPath": "{{ docker_machine_storage_path }}/certs/key.pem",' }
- { regexp: '"ClientCertPath": "(.*)",$', replace: '"ClientCertPath": "{{ docker_machine_storage_path }}/certs/cert.pem",' }
# Estas son variables opcionales
docker_machine_extra_parameters: --engine-registry-mirror https://registry-mirror.example.com
Dependencias
N/A
Ejemplo de Playbook
- hosts: all
connection: local
gather_facts: yes
become: false
roles:
- role: winggundamth.docker_machine
docker_machine_create: true
docker_machine_manage_config: true
vars_files:
- "{{ docker_machine_vars_file }}"
Lista de etiquetas útiles
Hay algunas etiquetas útiles que puedes usar para mantener Docker Machine
- docker-machine-create (esto necesita configurar la variable
docker_machine_create
atrue
) - docker-machine-install (esto necesita configurar la variable
docker_machine_create
atrue
) - docker-machine-manage-config (esto necesita configurar la variable
docker_machine_manage_config
atrue
)
Licencia
MIT
Información del Autor
Puedes ver mis trabajos en https://github.com/winggundamth
Acerca del proyecto
Ansible role to manage machines for Docker Machine
Instalar
ansible-galaxy install opsta.docker_machine
Licencia
mit
Descargas
582
Propietario
We build scale