Skip to content

Instantly share code, notes, and snippets.

@hankpillow
Created November 13, 2018 16:19
Show Gist options
  • Save hankpillow/1071114b2943a7665f40aab3fbf46b0f to your computer and use it in GitHub Desktop.
Save hankpillow/1071114b2943a7665f40aab3fbf46b0f to your computer and use it in GitHub Desktop.
ansible playbook with mysql
---
- name: Create container
hosts: localhost
gather_facts: yes
tasks:
- name: Create Drupal container
register: new_container
docker_container:
privileged: yes
state: started
image: "ubuntu:trusty"
name: "ansible-container"
command: sleep infinity
recreate: yes
- name: Add host ansible-container
add_host:
hostname: ansible-container
ansible_connection: docker
- name: Install geerlingguy.mysql
command: ansible-galaxy install geerlingguy.mysql
- name: Install mysql
hosts: ansible-container
connection: docker
gather_facts: no
pre_tasks:
- name: Install python2 for Ansible
raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt install -qqy python-minimal)"
register: output
changed_when: output.stdout != ""
- name: Gathering Facts
setup:
roles:
- geerlingguy.mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment