我需要在一些服务器上为Firefox创建一个默认档案,这需要 DISPLAY 数字。我无法通过 Ansible 实现这个目标。我一直试图使 X11 转发工作,但一直没有成功。由于不允许更改 SSH 配置,因此无法从那里启用 X11。请问如何使用 Ansible 来实现这一点?
我已经尝试了以下方法:
- name: Create default profile shell: firefox -createprofile "default /opt/profiles/default"
and setting the
ssh_args
inansible.cfg
to:ssh_args= -X
This fails with:
Failed to connect to the host via ssh: ssh: connect to host as1 port 22: No route to host
- name: Create default profile shell: | export DISPLAY=:0.0 firefox -createprofile "default /opt/profiles/default"
without adding the
ssh_args = -X option
This fails with:
No protocol specified, Error: cannot open display: :0.0
我可以使用ssh -X user@as1
成功运行以下命令:firefox -createprofile "default /opt/profiles/default"
一定有其他方法可以实现这个功能,但我不确定还可以尝试什么。