Last active
September 21, 2019 04:03
-
-
Save marsyang1/36bec4372c07b53b1ae087ff306cb51e to your computer and use it in GitHub Desktop.
for google cloud compute + centos + ansible remote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for google cloud compute + centos + ansible remote | |
# | |
# ansible-playbook execute command | |
# ansible -i inventory.ini -m ping --key-file ~/.ssh/key hostname | |
# for multi project | |
# ansible -i inventory.ini -m ping --key-file ~/.ssh/key groupname | |
# | |
# ansible-playbook -i inventory.ini --key-file=~/.ssh/key reinstallUrllib3.yml --extra-vars "target=hostname" | |
# ansible-playbook -i inventory.ini --key-file=~/.ssh/key reinstallUrllib3.yml --extra-vars "target=groupname" | |
# | |
# google cloud compute 用到的 urllib3 会跟 ansible docker module 有冲突 , 要特別調整 | |
# | |
- hosts: "{{target}}" | |
strategy: free | |
become: true | |
vars: | |
os_user: mars | |
tasks: | |
- name: remove python3 | |
yum: | |
# ansible only support python 3.5 or above . https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html | |
name: 'python36*' | |
state: absent | |
- name: force pip to old version | |
shell: sudo pip install --upgrade --force-reinstall pip==9.0.3 | |
- name: pip uninstall | |
pip: | |
name: | |
- requests | |
- docker | |
- docker-py | |
- backports.ssl-match-hostname | |
state: absent | |
- name: force remove urllib3 | |
shell: pip uninstall urllib3 -y | |
- name: upgrade pip to latest version | |
shell: pip install --upgrade pip | |
- name: upgrade all packages | |
yum: | |
name: '*' | |
state: latest | |
- name: test reinstall docker requests | |
pip: | |
name: | |
# docker-py too old , change to use docker https://docker-py.readthedocs.io/en/stable/ | |
- docker>=4 | |
- requests>=2.20.1 | |
- urllib3>=1.25 | |
state: latest | |
- name: upgrade urllib3 | |
shell: pip install --upgrade urllib3 | |
- name: pull test image | |
docker_image: | |
name: hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment