在离线环境中运行 Ansible 2.4.2,使用 kerberos 进行身份验证,
通过 ansible playbook,在提升模式下使用特定(域)用户运行 powershell 脚本的正确语法是什么:DOMAIN\someuser?
通过提升模式,我的意思是在 Windows 界面中,我会通过以 DOMAIN\someuser 身份登录来运行脚本,然后通过右键单击 cmd 或 powershell 提示快捷方式,选择“以管理员身份运行”。这当然并不意味着我可以使用本地用户“管理员”运行脚本。
我想运行的是:
powershell.exe -executionpolicy bypass -noninteractive -nologo -file "myscript.ps1"
Run Code Online (Sandbox Code Playgroud)
我在 become.yml 中尝试了什么:
- name: sigh
win_command: powershell.exe -executionpolicy bypass -noninteractive -nologo -file "myscript.ps1"
become: yes
become_user: DOMAIN\someuser
become_password: someuserpassword
become_method: runas
Run Code Online (Sandbox Code Playgroud)
脚本运行时出现与它未在高程中运行相关的错误。对 win_shell 和 raw 进行了同样的尝试。尝试不使用 become_user 和 become_password (yml 使用 someuser@DOMAIN.local 用户和密码运行,所以我真的不知道是否需要它)。
我正在拖延,并没有找到通过成为解决方案的参考:http : //docs.ansible.com/ansible/latest/become.html
有任何想法吗?
我想寻求有关 Jenkins Groovy 管道的帮助,从这里复制: Is it possible to createparallel Jenkins Declarative Pipeline stages in a loop?
我希望在并行运行的几个阶段中在地图下传递几组变量。但是,只有最后一组(地图底部的方括号)会在我的地图中注册。
当并行阶段运行时,映射会成功迭代,但仅限于最后一组(当前install_Stage(it)),忽略其他组。这意味着我得到了一个"stage: install ${product}"并行显示四个阶段的管道,仅此而已。我想通过四个阶段(网络设置、恢复和安装)获得三个并行,按照下面的代码:
#!groovy
@Library('ci_builds')
def products = ["A", "B", "C", "D"]
def parallelStagesMap = products.collectEntries {
switch (it) {
case "A":
static_ip_address = "10.100.100.6"; static_vm_name = "install-vm1"; version = "14.1.60"
break
case "B":
static_ip_address = "10.100.100.7"; static_vm_name = "install-vm2"; version = "15.1"
break
case "C":
static_ip_address = "10.100.100.8"; static_vm_name = "install-vm3"; version = "15.1" …Run Code Online (Sandbox Code Playgroud) 运行 ansible 2.4.2.0,
在远程 Centos 机器上, ansible_lsb 为空
运行 ansible -m setup 主机名时 我得到
...
"ansible_lsb": {},
"ansible_lvm": {
...
Run Code Online (Sandbox Code Playgroud)
同一台机器的克隆显示了完整的地图,“major_release”是我真正需要的。
其他属性很好,例如:
"ansible_distribution": "CentOS",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/redhat-release",
"ansible_distribution_file_variety": "RedHat",
"ansible_distribution_major_version": "7",
"ansible_distribution_release": "Core",
"ansible_distribution_version": "7.5.1804",
Run Code Online (Sandbox Code Playgroud)
我能做些什么来填充 ansible_lsb ?