Commit 852bc4cc authored by nanahira's avatar nanahira

worker

parent 0ca8ad6e
- name: install pip packages
become: true
pip:
name: 'ansible<3.11.0'
state: latest
- name: set ansible module_utils path
set_fact:
module_util_path: '/usr/local/lib/python{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}/dist-packages/ansible/module_utils'
- name: remove deprecated six
become: true
file:
path: '{{module_util_path}}/six'
state: absent
- name: copy six.py
become: true
copy:
src: /usr/lib/python3/dist-packages/six.py
dest: '{{module_util_path}}/six.py'
- name: copy urls.py
become: true
copy:
src: ./files/urls.py
dest: '{{module_util_path}}/urls.py'
- name: build docker image
# docker build -t ansible-workspace --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg USERNAME=$(w
docker_image:
name: ansible-workspace
source: build
build:
path: '{{ansible_user_dir}}/ansible/workspace-build'
args:
UID: '{{ ansible_user_uid }}'
GID: '{{ ansible_user_gid }}'
USERNAME: '{{ ansible_user_id }}'
- name: replace ansible executables
with_items:
- ansible
- ansible-config
- ansible-connection
- ansible-console
- ansible-doc
- ansible-galaxy
- ansible-inventory
- ansible-playbook
- ansible-pull
- ansible-test
- ansible-vault
become: true
copy:
content: |
#!/bin/bash
docker run -it --rm -v /home/nanahira:/home/nanahira --workdir $PWD --net=host ansible-workspace /usr/local/bin/{{item}} "$@"
dest: /usr/local/bin/{{item}}
mode: 0755
...@@ -40,32 +40,20 @@ ...@@ -40,32 +40,20 @@
- name: install pip packages - name: install pip packages
become: true become: true
pip: pip:
name: ansible<2.11.0,awscli name: awscli
state: latest state: latest
- name: set ansible module_utils path
set_fact:
module_util_path: '/usr/local/lib/python{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}/dist-packages/ansible/module_utils'
- name: remove deprecated six
become: true
file:
path: '{{module_util_path}}/six'
state: absent
- name: copy six.py
become: true
copy:
src: /usr/lib/python3/dist-packages/six.py
dest: '{{module_util_path}}/six.py'
- name: copy urls.py
become: true
copy:
src: ./files/urls.py
dest: '{{module_util_path}}/urls.py'
- name: ansible - name: ansible
become: true become: true
synchronize: synchronize:
src: ~/ansible/ src: ~/ansible/
dest: '{{ansible_user_dir}}/ansible' dest: '{{ansible_user_dir}}/ansible'
delete: true delete: true
- name: install ansible for python <= 3.11
include_tasks: ./tasks/worker-python3.11.yml
when: ansible_python.version.major == 3 and ansible_python.version.minor < 12
- name: install ansible for python >= 3.12
include_tasks: ./tasks/worker-python3.12.yml
when: ansible_python.version.major == 3 and ansible_python.version.minor >= 12
- name: aws - name: aws
synchronize: synchronize:
src: ~/.aws/ src: ~/.aws/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment