Skip to content

Instantly share code, notes, and snippets.

@basz
Last active October 20, 2015 21:10
Show Gist options
  • Select an option

  • Save basz/1144e2acfa84560d2def to your computer and use it in GitHub Desktop.

Select an option

Save basz/1144e2acfa84560d2def to your computer and use it in GitHub Desktop.
---
- name: mysql | s3 import | apt packages
apt: name={{ item }} state=present
with_items:
- unzip
- python-pip
- name: mysql | s3 import | pip packages
pip: name={{ item }} state=present
with_items:
- boto
ran twice, first with the when option commented.
rattletrap:provisioning bas$ ansible-playbook -i ansible/inventory/local.yml ansible/playbook-provision-db.yml --limit db -vvv
Using /Users/bas/Documents/Projects/PLHW.Sandalinos.ProjectHealthyFeet/provisioning/ansible.cfg as config file
1 plays in ansible/playbook-provision-db.yml
PLAY ***************************************************************************
TASK [setup] *******************************************************************
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost mkdir -p "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375319.0-222647964123333)" && echo "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375319.0-222647964123333)"
<s02.localhost> PUT /var/folders/8q/kjslxh3s4zg8ghmz466mvqk40000gn/T/tmp55TrL4 TO /root/.ansible/tmp/ansible-tmp-1445375319.0-222647964123333/setup
<s02.localhost> SSH: EXEC sftp -b - -C -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r [s02.localhost]
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1445375319.0-222647964123333/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1445375319.0-222647964123333/" > /dev/null 2>&1
ok: [s02.localhost]
TASK [mysql | importing sql from backup] ***************************************
included: /Users/bas/Documents/Projects/PLHW.Sandalinos.ProjectHealthyFeet/provisioning/ansible/roles/provision.mysql/tasks/import_s3_backup.yml for s02.localhost
TASK [mysql | s3 import | apt packages] ****************************************
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost mkdir -p "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375326.39-184826101214610)" && echo "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375326.39-184826101214610)"
<s02.localhost> PUT /var/folders/8q/kjslxh3s4zg8ghmz466mvqk40000gn/T/tmpBOi43o TO /root/.ansible/tmp/ansible-tmp-1445375326.39-184826101214610/apt
<s02.localhost> SSH: EXEC sftp -b - -C -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r [s02.localhost]
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1445375326.39-184826101214610/apt; rm -rf "/root/.ansible/tmp/ansible-tmp-1445375326.39-184826101214610/" > /dev/null 2>&1
ok: [s02.localhost] => (item=unzip,python-pip) => {"cache_update_time": 0, "cache_updated": false, "changed": false, "item": "unzip,python-pip"}
TASK [mysql | s3 import | pip packages] ****************************************
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost mkdir -p "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375329.82-210731307319527)" && echo "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375329.82-210731307319527)"
<s02.localhost> PUT /var/folders/8q/kjslxh3s4zg8ghmz466mvqk40000gn/T/tmprfpkWb TO /root/.ansible/tmp/ansible-tmp-1445375329.82-210731307319527/pip
<s02.localhost> SSH: EXEC sftp -b - -C -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r [s02.localhost]
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1445375329.82-210731307319527/pip; rm -rf "/root/.ansible/tmp/ansible-tmp-1445375329.82-210731307319527/" > /dev/null 2>&1
ok: [s02.localhost] => (item=boto) => {"changed": false, "cmd": "/usr/bin/pip install boto", "item": "boto", "name": "boto", "requirements": null, "state": "present", "stderr": "", "stdout": "Requirement already satisfied (use --upgrade to upgrade): boto in /usr/local/lib/python2.7/dist-packages\nCleaning up...\n", "stdout_lines": ["Requirement already satisfied (use --upgrade to upgrade): boto in /usr/local/lib/python2.7/dist-packages", "Cleaning up..."], "version": null, "virtualenv": null}
PLAY RECAP *********************************************************************
s02.localhost : ok=4 changed=0 unreachable=0 failed=0
rattletrap:provisioning bas$ ansible-playbook -i ansible/inventory/local.yml ansible/playbook-provision-db.yml --limit db -vvv
Using /Users/bas/Documents/Projects/PLHW.Sandalinos.ProjectHealthyFeet/provisioning/ansible.cfg as config file
1 plays in ansible/playbook-provision-db.yml
PLAY ***************************************************************************
TASK [setup] *******************************************************************
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost mkdir -p "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375340.94-168249211484717)" && echo "$(echo $HOME/.ansible/tmp/ansible-tmp-1445375340.94-168249211484717)"
<s02.localhost> PUT /var/folders/8q/kjslxh3s4zg8ghmz466mvqk40000gn/T/tmp_h2Ig1 TO /root/.ansible/tmp/ansible-tmp-1445375340.94-168249211484717/setup
<s02.localhost> SSH: EXEC sftp -b - -C -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r [s02.localhost]
<s02.localhost> ESTABLISH SSH CONNECTION FOR USER: root
<s02.localhost> SSH: EXEC ssh -C -q -o ForwardAgent=yes -o ControlPersist=60s -o 'IdentityFile="/Users/bas/.vagrant.d/insecure_private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/Users/bas/.ansible/cp/ansible-ssh-%h-%p-%r -tt s02.localhost LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1445375340.94-168249211484717/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1445375340.94-168249211484717/" > /dev/null 2>&1
ok: [s02.localhost]
TASK [mysql | importing sql from backup] ***************************************
included: /Users/bas/Documents/Projects/PLHW.Sandalinos.ProjectHealthyFeet/provisioning/ansible/roles/provision.mysql/tasks/import_s3_backup.yml for s02.localhost
TASK [mysql | s3 import | apt packages] ****************************************
skipping: [s02.localhost] => (item=) => {"changed": false, "item": "", "skip_reason": "Conditional check failed", "skipped": true}
TASK [mysql | s3 import | pip packages] ****************************************
skipping: [s02.localhost] => (item=boto) => {"changed": false, "item": "boto", "skip_reason": "Conditional check failed", "skipped": true}
PLAY RECAP *********************************************************************
s02.localhost : ok=2 changed=0 unreachable=0 failed=0
---
- hosts: all
vars:
mysql_databases:
- { name: xxx, collation: utf8_general_ci, encoding: utf8, replicate: 0, import_s3_backup: true }
- { name: xxx, collation: utf8_general_ci, encoding: utf8, replicate: 0, import_s3_backup: true }
tasks:
- name: mysql | importing sql from backup
include: "roles/provision.mysql/tasks/import_s3_backup.yml mysql_database={{ item }}"
with_items: "{{ mysql_databases | list }}"
when: "{{ item.import_s3_backup | default(false) }} == true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment