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

mount: & (ampersand) will be converted to \046 in opts field #537

Open
lfchris opened this issue Mar 8, 2024 · 0 comments
Open

mount: & (ampersand) will be converted to \046 in opts field #537

lfchris opened this issue Mar 8, 2024 · 0 comments

Comments

@lfchris
Copy link

lfchris commented Mar 8, 2024

SUMMARY

When creating a cifs mount with credentials, I noticed that if you have an & (ampersand) in your password, it will be converted to \046. This happens in the entire string that you give to the opts field.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mount

ANSIBLE VERSION
ansible [core 2.16.1]
  config file = /Users/chris/git/ansinv/ansible.cfg
  configured module search path = ['/Users/chris/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/9.1.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/chris/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.12.0 (main, Oct  2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)] (/usr/local/Cellar/ansible/9.1.0/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION
# /Users/chris/.ansible/collections/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.4.0

# /usr/local/Cellar/ansible/9.1.0/libexec/lib/python3.12/site-packages/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.5.4
CONFIGURATION
ANSIBLE_NOCOWS(/Users/chris/git/ansinv/ansible.cfg) = True
CACHE_PLUGIN(/Users/chris/git/ansinv/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/Users/chris/git/ansinv/ansible.cfg) = ~/.ansible_cache
CACHE_PLUGIN_TIMEOUT(/Users/chris/git/ansinv/ansible.cfg) = 86400
CALLBACKS_ENABLED(/Users/chris/git/ansinv/ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /Users/chris/git/ansinv/ansible.cfg
DEFAULT_FORKS(/Users/chris/git/ansinv/ansible.cfg) = 30
DEFAULT_GATHERING(/Users/chris/git/ansinv/ansible.cfg) = smart
DEFAULT_HOST_LIST(/Users/chris/git/ansinv/ansible.cfg) = ['/Users/chris/git/ansinv/hosts']
DEFAULT_LOG_PATH(/Users/chris/git/ansinv/ansible.cfg) = /Users/chris/.ansible/ansible.log
DEFAULT_MANAGED_STR(/Users/chris/git/ansinv/ansible.cfg) = This file is managed by Ansible - do not edit
DEFAULT_ROLES_PATH(/Users/chris/git/ansinv/ansible.cfg) = ['/Users/chris/git/roles']
DEFAULT_STDOUT_CALLBACK(/Users/chris/git/ansinv/ansible.cfg) = yaml
DEFAULT_TIMEOUT(/Users/chris/git/ansinv/ansible.cfg) = 15
HOST_KEY_CHECKING(/Users/chris/git/ansinv/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/Users/chris/git/ansinv/ansible.cfg) = ['~', '.orig', '.bak', '.ini', '.cfg', '.retry', '.pyc', '.pyo', '.csv']
INVENTORY_IGNORE_PATTERNS(/Users/chris/git/ansinv/ansible.cfg) = ['(host|group)_files']
PAGER(env: PAGER) = less
RETRY_FILES_ENABLED(/Users/chris/git/ansinv/ansible.cfg) = False
OS / ENVIRONMENT

Rocky8

ansible-playbook --inventory hosts.yml mount --limit log01 --diff -vvv
EXPECTED RESULTS

This string in /etc/fstab:

//192.168.1.24/Backups/log01 /mnt/backup cifs username=log01,password=92KShS&!G5a2E^s,vers=2.0,rw 0 0
ACTUAL RESULTS

This string in /etc/fstab:

//192.168.1.24/Backups/log01 /mnt/backup cifs username=log01,password=92KShS\046!G5a2E^s,vers=2.0,rw 0 0
changed: [log01] => (item={'path': '/mnt/backup', 'fstype': 'cifs', 'src': '//192.168.1.24/Backups/log01', 'opts': "username=log01,password=92KShS&!G5a2E^s,vers=2.0,rw", 'state': 'present'}) => changed=true
  ansible_loop_var: item
  backup_file: ''
  boot: 'yes'
  dump: '0'
  fstab: /etc/fstab
  fstype: cifs
  invocation:
    module_args:
      backup: false
      boot: true
      dump: '0'
      fstab: null
      fstype: cifs
      opts: username=log01,password=92KShS&!G5a2E^s,vers=2.0,rw
      passno: '0'
      path: /mnt/backup
      src: //192.168.1.24/Backups/log01
      state: present
  item:
    fstype: cifs
    opts: username=log01,password=92KShS&!G5a2E^s,vers=2.0,rw
    path: /mnt/backup
    src: //192.168.1.24/Backups/log01
    state: present
  name: /mnt/backup
  opts: username=log01,password=92KShS&!G5a2E^s,vers=2.0,rw
  passno: '0'
  src: //192.168.1.24/Backups/log01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant