"git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384"
Commit 2ea51c1d authored by one's avatar one
Browse files

Update ansible playbooks to suppress warnings

- Get ansible_user_dir from facts
- Get hostname from facts
- Update NODE_RANK expression
parent ad7ae5c4
...@@ -20,16 +20,16 @@ ...@@ -20,16 +20,16 @@
hosts: all hosts: all
gather_facts: true gather_facts: true
vars: vars:
workspace: '{{ ansible_user_dir }}/sb-workspace' workspace: '{{ ansible_facts["user_dir"] }}/sb-workspace'
container: sb-workspace container: sb-workspace
skip_docker: '{{ no_docker | default(false) }}' skip_docker: '{{ no_docker | default(false) }}'
sb_nodes: '{{ hostvars.values() | map(attribute="ansible_hostname") | sort }}' sb_nodes: '{{ hostvars.values() | map(attribute="ansible_facts.hostname") | sort }}'
sb_env: | sb_env: |
# sb env # sb env
SB_WORKSPACE={{ workspace if skip_docker else '/root' }} SB_WORKSPACE={{ workspace if skip_docker else '/root' }}
# pytorch env # pytorch env
NNODES={{ sb_nodes | length }} NNODES={{ sb_nodes | length }}
NODE_RANK={{ lookup('ansible.utils.index_of', sb_nodes, 'eq', ansible_hostname) }} NODE_RANK={{ sb_nodes.index(ansible_facts["hostname"]) }}
MASTER_ADDR={{ sb_nodes | first }} MASTER_ADDR={{ sb_nodes | first }}
MASTER_PORT=29500 MASTER_PORT=29500
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
hosts: all hosts: all
gather_facts: false gather_facts: false
vars: vars:
workspace: '{{ ansible_user_dir }}/sb-workspace' workspace: '{{ ansible_facts["user_dir"] }}/sb-workspace'
container: sb-workspace container: sb-workspace
tasks: tasks:
- name: Creating Workspace - name: Creating Workspace
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
hosts: all hosts: all
gather_facts: true gather_facts: true
vars: vars:
workspace: '{{ ansible_user_dir }}/sb-workspace' workspace: '{{ ansible_facts["user_dir"] }}/sb-workspace'
tasks: tasks:
- name: Synchronize Output Directory - name: Synchronize Output Directory
ansible.posix.synchronize: ansible.posix.synchronize:
mode: pull mode: pull
src: '{{ sb_output_dir if sb_output_dir.startswith("/") else workspace + "/" + sb_output_dir }}/' src: '{{ sb_output_dir if sb_output_dir.startswith("/") else workspace + "/" + sb_output_dir }}/'
dest: '{{ absolute_output_dir }}/nodes/{{ ansible_hostname }}' dest: '{{ absolute_output_dir }}/nodes/{{ ansible_facts["hostname"] }}'
rsync_opts: rsync_opts:
- --exclude=nodes - --exclude=nodes
{% for host in hostvars.values() | map(attribute='ansible_hostname') | sort %} {% for host in hostvars.values() | map(attribute='ansible_facts.hostname') | sort %}
Host {{ host }} Host {{ host }}
Port {{ ssh_port }} Port {{ ssh_port }}
IdentityFile /root/.ssh/key IdentityFile /root/.ssh/key
......
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