Loading views...
Ansible synchronize python 3 issue

Ansible synchronize python 3 issue

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2019 Dec 23 6:36
Editor
Edited
Edited
2023 Oct 15 3:36
Refs
Refs
 
 
463,464c463,464 < _sshpass_pipe = os.pipe() < cmd = ['sshpass', '-d' + to_native(_sshpass_pipe[0], errors='surrogate_or_strict')] + cmd --- > cmd = ['sshpass', '-p' + rsync_password] + cmd > 577,592c577 < # If we are using password authentication, write the password into the pipe < if rsync_password: < def _write_password_to_pipe(proc): < os.close(_sshpass_pipe[0]) < try: < os.write(_sshpass_pipe[1], to_bytes(rsync_password) + b'\n') < except OSError as exc: < # Ignore broken pipe errors if the sshpass process has exited. < if exc.errno != errno.EPIPE or proc.poll() is None: < raise < < (rc, out, err) = module.run_command( < cmd, pass_fds=_sshpass_pipe, < before_communicate_callback=_write_password_to_pipe) < else: < (rc, out, err) = module.run_command(cmd) --- > (rc, out, err) = module.run_command(cmd)
 
이거를 /usr/lib/python2.7/site-packages/ansible/modules/files/synchronize.py 에서 수정해주고
 
python 3 를 설치해줘야함
 
 
아니근데 localhost 는 되는데 remote node들이 안되네 헝
 
 
이대로 해서
- name: Copy source Directory - push synchronize: mode: push src: /var/www/Pj_Checker dest: /var/www/Pj_Checker rsync_opts: "{{sync_rsync_opts|default(omit)}}" delegate_to: "{{inventory_hostname}}"]
notion image
로 하니까 이런 애러뜸
 
이거하고 나니까
 
 
notion image
뭘.가 없다는 거지?
 
흠 src가 remote에서 가져와야하는데 그게 문제였다 git으로 할가?
rsync 가 맞긴 한데.. command 로 해야하나
- name: Copy source Directory - push synchronize: mode: push src: rsync://10.0.0.190:/var/www/Pj_Checker dest: /var/www rsync_opts: "{{sync_rsync_opts|default(omit)}}"
 
sudo systemctl enable rsyncd.service $ sudo systemctl start rsyncd.service
notion image
위에가 service 안한코드 아래가 한코드인데 별반 비슷하다
그냥 shell로 하기롤..
 
 
 
 
- name: install rsync yum: name=rsync state=present - name: install sshpass yum: name=sshpass state=present - name: add known hosts shell: ssh-keyscan 10.0.0.190 > ~/.ssh/known_hosts - name: copy sync shell: sshpass -p "le153183" rsync -avzh root@10.0.0.190:/var/www/Pj_Checker /var/www
이렇게 마무으리
 

Recommendations