Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file module creates the file copy instead of creating symlink #39272

Closed
drew1kun opened this issue Apr 25, 2018 · 5 comments
Closed

file module creates the file copy instead of creating symlink #39272

drew1kun opened this issue Apr 25, 2018 · 5 comments
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. files Files category module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@drew1kun
Copy link

drew1kun commented Apr 25, 2018

ISSUE TYPE
  • Bug Report
COMPONENT NAME

file module

ANSIBLE VERSION
ansible 2.4.3.0
  config file = /Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg
  configured module search path = [u'/Users/drew/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Jul 15 2017, 17:16:57) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
CONFIGURATION
DEFAULT_HOST_LIST(/Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg) = [u'/Users/drew/SynologyDrive/rpi-scripts/ansible/hosts']
DEFAULT_SCP_IF_SSH(/Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg) = skippy
DEFAULT_VAULT_PASSWORD_FILE(/Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg) = /Users/drew/SynologyDrive/rpi-scripts/ansible/.vault.key
OS / ENVIRONMENT

Management Host:

$ uname -a
Darwin macpro.bearden.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64

Managed Host:

uname -a
Linux raspberry.localdomain 4.14.34-v8+ #1 SMP PREEMPT Sat Apr 21 18:49:26 UTC 2018 aarch64 GNU/Linux
SUMMARY
STEPS TO REPRODUCE

tasks/main.yml:

- name: "Create softlink for autologin"
  file:
    src: /etc/systemd/system/autologin@.service
    dest: /etc/systemd/system/getty.target.wants/getty@tty1.service
    state: link
  become: yes
EXPECTED RESULTS

First iteration:

TASK [drew-kun.pihole : Create softlink for autologin] ***********************************************************************************
Changed: [rpi]

Check (on Managed host):

$ ll /etc/systemd/system/getty.target.wants/getty@tty1.service
lrwxrwxrwx 1 root root 38 Apr 24 22:01 /etc/systemd/system/getty.target.wants/getty@tty1.service -> /etc/systemd/system/autologin@.service

Second pass (idempotent):

TASK [drew-kun.pihole : Create softlink for autologin] ***********************************************************************************
OK: [rpi]
ACTUAL RESULTS

First iteration:

TASK [drew-kun.pihole : Create softlink for autologin] ***********************************************************************************
Changed: [rpi]

Check (on Managed host) [Not a symlink]:

$ ll /etc/systemd/system/getty.target.wants/getty@tty1.service
-rw-r--r-- 1 root root 1.6K Apr 24 22:01 /etc/systemd/system/getty.target.wants/getty@tty1.service

Second pass (FAILED):

TASK [drew-kun.pihole : Create softlink for autologin] ***********************************************************************************
task path: /Users/drew/.ansible/roles/drew-kun.pihole/tasks/pitft.yml:27
Using module file /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible/modules/files/file.py
<172.16.42.8> ESTABLISH SSH CONNECTION FOR USER: drew
<172.16.42.8> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=drew -o ConnectTimeout=10 -o ControlPath=/Users/drew/.ansible/cp/5bd1930347 172.16.42.8 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<172.16.42.8> (0, '/home/drew\n', 'OpenSSH_7.6p1, LibreSSL 2.6.2\r\ndebug1: Reading configuration data /Users/drew/.ssh/config\r\ndebug1: /Users/drew/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 42867\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<172.16.42.8> ESTABLISH SSH CONNECTION FOR USER: drew
<172.16.42.8> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=drew -o ConnectTimeout=10 -o ControlPath=/Users/drew/.ansible/cp/5bd1930347 172.16.42.8 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040 `" && echo ansible-tmp-1524630795.33-58172408725040="` echo /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040 `" ) && sleep 0'"'"''
<172.16.42.8> (0, 'ansible-tmp-1524630795.33-58172408725040=/home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040\n', 'OpenSSH_7.6p1, LibreSSL 2.6.2\r\ndebug1: Reading configuration data /Users/drew/.ssh/config\r\ndebug1: /Users/drew/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 42867\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<172.16.42.8> PUT /var/folders/2c/m_z3y5gs3fz1m2b2lwzk7yl80000gn/T/tmp4XOKZ2 TO /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/file.py
<172.16.42.8> SSH: EXEC scp -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=drew -o ConnectTimeout=10 -o ControlPath=/Users/drew/.ansible/cp/5bd1930347 /var/folders/2c/m_z3y5gs3fz1m2b2lwzk7yl80000gn/T/tmp4XOKZ2 '[172.16.42.8]:/home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/file.py'
<172.16.42.8> (0, '', 'Executing: program /usr/bin/ssh host 172.16.42.8, user (unspecified), command scp -v -t /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/file.py\nOpenSSH_7.6p1, LibreSSL 2.6.2\r\ndebug1: Reading configuration data /Users/drew/.ssh/config\r\ndebug1: /Users/drew/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 42867\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\nSending file modes: C0600 70076 tmp4XOKZ2\nSink: C0600 70076 tmp4XOKZ2\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<172.16.42.8> ESTABLISH SSH CONNECTION FOR USER: drew
<172.16.42.8> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=drew -o ConnectTimeout=10 -o ControlPath=/Users/drew/.ansible/cp/5bd1930347 172.16.42.8 '/bin/sh -c '"'"'chmod u+x /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/ /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/file.py && sleep 0'"'"''
<172.16.42.8> (0, '', 'OpenSSH_7.6p1, LibreSSL 2.6.2\r\ndebug1: Reading configuration data /Users/drew/.ssh/config\r\ndebug1: /Users/drew/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 42867\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<172.16.42.8> ESTABLISH SSH CONNECTION FOR USER: drew
<172.16.42.8> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=drew -o ConnectTimeout=10 -o ControlPath=/Users/drew/.ansible/cp/5bd1930347 -tt 172.16.42.8 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-vfjamzbqsvpmtdwktrjuhebiakowtrnr; /usr/bin/python /home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/file.py; rm -rf "/home/drew/.ansible/tmp/ansible-tmp-1524630795.33-58172408725040/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<172.16.42.8> (0, '\r\n{"group": "root", "uid": 0, "failed": true, "state": "file", "gid": 0, "mode": "0644", "invocation": {"module_args": {"directory_mode": null, "force": false, "remote_src": null, "path": "/etc/systemd/system/getty.target.wants/getty@tty1.service", "owner": null, "follow": false, "group": null, "unsafe_writes": null, "state": "link", "content": null, "serole": null, "diff_peek": null, "setype": null, "dest": "/etc/systemd/system/getty.target.wants/getty@tty1.service", "selevel": null, "original_basename": null, "regexp": null, "validate": null, "src": "/etc/systemd/system/autologin@.service", "seuser": null, "recurse": false, "delimiter": null, "mode": null, "attributes": null, "backup": null}}, "owner": "root", "path": "/etc/systemd/system/getty.target.wants/getty@tty1.service", "size": 1551, "msg": "refusing to convert between file and link for /etc/systemd/system/getty.target.wants/getty@tty1.service"}\r\n', 'OpenSSH_7.6p1, LibreSSL 2.6.2\r\ndebug1: Reading configuration data /Users/drew/.ssh/config\r\ndebug1: /Users/drew/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 42867\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 172.16.42.8 closed.\r\n')
fatal: [rpi]: FAILED! => {
    "changed": false,
    "gid": 0,
    "group": "root",
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": null,
            "content": null,
            "delimiter": null,
            "dest": "/etc/systemd/system/getty.target.wants/getty@tty1.service",
            "diff_peek": null,
            "directory_mode": null,
            "follow": false,
            "force": false,
            "group": null,
            "mode": null,
            "original_basename": null,
            "owner": null,
            "path": "/etc/systemd/system/getty.target.wants/getty@tty1.service",
            "recurse": false,
            "regexp": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/etc/systemd/system/autologin@.service",
            "state": "link",
            "unsafe_writes": null,
            "validate": null
        }
    },
    "mode": "0644",
    "msg": "refusing to convert between file and link for /etc/systemd/system/getty.target.wants/getty@tty1.service",
    "owner": "root",
    "path": "/etc/systemd/system/getty.target.wants/getty@tty1.service",
    "size": 1551,
    "state": "file",
    "uid": 0
}
	to retry, use: --limit @/Users/drew/SynologyDrive/rpi-scripts/ansible/bootstrap.linux.retry

PLAY RECAP *********************************************************************************************************************************************
rpi                        : ok=4    changed=1    unreachable=0    failed=1
@ansibot
Copy link
Contributor

ansibot commented Apr 25, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 25, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Apr 26, 2018
@ansibot ansibot added the files Files category label Mar 5, 2019
@ansibot
Copy link
Contributor

ansibot commented May 16, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@relrod relrod added needs_verified This issue needs to be verified/reproduced by maintainer P3 Priority 3 - Approved, No Time Limitation labels Apr 9, 2021
@mkrizek
Copy link
Contributor

mkrizek commented May 4, 2021

@drew-kun I was not able to reproduce this issue. Is it still something you are seeing with recent versions of Ansible?

needs_info

@ansibot ansibot added the needs_info This issue requires further information. Please answer any outstanding questions. label May 4, 2021
@drew1kun
Copy link
Author

drew1kun commented May 9, 2021

It's been a while.. I guess the issue has been gone...

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label May 9, 2021
@mkrizek
Copy link
Contributor

mkrizek commented May 10, 2021

Closing per above.

@mkrizek mkrizek closed this as completed May 10, 2021
@ansible ansible locked and limited conversation to collaborators Jun 7, 2021
@sivel sivel removed the needs_verified This issue needs to be verified/reproduced by maintainer label Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. files Files category module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

6 participants